From 60b6ccbca35d4c3235dcefe03ae90de1294398de Mon Sep 17 00:00:00 2001 From: greko17 Date: Tue, 24 Sep 2019 14:30:10 +0200 Subject: [PATCH] fix: speclials/news - standardizzati i risultati ai ko(d)lori --- specials/news.py | 54 ++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/specials/news.py b/specials/news.py index f088294b..bf42578d 100644 --- a/specials/news.py +++ b/specials/news.py @@ -12,7 +12,7 @@ from threading import Thread from channelselector import get_thumb, auto_filter from core import channeltools from core import jsontools -from core import scrapertools +from core import scrapertools, support from core.item import Item from platformcode import config, logger from platformcode import platformtools @@ -28,7 +28,7 @@ perfil = [['0xFF0B7B92', '0xFF89FDFB', '0xFFACD5D4'], ['0xFFA5DEE5', '0xFFE0F9B5', '0xFFFEFDCA'], ['0xFFF23557', '0xFF22B2DA', '0xFFF0D43A']] -color1, color2, color3 = ["white", "white", "white"] +color1, color2, color3 = ["red", "0xFF65B3DA", "yellow"] # color1, color2, color3 = perfil[__perfil__] list_newest = [] @@ -128,7 +128,7 @@ def get_channels_list(): ## list_canales = {'peliculas': [], '4k': [], 'terror': [], 'infantiles': [], 'series': [], 'anime': [], ## 'castellano': [], 'latino':[], 'italiano':[], 'torrent':[], 'documentales': []} list_canales = {'peliculas': [], 'series': [],'anime': [], 'italiano':[], 'documentales': []} - + any_active = False # Rellenar listas de canales disponibles channels_path = os.path.join(config.get_runtime_path(), "channels", '*.json') @@ -392,16 +392,17 @@ def get_newest(channel_id, categoria): def get_title(item): + support.log("ITEM NEWEST ->", item) if item.contentSerieName: # Si es una serie title = item.contentSerieName + #title = re.compile("\[.*?\]", re.DOTALL).sub("", item.contentSerieName) if not scrapertools.get_season_and_episode(title) and item.contentEpisodeNumber: if not item.contentSeason: item.contentSeason = '1' title = "%s - %sx%s" % (title, item.contentSeason, str(item.contentEpisodeNumber).zfill(2)) - #4l3x87 - fix to add Sub-ITA in newest - if item.contentLanguage: - title+=" "+item.contentLanguage - +## #4l3x87 - fix to add Sub-ITA in newest +## if item.contentLanguage: +## title+=" "+item.contentLanguage elif item.contentTitle: # Si es una pelicula con el canal adaptado title = item.contentTitle @@ -415,16 +416,25 @@ def get_title(item): title = re.compile("\[/*B\]", re.DOTALL).sub("", title) title = re.compile("\[/*I\]", re.DOTALL).sub("", title) + title = '[B]'+title+'[/B]' + if (type(item.contentLanguage) != list and 'ITA' not in item.contentLanguage) or item.contentLanguage != 'ITA': + title += support.typo(item.contentLanguage, '_ [] color kod') + if item.quality: + title += support.typo(item.quality, '_ [] color kod') return title def no_group(list_result_canal): itemlist = [] global channels_id_name + support.log("NO GROUP -> ", list_result_canal) for i in list_result_canal: - i.title = get_title(i) + " [" + channels_id_name[i.channel] + "]" - i.text_color = color3 + support.log("NO GROUP i -> ", i) + canale = channels_id_name[i.channel] + canale = '[COLOR yellow]'+canale+'[/COLOR]' + i.title = get_title(i) + " [" + canale + "]" +# i.text_color = color3 itemlist.append(i.clone()) @@ -449,12 +459,12 @@ def group_by_channel(list_result_canal): itemlist.append(Item(channel="news", title=channels_id_name[c] + ':', text_color=color1, text_bold=True)) for i in dict_canales[c]: - if i.contentQuality: - i.title += ' (%s)' % i.contentQuality - if i.language: - i.title += ' [%s]' % i.language - i.title = ' %s' % i.title - i.text_color = color3 +## if i.contentQuality: +## i.title += ' (%s)' % i.contentQuality +## if i.contentLanguage: +## i.title += ' [%s]' % i.contentLanguage +## i.title = ' %s' % i.title +#### i.text_color = color3 itemlist.append(i.clone()) return itemlist @@ -505,7 +515,7 @@ def group_by_content(list_result_canal): else: new_item = v[0].clone(title=title) - new_item.text_color = color3 +## new_item.text_color = color3 list_result.append(new_item) return sorted(list_result, key=lambda it: it.title.lower()) @@ -521,11 +531,11 @@ def show_channels(item): new_item = Item() new_item = new_item.fromurl(i) # logger.debug(new_item.tostring()) - if new_item.contentQuality: - new_item.title += ' (%s)' % new_item.contentQuality - if new_item.language: - new_item.title += ' [%s]' % new_item.language - new_item.title += ' (%s)' % channels_id_name[new_item.channel] +## if new_item.contentQuality: +## new_item.title += ' (%s)' % new_item.contentQuality +## if new_item.language: +## new_item.title += ' [%s]' % new_item.language +## new_item.title += ' (%s)' % channels_id_name[new_item.channel] new_item.text_color = color1 itemlist.append(new_item.clone()) @@ -583,7 +593,7 @@ def setting_channel(item): channel_language = config.get_setting("channel_language", default="auto") if channel_language == 'auto': channel_language = auto_filter() - + list_controls = [] for infile in sorted(glob.glob(channels_path)):