From 27562cad4d93fc90e3d881f1b70240d0b6fa987b Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Tue, 24 Aug 2021 19:27:41 +0200 Subject: [PATCH] alcuni fix --- channels/altadefinizionecommunity.py | 7 +++-- core/support.py | 12 ++++----- platformcode/platformtools.py | 4 +-- specials/downloads.py | 2 +- specials/videolibrary.py | 39 ++++++++++++++++++++++------ 5 files changed, 45 insertions(+), 19 deletions(-) diff --git a/channels/altadefinizionecommunity.py b/channels/altadefinizionecommunity.py index 0ce0b608..86dd5e97 100644 --- a/channels/altadefinizionecommunity.py +++ b/channels/altadefinizionecommunity.py @@ -195,10 +195,12 @@ def episodios(item): spl = it.url.split('/')[-2:] it.infoLabels['season'] = int(spl[0])+1 it.infoLabels['episode'] = int(spl[1])+1 + it.url = it.url.replace('/watch-unsubscribed', '/watch-external') return it return locals() + def check(item): if '/watch-unsubscribed' not in item.url: playWindow = support.match(support.httptools.downloadpage(item.url, cloudscraper=True).data, patron='playWindow" href="([^"]+)') @@ -208,13 +210,14 @@ def check(item): item.contentType = 'tvshow' return episodios(item) else: - item.video_url = video_url.replace('/watch-unsubscribed', '/watch-external') + item.url = video_url.replace('/watch-unsubscribed', '/watch-external') + item.contentType = 'movie' return findvideos(item) def findvideos(item): itemlist = [] - itemlist.append(item.clone(action='play', url=support.match(item.video_url, patron='allowfullscreen[^<]+src="([^"]+)"', cloudscraper=True).match, quality='')) + itemlist.append(item.clone(action='play', url=support.match(item.url, patron='allowfullscreen[^<]+src="([^"]+)"', cloudscraper=True).match, quality='')) return support.server(item, itemlist=itemlist) diff --git a/core/support.py b/core/support.py index 5d3c893e..c307f96b 100755 --- a/core/support.py +++ b/core/support.py @@ -562,12 +562,12 @@ def scrape(func): prevthumb=item.prevthumb if item.prevthumb else item.thumbnail)) - # if inspect.stack()[1][3] not in ['find_episodes', 'add_tvshow']: - # if addVideolibrary and (item.infoLabels["title"] or item.fulltitle): - # # item.fulltitle = item.infoLabels["title"] - # videolibrary(itemlist, item, function=function) - # if downloadEnabled and function == 'episodios' or function == 'findvideos': - # download(itemlist, item, function=function) + if inspect.stack()[1][3] not in ['find_episodes', 'add_tvshow']: + if addVideolibrary and (item.infoLabels["title"] or item.fulltitle): + # item.fulltitle = item.infoLabels["title"] + videolibrary(itemlist, item, function=function) + if downloadEnabled and function == 'episodios' or function == 'findvideos': + download(itemlist, item, function=function) if 'patronGenreMenu' in args and itemlist: itemlist = thumb(itemlist, genre=True) diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index debd152f..b2541c52 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -365,8 +365,8 @@ def render_items(itemlist, parent_item): episode = '' if title[:1] not in ['[', '•']: - if item.contentSerieName: title = item.contentSerieName - elif item.contentTitle: title = item.contentTitle + if item.contentTitle: title = item.contentTitle + elif item.contentSerieName: title = item.contentSerieName if type(item.contentSeason) == int and type(item.contentEpisodeNumber) == int and not item.onlyep: episode = '{}x{:02d}'.format(item.contentSeason, item.contentEpisodeNumber) elif type(item.contentEpisodeNumber) == int: diff --git a/specials/downloads.py b/specials/downloads.py index 4c3e97c5..0ada4d32 100644 --- a/specials/downloads.py +++ b/specials/downloads.py @@ -105,7 +105,7 @@ def mainlist(item): # If there is any pending if 1 in estados or 0 in estados: itemlist.insert(0, Item(channel=item.channel, action="download_all", title=support.typo(config.get_localized_string(70220),'bold'), - contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=thumb('downloads'), + contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=thumb('download'), contentSerieName=item.contentSerieName)) if len(itemlist): diff --git a/specials/videolibrary.py b/specials/videolibrary.py index b4c89488..c6b12393 100644 --- a/specials/videolibrary.py +++ b/specials/videolibrary.py @@ -49,7 +49,25 @@ def search_list(item): def list_az(item): - return [item.clone(title=i, action=item.next_action) for i in ['A','B','C','D','I','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']] + videos = dict(videolibrarydb[item.contentType]).values() + videolibrarydb.close() + cast = [] + for v in videos: + if item.next_action == 'list_actors': + v = v['item'].infoLabels['castandrole'] + else: + v = v['item'].infoLabels + if 'director' in v: + v = v.get('director').split(',') + else: + v= v.get('writer').split(',') + cast += [c[0].strip() for c in v] + + az = [] #[c[0] for c in cast if c[0] not in az] + for c in cast: + if c[0] not in az: + az.append(c[0]) + return [item.clone(title=i, action=item.next_action) for i in az]#['A','B','C','D','I','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']] def list_genres(item): @@ -88,14 +106,18 @@ def list_directors(item): directors = [] director_images = [] for v in videos: - directors += v['item'].infoLabels['director'].split(',') - director_images += v['item'].infoLabels['director_image'] - + v = v['item'].infoLabels + if 'director' in v: + directors += v['director'].split(',') + director_images += v['director_image'] + else: + directors += v['writer'].split(',') + director_images += v['writer_image'] itemlist = [] for i, d in enumerate(directors): d = d.strip() if d and d[0][0] == item.title and d not in [it.director for it in itemlist]: - it = item.clone(title = d, action='list_{}s'.format(item.contentType), director=d, thumbnail=director_images[i]) + it = item.clone(title = d, action='list_{}s'.format(item.contentType), director=d, thumbnail=director_images[i] if len(director_images) > i else '') itemlist.append(it) itemlist.sort(key=lambda it: it.director) @@ -284,9 +306,10 @@ def get_episodes(item): it = ep['item'] if it.contentSeason == item.contentSeason or item.all: - it.title = '{}. {}'.format(it.contentEpisodeNumber, it.title) if config.get_setting('no_pile_on_seasons', 'videolibrary') == 2 or item.all: - it.title = '{}x{}'.format(it.contentSeason, it.title) + it.onlyep = False + else: + it.onlyep = True it = get_host(it) it.window = True if item.window_type == 0 or (config.get_setting("window_type") == 0) else False if it.window: @@ -955,7 +978,7 @@ def add_download_items(item, itemlist): from_action='findvideos', contentTitle=config.get_localized_string(60355), path=item.path, - thumbnail=thumb('downloads'), + thumbnail=thumb('download'), parent=item.tourl()) if item.action == 'findvideos': if item.contentType != 'movie':