From 50d80b73dc8bdd34ace2e4dd566618689f47ed6a Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Sat, 26 Feb 2022 17:01:51 +0100 Subject: [PATCH] - Aggiunto Canale Altadefinizione - Fix Aggiungi alla Videoteca da Ricerca Globale - Miglior gestione riapertura finestra server - Fix Gestione server Bloccati --- channels/0example.py.txt | 4 ++-- channels/altadefinizione.json | 2 +- channels/altadefinizione.py | 3 ++- channels/casacinema.py | 4 ++-- channels/cinemalibero.py | 2 +- channels/filmpertutti.py | 6 +++--- core/support.py | 14 +++----------- platformcode/platformtools.py | 32 +++++++++++++++++-------------- platformcode/xbmc_videolibrary.py | 7 +++++-- servers/doodstream.py | 2 +- specials/globalsearch.py | 2 +- specials/setting.py | 8 +++++--- specials/videolibrary.py | 7 +++---- 13 files changed, 47 insertions(+), 46 deletions(-) diff --git a/channels/0example.py.txt b/channels/0example.py.txt index 5c520f7d..15a15703 100644 --- a/channels/0example.py.txt +++ b/channels/0example.py.txt @@ -9,7 +9,7 @@ # fix: # 1. aggiunto pagination e sistemate alcune voci # 2. modificato problemi in eccezioni -# 3. aggiunta la def select +# 3. aggiunta la def check # 4. modifica alla legenda e altre aggiunte # Questo vuole solo essere uno scheletro per velocizzare la scrittura di un canale. @@ -197,7 +197,7 @@ def genres(item): # per quei casi dove il sito non differenzia film e/o serie e/o anime # e la ricerca porta i titoli mischiati senza poterli distinguere tra loro # andranno modificate anche le def peliculas e episodios ove occorre -def select(item): +def check(item): support.info('select --->', item) #support.dbg() data = httptools.downloadpage(item.url, headers=headers).data diff --git a/channels/altadefinizione.json b/channels/altadefinizione.json index 7859ff31..8579ab00 100644 --- a/channels/altadefinizione.json +++ b/channels/altadefinizione.json @@ -2,7 +2,7 @@ "id": "altadefinizione", "name": "Altadefinizione", "language": ["ita", "sub-ita"], - "active": false, + "active": true, "thumbnail": "altadefinizione.png", "banner": "altadefinizione.png", "categories": ["movie", "tvshow", "vos"], diff --git a/channels/altadefinizione.py b/channels/altadefinizione.py index 133d9db9..08fef146 100644 --- a/channels/altadefinizione.py +++ b/channels/altadefinizione.py @@ -20,7 +20,8 @@ headers = [['Referer', host]] @support.menu def mainlist(item): - film = [('Al Cinema', ['/al-cinema/', 'peliculas']), + film = ['/genere/film/', + ('Al Cinema', ['/al-cinema/', 'peliculas']), ('Generi', ['', 'genres']), ('Sub-ITA', ['/sub-ita/', 'peliculas'])] diff --git a/channels/casacinema.py b/channels/casacinema.py index eb1b8b1b..36858fbf 100644 --- a/channels/casacinema.py +++ b/channels/casacinema.py @@ -35,7 +35,7 @@ def genres(item): return locals() -def select(item): +def check(item): item.data = support.match(item).data if 'continua con il video' in item.data.lower(): support.info('select = ### è un film ###') @@ -101,7 +101,7 @@ def peliculas(item): action = 'episodios' pagination = '' else: - action = 'select' + action = 'check' if item.args == 'newest': patron = r'
  • [^"]+)">
    \s*?]+>(?P[^\(\[<]+)(?:\[(?P<quality1>HD)\])?[ ]?(?:\(|\[)?(?P<lang>[sS]ub-[iI][tT][aA])?(?:\)|\])?[ ]?(?:\[(?P<quality>.+?)\])?[ ]?(?:\((?P<year>\d+)\))?<(?:[^>]+>.+?(?:title="Nuovi episodi">(?P<episode>\d+x\d+)[ ]?(?P<lang2>Sub-Ita)?|title="IMDb">(?P<rating>[^<]+)))?' diff --git a/channels/cinemalibero.py b/channels/cinemalibero.py index b0af89c1..5e3ee316 100644 --- a/channels/cinemalibero.py +++ b/channels/cinemalibero.py @@ -128,7 +128,7 @@ def episodios(item): if ep not in episodes: episodes[ep] = [] episodes[ep].append(s) - servers = support.server(item, it.stagione, AutoPlay=False, CheckLinks=False, Download=False, Videolibrary=False) + servers = support.server(item, it.stagione, CheckLinks=False, Download=False, Videolibrary=False) episodes = {} # ottengo l'episodio dal nome del file diff --git a/channels/filmpertutti.py b/channels/filmpertutti.py index cecd2a26..c51301c4 100644 --- a/channels/filmpertutti.py +++ b/channels/filmpertutti.py @@ -48,13 +48,13 @@ def peliculas(item): patron = r'<li>\s?<a href="(?P<url>[^"]+)" data-thumbnail="(?P<thumb>[^"]+)">.*?<div class="title[^"]*">(?P<title>.+?)(?:\s\[(?P<quality>HD)\])?<\/div>\s*<div class="episode[^"]*"[^>]+>(?P<episode>[^<(]+)(?:\((?P<lang>[a-zA-Z\-]+)\))?' if item.args == 'search': - action = 'select' + action = 'check' elif item.contentType == 'tvshow': action = 'episodios' elif item.contentType == 'movie': action ='findvideos' else: - action = 'select' + action = 'check' def itemHook(item): item.title = item.title.replace(' - La Serie', '') @@ -97,7 +97,7 @@ def genres(item): return locals() -def select(item): +def check(item): support.info() patron=r'class="taxonomy category"\s*><span property="name">([^>]+)</span></a><meta property="position" content="2">' block = support.match(item.url, patron=patron,headers=headers).match diff --git a/core/support.py b/core/support.py index 0bab5a65..5ed8ae41 100755 --- a/core/support.py +++ b/core/support.py @@ -17,7 +17,7 @@ else: from urllib import urlencode from time import time -from core import filetools, httptools, scrapertools, servertools, tmdb, channeltools, autoplay, scraper +from core import filetools, httptools, scrapertools, servertools, tmdb, channeltools from core.item import Item from lib import unshortenit from platformcode import config @@ -1240,7 +1240,7 @@ def pagination(itemlist, item, page, perpage, function_level=1): return itemlist -def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=True, Download=True, patronTag=None, Videolibrary=True): +def server(item, data='', itemlist=[], headers='', CheckLinks=True, Download=True, patronTag=None, Videolibrary=True): logger.debug() if not data and not itemlist: @@ -1318,18 +1318,10 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru addQualityTag(item, verifiedItemlist, data, patronTag) # Check Links - if not item.global_search and config.get_setting('checklinks') and CheckLinks and not config.get_setting('autoplay'): + if not item.global_search and config.get_setting('checklinks') and CheckLinks: # and not config.get_setting('autoplay'): checklinks_number = config.get_setting('checklinks_number') verifiedItemlist = servertools.check_list_links(verifiedItemlist, checklinks_number) - try: - if AutoPlay and item.contentChannel not in ['downloads', 'videolibrary']: - autoplay.start(verifiedItemlist, item) - except: - import traceback - logger.error(traceback.format_exc()) - pass - verifiedItemlist = servertools.sort_servers(verifiedItemlist) if Videolibrary and item.contentChannel != 'videolibrary': diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index b3b7fadf..8e823916 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -1869,10 +1869,10 @@ def serverWindow(item, itemlist): self.setFocusId(100) # from core.support import dbg;dbg() - def onFocus(self, control): - if is_playing() and db['controls'].get('reopen', False): - self.close() - serverWindow(self.item, self.itemlist) + # def onFocus(self, control): + # if is_playing() and db['controls'].get('reopen', False): + # self.close() + # serverWindow(self.item, self.itemlist) def onAction(self, action): action = action.getId() @@ -1965,10 +1965,10 @@ def serverWindow(item, itemlist): self.SERVERS.addItems(items) self.setFocus(self.SERVERS) - def onFocus(self, control): - if is_playing() and db['controls'].get('reopen', False): - self.close() - serverWindow(self.item, self.itemlist) + # def onFocus(self, control): + # if is_playing() and db['controls'].get('reopen', False): + # self.close() + # serverWindow(self.item, self.itemlist) def onAction(self, action): action = action.getId() @@ -2010,8 +2010,13 @@ def serverWindow(item, itemlist): if itemlist: - def monitor(itemlist): - reopen = False + reopen = False + if config.get_setting('autoplay'): + reopen = True + from core import autoplay + autoplay.start(itemlist, item) + + def monitor(itemlist, reopen): while not xbmc.Monitor().abortRequested(): if not is_playing(): if reopen: @@ -2036,7 +2041,6 @@ def serverWindow(item, itemlist): reopen = False if not selection.server or selection.server == 'torrent': break - db.close() - logger.debug('Server Window EXIT') - import threading - threading.Thread(target=monitor, args=[itemlist]).start() + # import threading + monitor(itemlist, reopen) + # threading.Thread(target=monitor, args=[itemlist, reopen]).start() diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py index ca43bfad..a13cf63b 100644 --- a/platformcode/xbmc_videolibrary.py +++ b/platformcode/xbmc_videolibrary.py @@ -85,7 +85,10 @@ def mark_auto_as_watched(item): if marked: logger.debug('CLOSE') item.played_time = 0 - db['controls']['reopen'] = False + if total_time > 20: + db['controls']['reopen'] = False + else: + db['controls']['reopen'] = True else: logger.debug('REOPEN') item.played_time = actual_time @@ -110,7 +113,7 @@ def mark_auto_as_watched(item): def sync_trakt_addon(path_folder): """ - Updates the values ​​of episodes seen if + Updates the values of episodes seen if """ logger.debug() # if the addon exists we do the search diff --git a/servers/doodstream.py b/servers/doodstream.py index 9b7d2967..544ef2e0 100644 --- a/servers/doodstream.py +++ b/servers/doodstream.py @@ -12,7 +12,7 @@ def test_video_exists(page_url): response = scraper.get(page_url) - if response.status_code == 404 or 'File you are looking for is not found' in response.text: + if response.status_code == 404 or 'Not Found' in response.text: return False, config.get_localized_string(70449) % 'DooD Stream' else: data = response.text diff --git a/specials/globalsearch.py b/specials/globalsearch.py index e33a62bb..bef82a3b 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -763,7 +763,7 @@ class SearchWindow(xbmcgui.WindowXML): context = [c[0] for c in commands] context_commands = [c[1].replace('Container.Refresh', 'RunPlugin').replace('Container.Update', 'RunPlugin') for c in commands] index = xbmcgui.Dialog().contextmenu(context) - if index > 0: xbmc.executebuiltin(context_commands[index]) + if index > -1: xbmc.executebuiltin(context_commands[index]) def play(self, server=None): diff --git a/specials/setting.py b/specials/setting.py index 26a049f0..022c415f 100644 --- a/specials/setting.py +++ b/specials/setting.py @@ -260,12 +260,14 @@ def servers_blacklist(item): list_servers.append(server) ris = platformtools.dialog_multiselect(config.get_localized_string(60550), list_controls, preselect=blacklisted) if ris is not None: - cb_servers_blacklist({list_servers[n]: True if n in ris else False for n, it in enumerate(list_controls)}) + config.set_setting("black_list", [l for n, l in enumerate(list_servers) if n in ris], server='servers') + # if ris is not None: + # cb_servers_blacklist({list_servers[n]: True if n in ris else False for n, it in enumerate(list_controls)}) # return platformtools.show_channel_settings(list_controls=list_controls, dict_values=dict_values, caption=config.get_localized_string(60550), callback="cb_servers_blacklist") -def cb_servers_blacklist(dict_values): - blaklisted = [k for k in dict_values.keys()] +# def cb_servers_blacklist(dict_values): +# blaklisted = [k for k in dict_values.keys()] # progreso = platformtools.dialog_progress(config.get_localized_string(60557), config.get_localized_string(60558)) # n = len(dict_values) # i = 1 diff --git a/specials/videolibrary.py b/specials/videolibrary.py index b53f4ed5..4c37f04f 100644 --- a/specials/videolibrary.py +++ b/specials/videolibrary.py @@ -343,7 +343,6 @@ def get_episodes(item): def findvideos(item): - from core import autoplay from platformcode import platformtools logger.debug() @@ -553,9 +552,9 @@ def findvideos(item): # logger.debug("server:\n%s" % server.tostring('\n')) itemlist.append(server) - - if autoplay.play_multi_channel(item, itemlist): # hideserver - return [] + # from core.support import dbg;dbg() + # if autoplay.play_multi_channel(item, itemlist): # hideserver + # return [] add_download_items(item, itemlist) return itemlist