forked from STI/Astroport.ONE
312 lines
12 KiB
Python
312 lines
12 KiB
Python
# -*- coding: utf-8 -*-
|
|
# vStream https://github.com/Kodi-vStream/venom-xbmc-addons
|
|
import re
|
|
|
|
from resources.lib.comaddon import siteManager
|
|
from resources.lib.gui.gui import cGui
|
|
from resources.lib.gui.hoster import cHosterGui
|
|
from resources.lib.handler.inputParameterHandler import cInputParameterHandler
|
|
from resources.lib.handler.outputParameterHandler import cOutputParameterHandler
|
|
from resources.lib.handler.requestHandler import cRequestHandler
|
|
from resources.lib.parser import cParser
|
|
from resources.lib.util import cUtil
|
|
|
|
SITE_IDENTIFIER = 'ducine'
|
|
SITE_NAME = 'Du Ciné'
|
|
SITE_DESC = 'Films et Séries en Français streaming gratuit'
|
|
|
|
URL_MAIN = siteManager().getUrlMain(SITE_IDENTIFIER)
|
|
# "https://www.ducine.site/"
|
|
|
|
MOVIE_MOVIE = (True, 'showMenuMovies')
|
|
MOVIE_NEWS = (URL_MAIN + 'films-vostfr.html', 'showMovies')
|
|
MOVIE_GENRES = (URL_MAIN + 'films-vostfr/genres/', 'showGenres')
|
|
MOVIE_ANNEES = (URL_MAIN + 'films-vostfr/annee/', 'showYears')
|
|
|
|
SERIE_SERIES = (True, 'showMenuTvShows')
|
|
SERIE_NEWS = (URL_MAIN + 'series-vostfr.html', 'showMovies')
|
|
SERIE_GENRES = (URL_MAIN + 'series-vostfr/genres/', 'showGenres')
|
|
SERIE_ANNEES = (URL_MAIN + 'series-vostfr/annee/', 'showYears')
|
|
|
|
URL_SEARCH = (URL_MAIN + 'recherche?q=', 'showMovies')
|
|
URL_SEARCH_MOVIES = (URL_SEARCH[0], 'showMovies')
|
|
URL_SEARCH_SERIES = (URL_SEARCH[0], 'showMovies')
|
|
FUNCTION_SEARCH = 'showMovies'
|
|
|
|
|
|
def load():
|
|
oGui = cGui()
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
oOutputParameterHandler.addParameter('siteUrl', URL_SEARCH[0])
|
|
oGui.addDir(SITE_IDENTIFIER, 'showSearch', 'Recherche', 'search.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_NEWS[0])
|
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_NEWS[1], 'Films (Derniers ajouts)', 'news.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_GENRES[0])
|
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_GENRES[1], 'Films (Genres)', 'genres.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_ANNEES[0])
|
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_ANNEES[1], 'Films (Par années)', 'annees.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_NEWS[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_NEWS[1], 'Séries (Derniers ajouts)', 'news.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_GENRES[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_GENRES[1], 'Séries (Genres)', 'genres.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_ANNEES[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_ANNEES[1], 'Séries (Par années)', 'annees.png', oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showMenuMovies():
|
|
oGui = cGui()
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
oOutputParameterHandler.addParameter('siteUrl', URL_SEARCH[0])
|
|
oGui.addDir(SITE_IDENTIFIER, 'showSearch', 'Recherche', 'search.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_NEWS[0])
|
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_NEWS[1], 'Films (Derniers ajouts)', 'news.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_GENRES[0])
|
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_GENRES[1], 'Films (Genres)', 'genres.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_ANNEES[0])
|
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_ANNEES[1], 'Films (Par années)', 'annees.png', oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showMenuTvShows():
|
|
oGui = cGui()
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
oOutputParameterHandler.addParameter('siteUrl', URL_SEARCH[0])
|
|
oGui.addDir(SITE_IDENTIFIER, 'showSearch', 'Recherche', 'search.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_NEWS[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_NEWS[1], 'Séries (Derniers ajouts)', 'news.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_GENRES[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_GENRES[1], 'Séries (Genres)', 'genres.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_ANNEES[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_ANNEES[1], 'Séries (Par années)', 'annees.png', oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showSearch():
|
|
oGui = cGui()
|
|
sSearchText = oGui.showKeyBoard()
|
|
if sSearchText != False:
|
|
showMovies(URL_SEARCH[0] + sSearchText)
|
|
oGui.setEndOfDirectory()
|
|
return
|
|
|
|
|
|
def showGenres():
|
|
oGui = cGui()
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
urlType = oInputParameterHandler.getValue('siteUrl')
|
|
|
|
liste = [['Action', 'action'], ['Animation', 'animation'], ['Aventure', 'aventure'], ['Comédie', 'comaedie'],
|
|
['Documentaire', 'documentaire'], ['Drame', 'drame'], ['Epouvante Horreur', 'epouvante-horreur'],
|
|
['Famille', 'famille'], ['Fantastique', 'fantastique'], ['Guerre', 'guerre'], ['Policier', 'policier'],
|
|
['Romance', 'romance'], ['Thriller', 'thriller'], ['Divers', 'divers']]
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for sTitle, sUrl in liste:
|
|
oOutputParameterHandler.addParameter('siteUrl', urlType + sUrl + '.html')
|
|
oGui.addDir(SITE_IDENTIFIER, 'showMovies', sTitle, 'genres.png', oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showYears():
|
|
oGui = cGui()
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for i in reversed(range(2001, 2022)):
|
|
Year = str(i)
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl + Year + '.html')
|
|
oGui.addDir(SITE_IDENTIFIER, 'showMovies', Year, 'annees.png', oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showMovies(sSearch=''):
|
|
oGui = cGui()
|
|
|
|
if sSearch:
|
|
oUtil = cUtil()
|
|
sSearchText = sSearch.replace(URL_SEARCH_MOVIES[0], '')
|
|
sSearchText = sSearchText.replace(URL_SEARCH_SERIES[0], '')
|
|
sSearchText = oUtil.CleanName(sSearchText)
|
|
sUrl = sSearch.replace(' ', '+')
|
|
else:
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
sPattern = 'mask" href="([^"]+).+?src="([^"]+).+?(?:|qualite">([^<]+).+?)title">([^<]+)'
|
|
oParser = cParser()
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
if aResult[0]:
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for aEntry in aResult[1]:
|
|
sUrl = aEntry[0]
|
|
sThumb = URL_MAIN[:-1] + aEntry[1]
|
|
sTitle = aEntry[3]
|
|
|
|
if sSearch:
|
|
if not oUtil.CheckOccurence(sSearchText, sTitle):
|
|
continue # Filtre de recherche
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
|
if 'series-vostfr' in sUrl:
|
|
oGui.addTV(SITE_IDENTIFIER, 'showSaisons', sTitle, '', sThumb, '', oOutputParameterHandler)
|
|
else:
|
|
sTitle = sTitle + ' [' + aEntry[2] + ']'
|
|
oGui.addMovie(SITE_IDENTIFIER, 'showHosters', sTitle, '', sThumb, '', oOutputParameterHandler)
|
|
else:
|
|
oGui.addText(SITE_IDENTIFIER)
|
|
|
|
if not sSearch:
|
|
sNextPage, sPaging = __checkForNextPage(sHtmlContent)
|
|
if sNextPage != False:
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
oOutputParameterHandler.addParameter('siteUrl', sNextPage)
|
|
oGui.addNext(SITE_IDENTIFIER, 'showMovies', 'Page ' + sPaging, oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def __checkForNextPage(sHtmlContent):
|
|
oParser = cParser()
|
|
sPattern = '<span>[\d+]</span><a href="([^"]+).+?>(\d+)</a>\s*</div'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
if aResult[0] is True:
|
|
sNextPage = aResult[1][0][0]
|
|
sNumberMax = aResult[1][0][1]
|
|
sNumberNext = re.search('([0-9]+).html', sNextPage).group(1)
|
|
sPaging = sNumberNext + '/' + sNumberMax
|
|
return sNextPage, sPaging
|
|
|
|
return False, 'none'
|
|
|
|
|
|
def showSaisons():
|
|
oGui = cGui()
|
|
oParser = cParser()
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
# récupération du Synopsis
|
|
sDesc = ''
|
|
try:
|
|
sPattern = 'Synopsis:.+?<p>([^<]+)'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
if aResult[0]:
|
|
sDesc = aResult[1][0]
|
|
except:
|
|
pass
|
|
|
|
sPattern = '([^"]+)" title="[^"]+" class="part13">Tous les épisodes.+?part12">([^<]+)'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
if aResult[0] is True:
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for aEntry in aResult[1]:
|
|
|
|
sUrl = aEntry[0]
|
|
sTitle = sMovieTitle + ' ' + aEntry[1]
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
|
oOutputParameterHandler.addParameter('sDesc', sDesc)
|
|
oGui.addSeason(SITE_IDENTIFIER, 'showEpisodes', sTitle, '', sThumb, sDesc, oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showEpisodes():
|
|
oGui = cGui()
|
|
oParser = cParser()
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
|
sDesc = oInputParameterHandler.getValue('sDesc')
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
# le </ en fin de regex est utile
|
|
sPattern = 'href="([^"]+)"><div class="fsa-ep">.+?</span>([^<]+)</'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
if aResult[0] is False:
|
|
oGui.addText(SITE_IDENTIFIER)
|
|
|
|
if aResult[0] is True:
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for aEntry in aResult[1]:
|
|
sUrl = aEntry[0]
|
|
sTitle = sMovieTitle + ' Episode ' + aEntry[1]
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
|
oOutputParameterHandler.addParameter('sDesc', sDesc)
|
|
oGui.addEpisode(SITE_IDENTIFIER, 'showHosters', sTitle, '', sThumb, sDesc, oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showHosters():
|
|
oGui = cGui()
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
oParser = cParser()
|
|
sPattern = 'data-url="([^"]+).+?src="/icon/([^"]+).png'
|
|
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
if aResult[0] is True:
|
|
for aEntry in aResult[1]:
|
|
|
|
sHosterUrl = aEntry[0]
|
|
sLang = aEntry[1].upper()
|
|
|
|
oHoster = cHosterGui().checkHoster(sHosterUrl)
|
|
if oHoster != False:
|
|
oHoster.setDisplayName(sMovieTitle + ' (' + sLang + ')')
|
|
oHoster.setFileName(sMovieTitle)
|
|
cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumb)
|
|
|
|
oGui.setEndOfDirectory()
|