diff --git a/channelselector.py b/channelselector.py index 68df0020..8be8675b 100644 --- a/channelselector.py +++ b/channelselector.py @@ -4,6 +4,7 @@ import glob, os from core.item import Item from platformcode import config, logger +from core.support import thumb addon = config.__settings__ downloadenabled = addon.getSetting('downloadenabled') @@ -15,45 +16,45 @@ def getmainlist(view="thumb_"): # Main Menu Channels if addon.getSetting('enable_news_menu') == "true": itemlist.append(Item(title=config.get_localized_string(30130), channel="news", action="mainlist", - thumbnail=get_thumb("news.png"), category=config.get_localized_string(30119), viewmode="thumbnails", + thumbnail=thumb("news"), category=config.get_localized_string(30119), viewmode="thumbnails", context=[{"title": config.get_localized_string(70285), "channel": "shortcuts", "action": "SettingOnPosition", "category":7, "setting":1}])) if addon.getSetting('enable_channels_menu') == "true": itemlist.append(Item(title=config.get_localized_string(30118), channel="channelselector", action="getchanneltypes", - thumbnail=get_thumb("channels.png"), view=view, category=config.get_localized_string(30119), viewmode="thumbnails")) + thumbnail=thumb("channels"), view=view, category=config.get_localized_string(30119), viewmode="thumbnails")) if addon.getSetting('enable_search_menu') == "true": itemlist.append(Item(title=config.get_localized_string(30103), channel="search", path='special', action="mainlist", - thumbnail=get_thumb("search.png"), category=config.get_localized_string(30119), viewmode="list", + thumbnail=thumb("search"), category=config.get_localized_string(30119), viewmode="list", context = [{"title": config.get_localized_string(60412), "action": "setting_channel_new", "channel": "search"}, {"title": config.get_localized_string(70286), "channel": "shortcuts", "action": "SettingOnPosition", "category":5 , "setting":1}])) if addon.getSetting('enable_onair_menu') == "true": itemlist.append(Item(channel="filmontv", action="mainlist", title=config.get_localized_string(50001), - thumbnail=get_thumb("live.png"), viewmode="thumbnails")) + thumbnail=thumb("live"), viewmode="thumbnails")) if addon.getSetting('enable_link_menu') == "true": - itemlist.append(Item(title=config.get_localized_string(70527), channel="kodfavorites", action="mainlist", thumbnail=get_thumb("mylink.png"), + itemlist.append(Item(title=config.get_localized_string(70527), channel="kodfavorites", action="mainlist", thumbnail=thumb("mylink"), view=view, category=config.get_localized_string(70527), viewmode="thumbnails")) if addon.getSetting('enable_fav_menu') == "true": itemlist.append(Item(title=config.get_localized_string(30102), channel="favorites", action="mainlist", - thumbnail=get_thumb("favorites.png"), category=config.get_localized_string(30102), viewmode="thumbnails")) + thumbnail=thumb("favorites"), category=config.get_localized_string(30102), viewmode="thumbnails")) if config.get_videolibrary_support() and addon.getSetting('enable_library_menu') == "true": itemlist.append(Item(title=config.get_localized_string(30131), channel="videolibrary", action="mainlist", - thumbnail=get_thumb("videolibrary.png"), category=config.get_localized_string(30119), viewmode="thumbnails", + thumbnail=thumb("videolibrary"), category=config.get_localized_string(30119), viewmode="thumbnails", context=[{"title": config.get_localized_string(70287), "channel": "shortcuts", "action": "SettingOnPosition", "category":2, "setting":1}, {"title": config.get_localized_string(60568), "channel": "videolibrary", "action": "update_videolibrary"}])) if downloadenabled != "false": - itemlist.append(Item(title=config.get_localized_string(30101), channel="downloads", action="mainlist", thumbnail=get_thumb("download.png"), viewmode="list", + itemlist.append(Item(title=config.get_localized_string(30101), channel="downloads", action="mainlist", thumbnail=thumb("download"), viewmode="list", context=[{"title": config.get_localized_string(70288), "channel": "shortcuts", "action": "SettingOnPosition", "category":6}])) itemlist.append(Item(title=config.get_localized_string(30100), channel="setting", action="settings", - thumbnail=get_thumb('setting.png'), category=config.get_localized_string(30100), viewmode="list", folder=False)) + thumbnail=thumb('setting'), category=config.get_localized_string(30100), viewmode="list", folder=False)) itemlist.append(Item(title=config.get_localized_string(30104) + " (v" + config.get_addon_version(with_fix=True) + ")", channel="help", action="mainlist", - thumbnail=get_thumb("help.png"), category=config.get_localized_string(30104), viewmode="list")) + thumbnail=thumb("help"), category=config.get_localized_string(30104), viewmode="list")) return itemlist @@ -71,17 +72,17 @@ def getchanneltypes(view="thumb_"): itemlist = list() title = config.get_localized_string(30121) itemlist.append(Item(title=title, channel="channelselector", action="filterchannels", view=view, - category=title, channel_type="all", thumbnail=get_thumb("all.png"), + category=title, channel_type="all", thumbnail=thumb("all"), viewmode="thumbnails")) for channel_type in channel_types: title = config.get_localized_category(channel_type) itemlist.append(Item(title=title, channel="channelselector", action="filterchannels", category=title, channel_type=channel_type, viewmode="thumbnails", - thumbnail=get_thumb("{}.png".format(channel_type)))) + thumbnail=thumb(channel_type))) itemlist.append(Item(title=config.get_localized_string(70685), channel="community", action="mainlist", view=view, - category=config.get_localized_string(70685), channel_type="all", thumbnail=get_thumb("community.png"), + category=config.get_localized_string(70685), channel_type="all", thumbnail=thumb("community"), viewmode="thumbnails")) return itemlist @@ -209,16 +210,16 @@ def filterchannels(category, view="thumb_"): return channelslist -def get_thumb(thumb_name, view="thumb_"): - from core import filetools - if thumb_name.startswith('http'): - return thumb_name - elif config.get_setting('enable_custom_theme') and config.get_setting('custom_theme') and filetools.isfile(config.get_setting('custom_theme') + view + thumb_name): - media_path = config.get_setting('custom_theme') - else: - icon_pack_name = config.get_setting('icon_set', default="default") - media_path = filetools.join("https://raw.githubusercontent.com/kodiondemand/media/master/themes/new", icon_pack_name) - return filetools.join(media_path, thumb_name) +# def get_thumb(thumb_name, view="thumb_"): +# from core import filetools +# if thumb_name.startswith('http'): +# return thumb_name +# elif config.get_setting('enable_custom_theme') and config.get_setting('custom_theme') and filetools.isfile(config.get_setting('custom_theme') + view + thumb_name): +# media_path = config.get_setting('custom_theme') +# else: +# icon_pack_name = config.get_setting('icon_set', default="default") +# media_path = filetools.join("https://raw.githubusercontent.com/kodiondemand/media/master/themes/new", icon_pack_name) +# return filetools.join(media_path, thumb_name) def set_channel_info(parameters): diff --git a/core/support.py b/core/support.py index 5f313e91..80fd557f 100755 --- a/core/support.py +++ b/core/support.py @@ -17,7 +17,7 @@ else: from urllib import urlencode from time import time -from core import httptools, scrapertools, servertools, tmdb, channeltools, autoplay, scraper +from core import httptools, scrapertools, servertools, tmdb, channeltools, autoplay from core.item import Item from lib import unshortenit from platformcode import config @@ -1397,7 +1397,7 @@ def thumb(data=None, genre=False, live=False): genre = bool, search icon in genres live = bool, add icon by channel name ''' - from channelselector import get_thumb + if live: if type(data) == list: for item in data: @@ -1414,7 +1414,7 @@ def thumb(data=None, genre=False, live=False): _torrent = ['torrent'] _live = ['corso', 'onda', 'diretta', 'dirette', 'progress', 'air', 'live'] _year = ['anno', 'anni', 'year', 'years'] - _top = ['voto', 'voti', 'votato', 'votati', 'migliore', 'migliori', 'fortunato', 'classifica', 'classifiche', 'vote', 'voted', 'best', 'top', 'lucky', 'ranking', 'charts'] + _top = ['voto', 'voti', 'votato', 'votati', 'migliore', 'migliori', 'fortunato', 'classifica', 'classifiche', 'vote', 'voted', 'best', 'top', 'lucky', 'ranking', 'rating', 'charts'] _popular = ['popolare', 'popolari', 'raccomandato', 'raccomandati', 'raccomandazione', 'raccomandazioni', 'momento', 'popular', 'recommended', 'recommendation', 'recommendations', 'moment'] _all = ['tutto', 'tutta', 'tutti', 'tutte' 'all'] _az = ['lettera', 'lettere', 'lista', 'liste', 'alfabetico', 'a-z', 'letter', 'letters', 'list', 'alphabetical'] @@ -1548,7 +1548,8 @@ def thumb(data=None, genre=False, live=False): '_documentary':_documentary, '_music':_music, '_star':_star, - '_genre':_genre} + '_genre':_genre, + '_top':_top} def autoselect_thumb(item, genre): searched_title = re.split(r'\.|\{|\}|\(|\)|/| ', scrapertools.unescape(re.sub('\[[^\]]*\]||\u2026|\u2022','', item.title.lower()))) @@ -1597,4 +1598,16 @@ def thumb(data=None, genre=False, live=False): return autoselect_thumb(data, genre) else: - return get_thumb('next.png') \ No newline at end of file + return get_thumb('next.png') + + +def get_thumb(thumb_name, view="thumb_"): + from core import filetools + if thumb_name.startswith('http'): + return thumb_name + elif config.get_setting('enable_custom_theme') and config.get_setting('custom_theme') and filetools.isfile(config.get_setting('custom_theme') + view + thumb_name): + media_path = config.get_setting('custom_theme') + else: + icon_pack_name = config.get_setting('icon_set', default="default") + media_path = filetools.join("https://raw.githubusercontent.com/kodiondemand/media/master/themes/new", icon_pack_name) + return filetools.join(media_path, thumb_name) \ No newline at end of file diff --git a/lib/generictools.py b/lib/generictools.py index 909b8474..caac391c 100644 --- a/lib/generictools.py +++ b/lib/generictools.py @@ -11,7 +11,7 @@ import re, os, sys, datetime, time, traceback try: import urlparse except: import urllib.parse as urlparse -from channelselector import get_thumb +from core.support import get_thumb from core import httptools, scrapertools, servertools, channeltools, filetools, tmdb from core.item import Item from platformcode import config, logger, platformtools diff --git a/platformcode/envtal.py b/platformcode/envtal.py index c21d36e7..a436d0bb 100644 --- a/platformcode/envtal.py +++ b/platformcode/envtal.py @@ -401,7 +401,8 @@ def list_env(environment={}): def paint_env(item, environment={}): from core.item import Item - from channelselector import get_thumb + from core.support import thumb + # from channelselector import get_thumb if not environment: environment = get_environment() @@ -409,7 +410,7 @@ def paint_env(item, environment={}): itemlist = [] - thumb = get_thumb("setting.png") + thumb = thumb("setting.png") cabecera = """\ It shows the [COLOR yellow] variables [/ COLOR] of the Kodi ecosystem that may be relevant to the problem diagnosis in Alpha: @@ -551,6 +552,6 @@ def paint_env(item, environment={}): itemlist.append(Item(title="==> Report a bug", channel="setting", action="report_menu", category='Configuración', - unify=False, plot=reporte, thumbnail=get_thumb("error.png"))) + unify=False, plot=reporte, thumbnail=thumb("error.png"))) return (itemlist, environment) \ No newline at end of file diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 50e0a01b..333cae91 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -18,9 +18,8 @@ else: import os, xbmc, xbmcgui, xbmcplugin from past.utils import old_div -from channelselector import get_thumb from core import scrapertools -from core.item import InfoLabels, Item +from core.item import Item from platformcode import logger, config addon = config.__settings__ @@ -341,7 +340,8 @@ def render_items(itemlist, parent_item): # if there's no item, add "no elements" item if not len(itemlist): - itemlist.append(Item(title=config.get_localized_string(60347), thumbnail=get_thumb('nofolder.png'))) + from core.support import thumb + itemlist.append(Item(title=config.get_localized_string(60347), thumbnail=thumb('nofolder'))) dirItems = [] # for n, item in enumerate(itemlist): diff --git a/specials/community.py b/specials/community.py index 68a18b74..1bfb7ae9 100644 --- a/specials/community.py +++ b/specials/community.py @@ -7,7 +7,6 @@ import re, inspect, xbmcgui from core import httptools, jsontools, tmdb, support, filetools from core.item import Item from platformcode import config, platformtools, logger -from channelselector import get_thumb from collections import OrderedDict info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json @@ -46,7 +45,7 @@ def show_channels(item): itemlist.append(Item(channel=item.channel, title=support.typo(config.get_localized_string(70676),'bold color kod'), action='add_channel', - thumbnail=get_thumb('add.png'))) + thumbnail=support.thumb('add'))) for key, channel in json['channels'].items(): path = filetools.dirname(channel['path']) # relative path @@ -679,7 +678,7 @@ def set_extra_values(item, json, path): elif key == 'plot': ret.plot = json[key] elif key in ['poster', 'thumbnail']: - ret.thumb = json[key] if ':/' in json[key] else filetools.join(path,json[key]) if '/' in json[key] else get_thumb(json[key]) + ret.thumb = json[key] if ':/' in json[key] else filetools.join(path,json[key]) if '/' in json[key] else support.thumb(json[key]) elif key == 'fanart': ret.fanart = json[key] if ':/' in json[key] else filetools.join(path,json[key]) elif key in ['url', 'link']: @@ -704,7 +703,7 @@ def set_extra_values(item, json, path): if not ret.thumb: if 'get_search_menu' in inspect.stack()[1][3]: - ret.thumb = get_thumb('search.png') + ret.thumb = support.thumb('search') else: ret.thumb = item.thumbnail if not ret.fanart: @@ -744,7 +743,7 @@ def relative(key, json, path): ret = '' if key in json: if key in ['thumbnail', 'poster']: - ret = json[key] if ':/' in json[key] else filetools.join(path,json[key]) if '/' in json[key] else get_thumb(json[key]) if json[key] else '' + ret = json[key] if ':/' in json[key] else filetools.join(path,json[key]) if '/' in json[key] else support.thumb(json[key]) if json[key] else '' else: ret = json[key] if ':/' in json[key] else filetools.join(path,json[key]) if '/' in json[key] else '' diff --git a/specials/downloads.py b/specials/downloads.py index 2855ed22..4c3e97c5 100644 --- a/specials/downloads.py +++ b/specials/downloads.py @@ -12,7 +12,7 @@ from past.utils import old_div import re, time, unicodedata, xbmc -from channelselector import get_thumb +from core.support import thumb from core import filetools, jsontools, scraper, scrapertools, servertools, videolibrarytools, support from core.downloader import Downloader from core.item import Item @@ -93,43 +93,43 @@ def mainlist(item): # If there is any completed if 2 in estados: itemlist.insert(0, Item(channel=item.channel, action="clean_ready", title=config.get_localized_string(70218), - contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=get_thumb('delete.png'), + contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=thumb('delete'), contentSerieName=item.contentSerieName, text_color=STATUS_COLORS[STATUS_CODES.completed])) # If there is any error if 3 in estados: itemlist.insert(0, Item(channel=item.channel, action="restart_error", title=config.get_localized_string(70219), - contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=get_thumb('update.png'), + contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=thumb('update'), contentSerieName=item.contentSerieName, text_color=STATUS_COLORS[STATUS_CODES.error])) # 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=get_thumb('downloads.png'), + contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=thumb('downloads'), contentSerieName=item.contentSerieName)) if len(itemlist): itemlist.insert(0, Item(channel=item.channel, action="clean_all", title=support.typo(config.get_localized_string(70221),'bold'), - contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=get_thumb('delete.png'), + contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=thumb('delete'), contentSerieName=item.contentSerieName)) # if there's at least one downloading if 4 in estados: itemlist.insert(0, Item(channel=item.channel, action="stop_all", title=config.get_localized_string(60222), contentType=item.contentType, contentChannel=item.contentChannel, - contentSerieName=item.contentSerieName, thumbnail=get_thumb('stop.png'), + contentSerieName=item.contentSerieName, thumbnail=thumb('stop'), text_color=STATUS_COLORS[STATUS_CODES.downloading])) if not item.contentType == "tvshow" and config.get_setting("browser") == True: - itemlist.insert(0, Item(channel=item.channel, action="browser", title=support.typo(config.get_localized_string(70222),'bold'), thumbnail=get_thumb('search.png'), url=DOWNLOAD_PATH)) + itemlist.insert(0, Item(channel=item.channel, action="browser", title=support.typo(config.get_localized_string(70222),'bold'), thumbnail=thumb('search'), url=DOWNLOAD_PATH)) if not item.contentType == "tvshow": - itemlist.append(Item(channel='shortcuts', action="SettingOnPosition", category=6, setting=0, title= support.typo(config.get_localized_string(70288),'bold color kod'), thumbnail=get_thumb('setting.png'))) + itemlist.append(Item(channel='shortcuts', action="SettingOnPosition", category=6, setting=0, title= support.typo(config.get_localized_string(70288),'bold color kod'), thumbnail=thumb('setting'))) # Reload if estados: itemlist.insert(0, Item(channel=item.channel, action="reload", title= support.typo(config.get_localized_string(70008),'bold color kod'), - contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=get_thumb('update.png'), + contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=thumb('update'), contentSerieName=item.contentSerieName)) return itemlist diff --git a/specials/filmontv.py b/specials/filmontv.py index 5cd6b4d6..780a7dfb 100644 --- a/specials/filmontv.py +++ b/specials/filmontv.py @@ -19,11 +19,7 @@ TIMEOUT_TOTAL = 60 def mainlist(item): logger.debug(" mainlist") - itemlist = [#Item(channel="search", action='discover_list', title=config.get_localized_string(70309), - #search_type='list', list_type='movie/now_playing', - # thumbnail=get_thumb("now_playing.png")), - #Item(channel="search", action='discover_list', title=config.get_localized_string(70312), - # search_type='list', list_type='tv/on_air', thumbnail=get_thumb("on_air.png")), + itemlist = [ Item(title=support.typo('Canali live', 'bold'), channel=item.channel, action='live', diff --git a/specials/globalsearch.py b/specials/globalsearch.py index 67f7f5f8..cda07a34 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -708,7 +708,7 @@ class SearchWindow(xbmcgui.WindowXML): serverlist = uhd + fhd + hd + sd + unknown + other if not serverlist: serverlist = [xbmcgui.ListItem(config.get_localized_string(60347))] - serverlist[0].setProperty('thumb', channelselector.get_thumb('nofolder.png')) + serverlist[0].setProperty('thumb', support.thumb('nofolder')) self.Focus(SERVERS) self.SERVERLIST.reset() @@ -733,7 +733,7 @@ class SearchWindow(xbmcgui.WindowXML): if not ep: ep = [xbmcgui.ListItem(config.get_localized_string(60347))] - ep[0].setProperty('thumb', channelselector.get_thumb('nofolder.png')) + ep[0].setProperty('thumb', support.thumb('nofolder')) self.Focus(EPISODES) self.EPISODESLIST.reset() diff --git a/specials/help.py b/specials/help.py index 32e811bd..8a00fd35 100644 --- a/specials/help.py +++ b/specials/help.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from channelselector import get_thumb from core.item import Item +from core.support import thumb from platformcode import config, logger guideUrl = "https://github.com/kodiondemand/addon/wiki/Guida-alle-funzioni-di-Kod" @@ -11,12 +11,12 @@ def mainlist(item): if config.is_xbmc(): itemlist.append(Item(title=config.get_localized_string(707429), channel="setting", action="report_menu", - thumbnail=get_thumb("error.png"), viewmode="list",folder=True)) + thumbnail=thumb("error"), viewmode="list",folder=True)) itemlist.append(Item(action="open_browser", title=config.get_localized_string(60447), - thumbnail=get_thumb("help.png"), url=guideUrl, plot=guideUrl, + thumbnail=thumb("help"), url=guideUrl, plot=guideUrl, folder=False)) - itemlist.append(Item(channel="setting", action="check_quickfixes", folder=False, thumbnail=get_thumb("update.png"), + itemlist.append(Item(channel="setting", action="check_quickfixes", folder=False, thumbnail=thumb("update"), title=config.get_localized_string(30001), plot=config.get_addon_version(with_fix=True))) return itemlist diff --git a/specials/kodfavorites.py b/specials/kodfavorites.py index f9fb0ee1..cd0697b0 100644 --- a/specials/kodfavorites.py +++ b/specials/kodfavorites.py @@ -200,7 +200,7 @@ def mainlist(item): context.append({'title': config.get_localized_string(70538), 'channel': item.channel, 'action': 'mover_perfil', 'i_perfil': i_perfil, 'direccion': 'bottom'}) plot = str(len(perfil['items'])) + " " + config.get_localized_string(70723) - itemlist.append(Item(channel=item.channel, action='mostrar_perfil', title=perfil['title'], plot=plot, i_perfil=i_perfil, context=context, thumbnail=support.thumb('mylink.png'))) + itemlist.append(Item(channel=item.channel, action='mostrar_perfil', title=perfil['title'], plot=plot, i_perfil=i_perfil, context=context, thumbnail=support.thumb('mylink'))) support.thumb(itemlist) itemlist.append(item.clone(action='crear_perfil', title=config.get_localized_string(70542), folder=False, thumbnail=support.thumb('more'))) itemlist.append(item.clone(action='mainlist_listas', title=config.get_localized_string(70603), thumbnail=support.thumb('setting'))) @@ -643,9 +643,9 @@ def activar_lista(item): config.set_setting('lista_activa', item.lista) - from channelselector import get_thumb + from core.support import thumb item_inicio = Item(title=config.get_localized_string(70527), channel="kodfavorites", action="mainlist", - thumbnail=get_thumb("mylink.png"), + thumbnail=thumb("mylink"), category=config.get_localized_string(70527), viewmode="thumbnails") platformtools.itemlist_update(item_inicio, replace=True) return True diff --git a/specials/news.py b/specials/news.py index e4241fbb..ea83c2c1 100644 --- a/specials/news.py +++ b/specials/news.py @@ -14,7 +14,8 @@ if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int import glob, os, re, time from threading import Thread -from channelselector import get_thumb, auto_filter +from channelselector import auto_filter +from core. support import thumb from core import channeltools, jsontools, scrapertools, support from core.item import Item from platformcode import config, logger, platformtools @@ -51,27 +52,27 @@ def mainlist(item): channel_language = auto_filter() #if list_canales['peliculas']: - # thumbnail = get_thumb("movie.png") + # thumbnail = thumb("movie") new_item = Item(channel=item.channel, action="novedades", extra="peliculas", title=config.get_localized_string(30122) + '{news}') set_category_context(new_item) itemlist.append(new_item) - # thumbnail = get_thumb("movie_4k.png") + # thumbnail = thumb("movie_4k") # new_item = Item(channel=item.channel, action="novedades", extra="4k", title=config.get_localized_string(70208), thumbnail=thumbnail) # # set_category_context(new_item) # itemlist.append(new_item) #if list_canales['terror']: - # thumbnail = get_thumb("channels_horror.png") + # thumbnail = thumb("channels_horror") # new_item = Item(channel=item.channel, action="novedades", extra="terror", title=config.get_localized_string(70209), # thumbnail=thumbnail) # set_category_context(new_item) # itemlist.append(new_item) #if list_canales['infantiles']: - # thumbnail = get_thumb("children.png") + # thumbnail = thumb("children") # new_item = Item(channel=item.channel, action="novedades", extra="infantiles", title=config.get_localized_string(60510), # thumbnail=thumbnail) # set_category_context(new_item) @@ -89,20 +90,20 @@ def mainlist(item): # if channel_language == "all": # # if list_canales['Italiano']: - # thumbnail = get_thumb("italian.png") + # thumbnail = thumb("italian") # new_item = Item(channel=item.channel, action="novedades", extra="italiano", title=config.get_localized_string(70563), # thumbnail=thumbnail) # set_category_context(new_item) # itemlist.append(new_item) # if list_canales['Torrent']: - # thumbnail = get_thumb("channels_torrent.png") + # thumbnail = thumb("channels_torrent") # new_item = Item(channel=item.channel, action="novedades", extra="torrent", title=config.get_localized_string(70171), thumbnail=thumbnail) # set_category_context(new_item) # itemlist.append(new_item) #if list_canales['documentales']: - # thumbnail = get_thumb("documentary.png") + # thumbnail = thumb("documentary") # new_item = Item(channel=item.channel, action="novedades", extra="documentales", title=config.get_localized_string(60513), # thumbnail=thumbnail) # set_category_context(new_item) @@ -194,7 +195,7 @@ def get_from_cache(item): def add_menu_items(item, itemlist): logger.debug() - menu_icon = get_thumb('menu.png') + menu_icon = thumb('menu') menu = Item(channel="channelselector", action="getmainlist", viewmode="movie", thumbnail=menu_icon, title='Menu') itemlist.insert(0, menu) if item.mode != 'finish': @@ -202,7 +203,7 @@ def add_menu_items(item, itemlist): last=item.last else: last = len(itemlist) - refresh_icon = get_thumb('more.png') + refresh_icon = thumb('more') refresh = item.clone(thumbnail=refresh_icon, mode='get_cached',title='Mas', last=last) itemlist.insert(len(itemlist), refresh) @@ -551,40 +552,40 @@ def show_channels(item): def menu_opciones(item): itemlist = list() itemlist.append(Item(channel=item.channel, title=config.get_localized_string(60525), - text_bold = True, thumbnail=get_thumb("setting.png"), + text_bold = True, thumbnail=thumb("setting"), folder=False)) itemlist.append(Item(channel=item.channel, action="setting_channel", extra="peliculas", title=config.get_localized_string(60526), - thumbnail=get_thumb("movie.png"), + thumbnail=thumb("movie"), folder=False)) # itemlist.append(Item(channel=item.channel, action="setting_channel", extra="4K", title=config.get_localized_string(70207), - # thumbnail=get_thumb("movie.png"), folder=False)) + # thumbnail=thumb("movie"), folder=False)) # itemlist.append(Item(channel=item.channel, action="setting_channel", extra="infantiles", title=config.get_localized_string(60527), - # thumbnail=get_thumb("children.png"), + # thumbnail=thumb("children"), # folder=False)) itemlist.append(Item(channel=item.channel, action="setting_channel", extra="series", title=config.get_localized_string(60528), - thumbnail=get_thumb("tvshow.png"), + thumbnail=thumb("tvshow"), folder=False)) itemlist.append(Item(channel=item.channel, action="setting_channel", extra="anime", title=config.get_localized_string(60529), - thumbnail=get_thumb("anime.png"), + thumbnail=thumb("anime"), folder=False)) # itemlist.append( # Item(channel=item.channel, action="setting_channel", extra="castellano", title=config.get_localized_string(70212), - # thumbnail=get_thumb("documentary.png"), folder=False)) + # thumbnail=thumb("documentary"), folder=False)) # itemlist.append(Item(channel=item.channel, action="setting_channel", extra="latino", title=config.get_localized_string(70213), - # thumbnail=get_thumb("documentary.png"), folder=False)) + # thumbnail=thumb("documentary"), folder=False)) # itemlist.append(Item(channel=item.channel, action="setting_channel", extra="torrent", title=config.get_localized_string(70214), - # thumbnail=get_thumb("documentary.png"), folder=False)) + # thumbnail=thumb("documentary"), folder=False)) itemlist.append(Item(channel=item.channel, action="setting_channel", extra="documentales", title=config.get_localized_string(60530), - thumbnail=get_thumb("documentary.png"), + thumbnail=thumb("documentary"), folder=False)) itemlist.append(Item(channel=item.channel, action="settings", title=config.get_localized_string(60531), - thumbnail=get_thumb("setting.png"), + thumbnail=thumb("setting"), folder=False)) return itemlist diff --git a/specials/search.py b/specials/search.py index 2d6dca9d..9499a14c 100644 --- a/specials/search.py +++ b/specials/search.py @@ -12,7 +12,7 @@ import sys PY3 = False if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int -import os, json, time, inspect, channelselector +import time, channelselector if PY3: from concurrent import futures @@ -20,7 +20,6 @@ else: from concurrent_py2 import futures from core.item import Item from core import tmdb, scrapertools, channeltools, filetools, jsontools, servertools -from channelselector import get_thumb from platformcode import logger, config, platformtools, unify from core.support import typo, thumb import xbmcgui @@ -42,19 +41,19 @@ def mainlist(item): Item(channel='globalsearch', title=config.get_localized_string(70741) % config.get_localized_string(30123), action='Search', mode='tvshow', folder=False), Item(channel='globalsearch', title=config.get_localized_string(70741) % config.get_localized_string(70314), action='Search', page=1, mode='person', folder=False)] else: - itemlist = [Item(channel=item.channel, title=config.get_localized_string(70276), action='new_search', mode='all', thumbnail=get_thumb("search.png")), + itemlist = [Item(channel=item.channel, title=config.get_localized_string(70276), action='new_search', mode='all'), Item(channel=item.channel, title=config.get_localized_string(70741) % config.get_localized_string(30122), action='new_search', mode='movie'), Item(channel=item.channel, title=config.get_localized_string(70741) % config.get_localized_string(30123), action='new_search', mode='tvshow'), Item(channel=item.channel, title=config.get_localized_string(70741) % config.get_localized_string(70314), action='new_search', page=1, mode='person')] - itemlist += [Item(channel=item.channel, title=config.get_localized_string(59995), action='saved_search', thumbnail=get_thumb('search.png')), - Item(channel=item.channel, title=config.get_localized_string(60420), action='sub_menu', thumbnail=get_thumb('search.png')), - Item(channel="tvmoviedb", title=config.get_localized_string(70274), action="mainlist", thumbnail=get_thumb("search.png")), - Item(channel=item.channel, title=typo(config.get_localized_string(59994) + '{config}', 'color kod bold'), action='setting_channel_new', thumbnail=get_thumb('setting.png'), folder=False), - Item(channel='shortcuts', title=typo(config.get_localized_string(70286), 'color kod bold'), action='SettingOnPosition', category=5, setting=1, thumbnail=get_thumb('setting.png'), folder=False)] + itemlist += [Item(channel=item.channel, title=config.get_localized_string(59995), action='saved_search', thumbnail=thumb('search')), + Item(channel=item.channel, title=config.get_localized_string(60420), action='sub_menu', thumbnail=thumb('search')), + Item(channel="tvmoviedb", title=config.get_localized_string(70274), action="mainlist", thumbnail=thumb('search')), + Item(channel=item.channel, title=typo(config.get_localized_string(59994) + '{config}', 'color kod bold'), action='setting_channel_new', folder=False), + Item(channel='shortcuts', title=typo(config.get_localized_string(70286), 'color kod bold'), action='SettingOnPosition', category=5, setting=1, folder=False)] itemlist = set_context(itemlist) - support.thumb(itemlist) + thumb(itemlist) return itemlist @@ -92,14 +91,14 @@ def saved_search(item): search_text=saved_search_text.split('{}')[0], text=saved_search_text.split('{}')[0], mode='all', - thumbnail=get_thumb('search.png'))) + thumbnail=thumb('search'))) if len(saved_searches_list) > 0: itemlist.append( Item(channel=item.channel, action="clear_saved_searches", title=typo(config.get_localized_string(60417), 'color kod bold'), - thumbnail=get_thumb('search.png'))) + thumbnail=thumb('search'))) itemlist = set_context(itemlist) return itemlist @@ -334,13 +333,13 @@ def channel_search(item): results = sorted(results, key=lambda it: it.title) results_statistic = config.get_localized_string(59972) % (item.title, time.time() - start) if mode == 'all': - results.insert(0, Item(title=typo(results_statistic, 'color kod bold'), thumbnail=get_thumb('search.png'))) + results.insert(0, Item(title=typo(results_statistic, 'color kod bold'), thumbnail=thumb('search'))) else: if not valid: - valid.append(Item(title=config.get_localized_string(60347), thumbnail=get_thumb('nofolder.png'))) + valid.append(Item(title=config.get_localized_string(60347), thumbnail=thumb('nofolder'))) - valid.insert(0, Item(title=typo(results_statistic, 'color kod bold'), thumbnail=get_thumb('search.png'))) - results.insert(0, Item(title=typo(config.get_localized_string(30025), 'color kod bold'), thumbnail=get_thumb('search.png'))) + valid.insert(0, Item(title=typo(results_statistic, 'color kod bold'), thumbnail=thumb('search'))) + results.insert(0, Item(title=typo(config.get_localized_string(30025), 'color kod bold'), thumbnail=thumb('search'))) # logger.debug(results_statistic) itlist = valid + results @@ -583,11 +582,11 @@ def years_menu(item): mode = item.mode.replace('show', '') par_year = 'primary_release_year' - thumb = channelselector.get_thumb('movie_year.png') + thumb = thumb('movie_year') if mode != 'movie': par_year = 'first_air_date_year' - thumb = channelselector.get_thumb('tvshow_year.png') + thumb = thumb('tvshow_year') c_year = datetime.datetime.now().year + 1 l_year = c_year - 31 diff --git a/specials/setting.py b/specials/setting.py index bbaeb100..763e884a 100644 --- a/specials/setting.py +++ b/specials/setting.py @@ -536,11 +536,11 @@ def restore_tools(item): def report_menu(item): logger.debug('URL: ' + item.url) - from channelselector import get_thumb + from core.support import thumb - thumb_debug = get_thumb("update.png") - thumb_error = get_thumb("error.png") - thumb_next = get_thumb("next.png") + thumb_debug = thumb("update") + thumb_error = thumb("error") + thumb_next = thumb("next") itemlist = [] paso = 1 diff --git a/specials/trailertools.py b/specials/trailertools.py index 0790788e..f4f93f7b 100644 --- a/specials/trailertools.py +++ b/specials/trailertools.py @@ -9,7 +9,7 @@ from __future__ import division import random import sys -from channelselector import get_thumb +from core.support import thumb PY3 = False if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int @@ -111,7 +111,7 @@ def buscartrailer(item, trailers=[]): return if not itemlist: itemlist.append(item.clone(title=config.get_localized_string(70501), title2=item.contentTitle, - action="", thumbnail=get_thumb('nofolder.png'), text_color="")) + action="", thumbnail=thumb('nofolder'), text_color="")) from lib.fuzzy_match import algorithims itemlist.sort(key=lambda r: algorithims.trigram(item.contentTitle + ' trailer', r.title), reverse=True)