From 8a79508fae7810c24184ab3a9598e1ed897a8cf6 Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Thu, 1 Aug 2019 17:36:57 +0200 Subject: [PATCH] Fix Support Menu e Thumb per i menu --- channelselector.py | 54 ++++++++++++++++++++++++-------------------- core/support.py | 24 ++++++++++---------- specials/autoplay.py | 6 ++--- 3 files changed, 44 insertions(+), 40 deletions(-) diff --git a/channelselector.py b/channelselector.py index 71205b78..e975b253 100644 --- a/channelselector.py +++ b/channelselector.py @@ -333,10 +333,10 @@ def auto_filter(auto_lang=False): return lang -def thumb(itemlist=[]): +def thumb(itemlist=[], genre=False): if itemlist: import re - + icon_dict = {'channels_movie':['film'], 'channels_tvshow':['serie','tv','episodi','episodio'], 'channels_documentary':['documentari','documentario'], @@ -344,9 +344,9 @@ def thumb(itemlist=[]): 'news':['novità', "novita'", 'aggiornamenti'], 'now_playing':['cinema', 'in sala'], 'channels_anime':['anime'], - 'genres':['genere', 'generi', 'categorie', 'categoria'], - 'channels_animation': ['animazione', 'cartoni', 'cartoon'], + 'genres':['genere', 'generi', 'categorie', 'categoria'], 'channels_action':['azione', 'arti marziali'], + 'channels_animation': ['animazione', 'cartoni', 'cartoon'], 'channels_adventure': ['avventura'], 'channels_biographical':['biografico'], 'channels_comedy':['comico','commedia', 'demenziale'], @@ -377,40 +377,44 @@ def thumb(itemlist=[]): suffix_dict = {'_hd':['hd','altadefinizione','alta definizione'], '_4k':['4K'], '_az':['lettera','lista','alfabetico','a-z'], - '_year':['anno'], + '_year':['anno', 'anni'], '_genre':['genere', 'generi', 'categorie', 'categoria']} search = ['cerca'] search_suffix ={'_movie':['film'], '_tvshow':['serie','tv']} + for item in itemlist: - # Check if item has args propriety - if item.args: item.title = item.title + ' || ' + str(item.args) + if genre == False: - for thumb, titles in icon_dict.items(): - if any( word in item.title.lower() for word in search): - thumb = 'search' - for suffix, titles in search_suffix.items(): - if any( word in item.title.lower() for word in titles ): - thumb = thumb + suffix - item.thumbnail = get_thumb(thumb + '.png') - elif any( word in item.title.lower() for word in titles ): - if thumb == 'channels_movie' or thumb == 'channels_tvshow': - for suffix, titles in suffix_dict.items(): - if any( word in item.title.lower() for word in titles ): + for thumb, titles in icon_dict.items(): + if any( word in item.title.lower() for word in search): + thumb = 'search' + for suffix, titles in search_suffix.items(): + if any( word in item.title.lower() for word in titles ): thumb = thumb + suffix - else: item.thumbnail = get_thumb(thumb + '.png') - else: - thumb = item.thumbnails + elif any( word in item.title.lower() for word in titles ): + if thumb == 'channels_movie' or thumb == 'channels_tvshow': + for suffix, titles in suffix_dict.items(): + if any( word in item.title.lower() for word in titles ): + thumb = thumb + suffix + item.thumbnail = get_thumb(thumb + '.png') + else: item.thumbnail = get_thumb(thumb + '.png') + else: + thumb = item.thumbnails - if item.thumbnail != '': - break + else: + for thumb, titles in icon_dict.items(): + if any(word in item.title.lower() for word in titles ): + item.thumbnail = get_thumb(thumb + '.png') + else: + thumb = item.thumbnails - # Remove args from title - if item.args: item.title = item.title.replace(' || ' + str(item.args), '') + + item.title = re.sub(r'\s*\{[^\}]+\}','',item.title) return itemlist else: return get_thumb('next.png') diff --git a/core/support.py b/core/support.py index 7ee30c25..2f88cb02 100644 --- a/core/support.py +++ b/core/support.py @@ -296,17 +296,18 @@ def scrape(func): it = Item( channel=item.channel, action=action, - contentType= 'episode' if item.action == 'episodios' else item.contentType, + contentType= 'episode' if (action == 'findvideos' and item.contentType == 'tvshow') else item.contentType, title=longtitle, - fulltitle=title, - show=item.show if item.action == 'episodios' else title, + fulltitle=item.fulltitle if (action == 'findvideos' and item.contentType != 'movie') else title, + show=item.show if (action == 'findvideos' and item.contentType != 'movie') else title, quality=scraped["quality"], url=scraped["url"], infoLabels=infolabels, thumbnail=scraped["thumb"], - args=item.args + args=item.args, + contentSerieName = title if (action == 'episodios' and item.contentType != 'movie') else '' ) - + for lg in list(set(listGroups).difference(known_keys)): it.__setattr__(lg, match[listGroups.index(lg)]) @@ -315,13 +316,13 @@ def scrape(func): itemlist.append(it) checkHost(item, itemlist) - if ('patronMenu' not in args and item.contentType == "tvshow" and (action == "findvideos" and action != "play")) \ + if (item.contentType == "tvshow" and (action != "findvideos" and action != "play")) \ or (item.contentType == "episode" and action != "play") \ or (item.contentType == "movie" and action != "play") : tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) - else: - for it in itemlist: - it.infoLabels = item.infoLabels + # else: # Si perde item show :( + # for it in itemlist: + # it.infoLabels = item.infoLabels if 'itemlistHook' in args: itemlist = args['itemlistHook'](itemlist) @@ -351,7 +352,7 @@ def scrape(func): videolibrary(itemlist, item) if 'patronMenu' in args: - itemlist = thumb(itemlist) + itemlist = thumb(itemlist, genre=True) if 'fullItemlistHook' in args: itemlist = args['fullItemlistHook'](itemlist) @@ -521,7 +522,6 @@ def menuItem(itemlist, filename, title='', action='', url='', contentType='movie # Apply auto Thumbnails at the menus from channelselector import thumb thumb(itemlist) - return itemlist @@ -578,7 +578,7 @@ def menu(func): if dictUrl[name] is not None and type(dictUrl[name]) is not str: for sub, var in dictUrl[name]: menuItem(itemlist, filename, - title = sub + ' submenu', + title = sub + ' submenu' + typo(title,'_ {}'), url = host + var[0] if len(var) > 0 else '', action = var[1] if len(var) > 1 else 'peliculas', args=var[2] if len(dictUrl[name]) > 2 else '', diff --git a/specials/autoplay.py b/specials/autoplay.py index 5333fb4e..ec991460 100644 --- a/specials/autoplay.py +++ b/specials/autoplay.py @@ -56,8 +56,8 @@ def show_option(channel, itemlist, text_color=colorKOD, thumbnail=None, fanart=N if thumbnail == None: thumbnail = get_thumb('autoplay.png') - if fanart == None: - fanart = get_thumb('autoplay.png') + # if fanart == None: + # fanart = get_thumb('autoplay.png') plot_autoplay = config.get_localized_string(60399) itemlist.append( @@ -67,7 +67,7 @@ def show_option(channel, itemlist, text_color=colorKOD, thumbnail=None, fanart=N text_color=text_color, text_bold=True, thumbnail=thumbnail, - fanart=fanart, + # fanart=fanart, plot=plot_autoplay, from_channel=channel, folder=False