diff --git a/plugin.video.vstream/resources/sites/pastebin.py b/plugin.video.vstream/resources/sites/pastebin.py index 0cb7055904..c41d269485 100644 --- a/plugin.video.vstream/resources/sites/pastebin.py +++ b/plugin.video.vstream/resources/sites/pastebin.py @@ -34,7 +34,7 @@ UNCLASSIFIED = 'Indéterminé' MOVIE_MOVIE = (URL_MAIN + '&sMedia=film', 'showMenuFilms') -# MOVIE_NEWS = (URL_MAIN + '&sMedia=film&sYear=2022', 'showMovies') +#MOVIE_NEWS = (URL_MAIN + '&sMedia=film&sYear=2022', 'showMovies') MOVIE_NEWS = ('movie/now_playing', 'showTMDB') # MOVIE_GENRES = (URL_MAIN + '&sMedia=film', 'showGenres') MOVIE_GENRES = ('genre/movie/list', 'showGenreMovieTMDB') @@ -94,10 +94,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 +1275,7 @@ def showSearch(): sUrl = oInputParameterHandler.getValue('siteUrl') sSearchText = oGui.showKeyBoard() - if sSearchText: + if sSearchText != False: sUrl += Quote(sSearchText) showMovies(sUrl) @@ -1871,11 +1878,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 +1897,6 @@ def showResolution(): oGui.setEndOfDirectory() - def alphaList(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() @@ -2174,12 +2187,24 @@ 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: + # Set bValid = True if sRest = BLACKLIST APPLIED because it is like we got each sRes in res + if sRes == "BLACKLIST APPLIED": + bValid = True + break if sRes in res: bValid = True break @@ -2218,7 +2243,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': @@ -2546,7 +2570,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 @@ -2570,11 +2595,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 @@ -2927,6 +2957,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() @@ -2945,6 +2978,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():