From 9ee5a50e4fdd8eed0df48c42d8cddf12c9997662 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Wed, 18 Nov 2020 11:15:21 +0100 Subject: [PATCH] Fix VVVVID --- channels/vvvvid.py | 63 +++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/channels/vvvvid.py b/channels/vvvvid.py index d5e090df..66a82a33 100644 --- a/channels/vvvvid.py +++ b/channels/vvvvid.py @@ -134,35 +134,40 @@ def peliculas(item): def episodios(item): itemlist = [] json_file = current_session.get(item.url, headers=headers, params=payload).json() - show_id = str(json_file['data'][0]['show_id']) - season_id = str(json_file['data'][0]['season_id']) - episodes = [] - support.info('SEASON ID= ',season_id) - for episode in json_file['data']: - episodes.append(episode['episodes']) - for episode in episodes: - for key in episode: - if 'stagione' in encode(key['title']).lower(): - season = support.match(encode(key['title']), patron=r'[Ss]tagione\s*(\d+)').match - episode = support.match(encode(key['title']), patron=r'[Ee]pisodio\s*(\d+)').match - if season and episode: - title = season + 'x' + episode + ' - ' + item.fulltitle - make_item = True - elif int(key['season_id']) == int(season_id): - try: - title = 'Episodio ' + key['number'] + ' - ' + key['title'].encode('utf8') - except: - title = 'Episodio ' + key['number'] + ' - ' + key['title'] - make_item = True - else: - make_item = False - if make_item == True: - if type(title) == tuple: title = title[0] - itemlist.append( - item.clone(title = title, - url= host + show_id + '/season/' + str(key['season_id']) + '/', - action= 'findvideos', - video_id= key['video_id'])) + for i, block in enumerate(json_file['data']): + if len(json_file['data']) > 1: + prepend = str(i + 1) + 'x' + else: + prepend = 'Episodio ' + show_id = str(block['show_id']) + season_id = str(block['season_id']) + episodes = [] + support.info('SEASON ID= ',season_id) + for episode in json_file['data']: + episodes.append(episode['episodes']) + for episode in episodes: + for key in episode: + if 'stagione' in encode(key['title']).lower(): + season = support.match(encode(key['title']), patron=r'[Ss]tagione\s*(\d+)').match + episode = support.match(encode(key['title']), patron=r'[Ee]pisodio\s*(\d+)').match + if season and episode: + title = season + 'x' + episode + ' - ' + item.fulltitle + make_item = True + elif int(key['season_id']) == int(season_id): + try: + title = prepend + key['number'] + ' - ' + key['title'].encode('utf8') + except: + title = prepend + key['number'] + ' - ' + key['title'] + make_item = True + else: + make_item = False + if make_item == True: + if type(title) == tuple: title = title[0] + itemlist.append( + item.clone(title = title, + url= host + show_id + '/season/' + str(key['season_id']) + '/', + action= 'findvideos', + video_id= key['video_id'])) autorenumber.start(itemlist, item) if autorenumber.check(item) == True \ or support.match(itemlist[0].title, patron=r"(\d+x\d+)").match: