diff --git a/plugin.video.vstream/resources/sites/pastebin.py b/plugin.video.vstream/resources/sites/pastebin.py index 65b6ee883a..bff99eeff4 100644 --- a/plugin.video.vstream/resources/sites/pastebin.py +++ b/plugin.video.vstream/resources/sites/pastebin.py @@ -32,9 +32,10 @@ SETTING_PASTE_LABEL = SITE_IDENTIFIER + '_label_' UNCLASSIFIED_GENRE = '_NON CLASSÉ_' UNCLASSIFIED = 'Indéterminé' +BLACKLIST_APPLIED = "BLACKLIST APPLIED" MOVIE_MOVIE = (URL_MAIN + '&sMedia=film', 'showMenuFilms') -#MOVIE_NEWS = (URL_MAIN + '&sMedia=film&sYear=2023', 'showMovies') +# MOVIE_NEWS = (URL_MAIN + '&sMedia=film&sYear=2023', 'showMovies') MOVIE_NEWS = ('movie/now_playing', 'showTMDB') # MOVIE_GENRES = (URL_MAIN + '&sMedia=film', 'showGenres') MOVIE_GENRES = ('genre/movie/list', 'showGenreMovieTMDB') @@ -94,10 +95,17 @@ def getNbItemParPage(): addon().setSetting(SITE_IDENTIFIER + '_nbItemParPage', nbItem) return int(nbItem) +def getResolutionBlacklist(): + nResolutions = addon().getSetting(SITE_IDENTIFIER + '_nResolutions') + if not nResolutions: + nResolutions = "" + addon().setSetting(SITE_IDENTIFIER + '_nResolutions', nResolutions) + return nResolutions -ITEM_PAR_PAGE = getNbItemParPage() -GROUPE_MAX = 50 # jusqu'à 50 dossiers, limitation du skin -PASTE_PAR_GROUPE = 100 # jusqu'à 100 liens pastebin par dossier +ITEM_PAR_PAGE = getNbItemParPage() +RESOLUTIONS_BACKLIST = getResolutionBlacklist() +GROUPE_MAX = 50 # jusqu'à 50 dossiers, limitation du skin +PASTE_PAR_GROUPE = 100 # jusqu'à 100 liens pastebin par dossier # Durée du cache, en Heures @@ -1268,7 +1276,7 @@ def showSearch(): sUrl = oInputParameterHandler.getValue('siteUrl') sSearchText = oGui.showKeyBoard() - if sSearchText: + if sSearchText != False: sUrl += Quote(sSearchText) showMovies(sUrl) @@ -1871,11 +1879,18 @@ def trie_res(key): def showResolution(): - oGui = cGui() - oInputParameterHandler = cInputParameterHandler() - siteUrl = oInputParameterHandler.getValue('siteUrl') + oGui = cGui() + oInputParameterHandler = cInputParameterHandler() + siteUrl = oInputParameterHandler.getValue('siteUrl') oOutputParameterHandler = cOutputParameterHandler() - resolutions = [('DOLBY VISION', 'DOLBY VISION'), ('4K', '4K [2160p]'), ('1080P', 'fullHD [1080p]'), ('720P', 'HD [720p]'), ('SD', 'SD'), ('3D', '3D')] + resolutions = [('DOLBY VISION', 'DOLBY VISION'), ('4K', '4K [2160p]'), ('1080P', 'fullHD [1080p]'), ('720P', 'HD [720p]'), ('SD', 'SD'), ('3D', '3D')] + + # Create BLACKLIST APPLIED folder if RESOLUTIONS_BACKLIST is not empty + if RESOLUTIONS_BACKLIST != "": + sUrl = siteUrl + '&sRes=' + BLACKLIST_APPLIED + oOutputParameterHandler.addParameter('siteUrl', sUrl) + oGui.addDir(SITE_IDENTIFIER, 'showMenuFilms', BLACKLIST_APPLIED, 'hd.png', oOutputParameterHandler) + for sRes, sDisplayRes in resolutions: sUrl = siteUrl + '&sRes=' + sRes oOutputParameterHandler.addParameter('siteUrl', sUrl) @@ -1883,7 +1898,6 @@ def showResolution(): oGui.setEndOfDirectory() - def alphaList(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() @@ -2177,13 +2191,22 @@ def showMovies(sSearch=''): listRes.append('') if sRes: + if sRes == BLACKLIST_APPLIED: + # Extract the resolution that are blacklisted from listRes + oldListRes = listRes + listRes = [] + for res in oldListRes: + if res not in RESOLUTIONS_BACKLIST.strip().split(','): + listRes.append(res) if sRes == UNCLASSIFIED: if '' not in listRes: continue bValid = False + for res in listRes: - if sRes in res: + # Set bValid = True if sRest = BLACKLIST APPLIED because it is like we got each sRes in res + if sRes == BLACKLIST_APPLIED or sRes in res: bValid = True break @@ -2221,7 +2244,6 @@ def showMovies(sSearch=''): oOutputParameterHandler.addParameter('sYear', movieYear) # Utilisé par TMDB if listRes: oOutputParameterHandler.addParameter('listRes', listRes) - if sMedia == 'serie': oGui.addTV(SITE_IDENTIFIER, 'showSerieSaisons', sDisplayTitle, 'series.png', '', '', oOutputParameterHandler) elif sMedia == 'anime': @@ -2552,7 +2574,8 @@ def getHosterList(siteUrl): idxResMovie += 1 # On vérifie la résolution attendue si pas uptostream - if sRes and sRes not in resMovie: + # And different than BLACKLIST APPLIED + if sRes and sRes not in resMovie and sRes != BLACKLIST_APPLIED: if pbContent.getUptoStream() == 2: continue @@ -2576,11 +2599,16 @@ def getHosterList(siteUrl): linkToAdd = False if sRes: # Recherche d'une résolution en particulier - if res and res != 'ori': + # if sRes = BLACKLIST APPLIED check that res are not in RESOLUTIONS_BACKLIST + if sRes == BLACKLIST_APPLIED: + if res not in RESOLUTIONS_BACKLIST.strip().split(','): + linkToAdd = True + elif res and res != 'ori': if sRes in res: linkToAdd = True elif sRes in resMovie: linkToAdd = True + else: linkToAdd = True @@ -2933,6 +2961,9 @@ def adminContenu(): # Menu pour rafraichir le cache oGui.addDir(SITE_IDENTIFIER, 'adminNbElement', "[COLOR %s]Nombre d'éléments affichés[/COLOR]" % sDecoColor, 'listes.png', oOutputParameterHandler) + # Menu pour définir les résolutions à NE PAS utiliser + oGui.addDir(SITE_IDENTIFIER, 'adminBlacklistResolution', "[COLOR %s]Résolutions à ne pas afficher[/COLOR]" % sDecoColor, 'listes.png', oOutputParameterHandler) + oGui.setEndOfDirectory() @@ -2951,6 +2982,14 @@ def adminNbElement(): if nElement: addon().setSetting(SITE_IDENTIFIER + '_nbItemParPage', nElement) +# Définir les résolutions a NE PAS utiliser +def adminBlacklistResolution(): + oGui = cGui() + nResolutions = oGui.showKeyBoard(str(RESOLUTIONS_BACKLIST), "Résolutions a ne pas utiliser séparé par une virgule par exemple (4K,SD)") + if nResolutions: + addon().setSetting(SITE_IDENTIFIER + '_nResolutions', nResolutions) + else: + addon().setSetting(SITE_IDENTIFIER + '_nResolutions', "") # Retourne la décompte de média par type def getNbMedia():