fix: speclials/news - standardizzati i risultati ai ko(d)lori

This commit is contained in:
greko17
2019-09-24 14:30:10 +02:00
parent 6702aac0c2
commit 60b6ccbca3
+32 -22
View File
@@ -12,7 +12,7 @@ from threading import Thread
from channelselector import get_thumb, auto_filter from channelselector import get_thumb, auto_filter
from core import channeltools from core import channeltools
from core import jsontools from core import jsontools
from core import scrapertools from core import scrapertools, support
from core.item import Item from core.item import Item
from platformcode import config, logger from platformcode import config, logger
from platformcode import platformtools from platformcode import platformtools
@@ -28,7 +28,7 @@ perfil = [['0xFF0B7B92', '0xFF89FDFB', '0xFFACD5D4'],
['0xFFA5DEE5', '0xFFE0F9B5', '0xFFFEFDCA'], ['0xFFA5DEE5', '0xFFE0F9B5', '0xFFFEFDCA'],
['0xFFF23557', '0xFF22B2DA', '0xFFF0D43A']] ['0xFFF23557', '0xFF22B2DA', '0xFFF0D43A']]
color1, color2, color3 = ["white", "white", "white"] color1, color2, color3 = ["red", "0xFF65B3DA", "yellow"]
# color1, color2, color3 = perfil[__perfil__] # color1, color2, color3 = perfil[__perfil__]
list_newest = [] list_newest = []
@@ -128,7 +128,7 @@ def get_channels_list():
## list_canales = {'peliculas': [], '4k': [], 'terror': [], 'infantiles': [], 'series': [], 'anime': [], ## list_canales = {'peliculas': [], '4k': [], 'terror': [], 'infantiles': [], 'series': [], 'anime': [],
## 'castellano': [], 'latino':[], 'italiano':[], 'torrent':[], 'documentales': []} ## 'castellano': [], 'latino':[], 'italiano':[], 'torrent':[], 'documentales': []}
list_canales = {'peliculas': [], 'series': [],'anime': [], 'italiano':[], 'documentales': []} list_canales = {'peliculas': [], 'series': [],'anime': [], 'italiano':[], 'documentales': []}
any_active = False any_active = False
# Rellenar listas de canales disponibles # Rellenar listas de canales disponibles
channels_path = os.path.join(config.get_runtime_path(), "channels", '*.json') 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): def get_title(item):
support.log("ITEM NEWEST ->", item)
if item.contentSerieName: # Si es una serie if item.contentSerieName: # Si es una serie
title = item.contentSerieName title = item.contentSerieName
#title = re.compile("\[.*?\]", re.DOTALL).sub("", item.contentSerieName)
if not scrapertools.get_season_and_episode(title) and item.contentEpisodeNumber: if not scrapertools.get_season_and_episode(title) and item.contentEpisodeNumber:
if not item.contentSeason: if not item.contentSeason:
item.contentSeason = '1' item.contentSeason = '1'
title = "%s - %sx%s" % (title, item.contentSeason, str(item.contentEpisodeNumber).zfill(2)) title = "%s - %sx%s" % (title, item.contentSeason, str(item.contentEpisodeNumber).zfill(2))
#4l3x87 - fix to add Sub-ITA in newest ## #4l3x87 - fix to add Sub-ITA in newest
if item.contentLanguage: ## if item.contentLanguage:
title+=" "+item.contentLanguage ## title+=" "+item.contentLanguage
elif item.contentTitle: # Si es una pelicula con el canal adaptado elif item.contentTitle: # Si es una pelicula con el canal adaptado
title = item.contentTitle title = item.contentTitle
@@ -415,16 +416,25 @@ def get_title(item):
title = re.compile("\[/*B\]", re.DOTALL).sub("", title) title = re.compile("\[/*B\]", re.DOTALL).sub("", title)
title = re.compile("\[/*I\]", 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 return title
def no_group(list_result_canal): def no_group(list_result_canal):
itemlist = [] itemlist = []
global channels_id_name global channels_id_name
support.log("NO GROUP -> ", list_result_canal)
for i in list_result_canal: for i in list_result_canal:
i.title = get_title(i) + " [" + channels_id_name[i.channel] + "]" support.log("NO GROUP i -> ", i)
i.text_color = color3 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()) 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)) itemlist.append(Item(channel="news", title=channels_id_name[c] + ':', text_color=color1, text_bold=True))
for i in dict_canales[c]: for i in dict_canales[c]:
if i.contentQuality: ## if i.contentQuality:
i.title += ' (%s)' % i.contentQuality ## i.title += ' (%s)' % i.contentQuality
if i.language: ## if i.contentLanguage:
i.title += ' [%s]' % i.language ## i.title += ' [%s]' % i.contentLanguage
i.title = ' %s' % i.title ## i.title = ' %s' % i.title
i.text_color = color3 #### i.text_color = color3
itemlist.append(i.clone()) itemlist.append(i.clone())
return itemlist return itemlist
@@ -505,7 +515,7 @@ def group_by_content(list_result_canal):
else: else:
new_item = v[0].clone(title=title) new_item = v[0].clone(title=title)
new_item.text_color = color3 ## new_item.text_color = color3
list_result.append(new_item) list_result.append(new_item)
return sorted(list_result, key=lambda it: it.title.lower()) return sorted(list_result, key=lambda it: it.title.lower())
@@ -521,11 +531,11 @@ def show_channels(item):
new_item = Item() new_item = Item()
new_item = new_item.fromurl(i) new_item = new_item.fromurl(i)
# logger.debug(new_item.tostring()) # logger.debug(new_item.tostring())
if new_item.contentQuality: ## if new_item.contentQuality:
new_item.title += ' (%s)' % new_item.contentQuality ## new_item.title += ' (%s)' % new_item.contentQuality
if new_item.language: ## if new_item.language:
new_item.title += ' [%s]' % new_item.language ## new_item.title += ' [%s]' % new_item.language
new_item.title += ' (%s)' % channels_id_name[new_item.channel] ## new_item.title += ' (%s)' % channels_id_name[new_item.channel]
new_item.text_color = color1 new_item.text_color = color1
itemlist.append(new_item.clone()) itemlist.append(new_item.clone())
@@ -583,7 +593,7 @@ def setting_channel(item):
channel_language = config.get_setting("channel_language", default="auto") channel_language = config.get_setting("channel_language", default="auto")
if channel_language == 'auto': if channel_language == 'auto':
channel_language = auto_filter() channel_language = auto_filter()
list_controls = [] list_controls = []
for infile in sorted(glob.glob(channels_path)): for infile in sorted(glob.glob(channels_path)):