nuovo render_items, changelog solo all'apertura di kod

This commit is contained in:
marco
2020-04-01 18:24:57 +02:00
parent 38a726afb0
commit 470fb254cd
8 changed files with 105 additions and 116 deletions
+13 -21
View File
@@ -12,9 +12,6 @@ import xbmcaddon
addon = xbmcaddon.Addon('plugin.video.kod') addon = xbmcaddon.Addon('plugin.video.kod')
downloadenabled = addon.getSetting('downloadenabled') downloadenabled = addon.getSetting('downloadenabled')
from specials import shortcuts
CONTEXT = shortcuts.context()
def getmainlist(view="thumb_"): def getmainlist(view="thumb_"):
logger.info() logger.info()
itemlist = list() itemlist = list()
@@ -22,8 +19,7 @@ def getmainlist(view="thumb_"):
if config.dev_mode(): if config.dev_mode():
itemlist.append(Item(title="Redirect", channel="checkhost", action="check_channels", itemlist.append(Item(title="Redirect", channel="checkhost", action="check_channels",
thumbnail='', thumbnail='',
category=config.get_localized_string(30119), viewmode="thumbnails", category=config.get_localized_string(30119), viewmode="thumbnails"))
context = CONTEXT))
# Añade los canales que forman el menú principal # Añade los canales que forman el menú principal
if addon.getSetting('enable_news_menu') == "true": if addon.getSetting('enable_news_menu') == "true":
# itemlist.append(Item(title=config.get_localized_string(30130), channel="news", action="mainlist", # itemlist.append(Item(title=config.get_localized_string(30130), channel="news", action="mainlist",
@@ -33,13 +29,12 @@ def getmainlist(view="thumb_"):
itemlist.append(Item(title=config.get_localized_string(30130), channel="news", action="mainlist", itemlist.append(Item(title=config.get_localized_string(30130), channel="news", action="mainlist",
thumbnail=get_thumb("news.png", view), thumbnail=get_thumb("news.png", view),
category=config.get_localized_string(30119), viewmode="thumbnails", category=config.get_localized_string(30119), viewmode="thumbnails",
context=CONTEXT + [{"title": config.get_localized_string(70285), "channel": "shortcuts", "action": "SettingOnPosition", "category":5}])) context=[{"title": config.get_localized_string(70285), "channel": "shortcuts", "action": "SettingOnPosition", "category":5}]))
if addon.getSetting('enable_channels_menu') == "true": if addon.getSetting('enable_channels_menu') == "true":
itemlist.append(Item(title=config.get_localized_string(30118), channel="channelselector", action="getchanneltypes", itemlist.append(Item(title=config.get_localized_string(30118), channel="channelselector", action="getchanneltypes",
thumbnail=get_thumb("channels.png", view), view=view, thumbnail=get_thumb("channels.png", view), view=view,
category=config.get_localized_string(30119), viewmode="thumbnails", category=config.get_localized_string(30119), viewmode="thumbnails"))
context = CONTEXT))
if addon.getSetting('enable_search_menu') == "true": if addon.getSetting('enable_search_menu') == "true":
# itemlist.append(Item(title=config.get_localized_string(30103), channel="search", path='special', action="mainlist", # itemlist.append(Item(title=config.get_localized_string(30103), channel="search", path='special', action="mainlist",
@@ -50,25 +45,22 @@ def getmainlist(view="thumb_"):
itemlist.append(Item(title=config.get_localized_string(30103), channel="search", path='special', action="mainlist", itemlist.append(Item(title=config.get_localized_string(30103), channel="search", path='special', action="mainlist",
thumbnail=get_thumb("search.png", view), thumbnail=get_thumb("search.png", view),
category=config.get_localized_string(30119), viewmode="list", category=config.get_localized_string(30119), viewmode="list",
context = CONTEXT + [{"title": config.get_localized_string(60412), "action": "setting_channel_new", "channel": "search"}, context = [{"title": config.get_localized_string(60412), "action": "setting_channel_new", "channel": "search"},
{"title": config.get_localized_string(70286), "channel": "shortcuts", "action": "SettingOnPosition", "category":3}])) {"title": config.get_localized_string(70286), "channel": "shortcuts", "action": "SettingOnPosition", "category":3}]))
if addon.getSetting('enable_onair_menu') == "true": if addon.getSetting('enable_onair_menu') == "true":
itemlist.append(Item(channel="filmontv", action="mainlist", title=config.get_localized_string(50001), itemlist.append(Item(channel="filmontv", action="mainlist", title=config.get_localized_string(50001),
thumbnail=get_thumb("on_the_air.png"), viewmode="thumbnails", thumbnail=get_thumb("on_the_air.png"), viewmode="thumbnails"))
context = CONTEXT))
if addon.getSetting('enable_link_menu') == "true": if addon.getSetting('enable_link_menu') == "true":
itemlist.append(Item(title=config.get_localized_string(70527), channel="kodfavorites", action="mainlist", itemlist.append(Item(title=config.get_localized_string(70527), channel="kodfavorites", action="mainlist",
thumbnail=get_thumb("mylink.png", view), view=view, thumbnail=get_thumb("mylink.png", view), view=view,
category=config.get_localized_string(70527), viewmode="thumbnails", category=config.get_localized_string(70527), viewmode="thumbnails"))
context = CONTEXT))
if addon.getSetting('enable_fav_menu') == "true": if addon.getSetting('enable_fav_menu') == "true":
itemlist.append(Item(title=config.get_localized_string(30102), channel="favorites", action="mainlist", itemlist.append(Item(title=config.get_localized_string(30102), channel="favorites", action="mainlist",
thumbnail=get_thumb("favorites.png", view), thumbnail=get_thumb("favorites.png", view),
category=config.get_localized_string(30102), viewmode="thumbnails", category=config.get_localized_string(30102), viewmode="thumbnails"))
context = CONTEXT))
if config.get_videolibrary_support() and addon.getSetting('enable_library_menu') == "true": 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", # itemlist.append(Item(title=config.get_localized_string(30131), channel="videolibrary", action="mainlist",
@@ -79,7 +71,7 @@ def getmainlist(view="thumb_"):
itemlist.append(Item(title=config.get_localized_string(30131), channel="videolibrary", action="mainlist", itemlist.append(Item(title=config.get_localized_string(30131), channel="videolibrary", action="mainlist",
thumbnail=get_thumb("videolibrary.png", view), thumbnail=get_thumb("videolibrary.png", view),
category=config.get_localized_string(30119), viewmode="thumbnails", category=config.get_localized_string(30119), viewmode="thumbnails",
context=CONTEXT + [{"title": config.get_localized_string(70287), "channel": "shortcuts", "action": "SettingOnPosition", "category":2}, context=[{"title": config.get_localized_string(70287), "channel": "shortcuts", "action": "SettingOnPosition", "category":2},
{"title": config.get_localized_string(60568), "channel": "videolibrary", "action": "update_videolibrary"}])) {"title": config.get_localized_string(60568), "channel": "videolibrary", "action": "update_videolibrary"}]))
if downloadenabled != "false": if downloadenabled != "false":
# itemlist.append(Item(title=config.get_localized_string(30101), channel="downloads", action="mainlist", # itemlist.append(Item(title=config.get_localized_string(30101), channel="downloads", action="mainlist",
@@ -88,7 +80,7 @@ def getmainlist(view="thumb_"):
# "action": "channel_config"}])) # "action": "channel_config"}]))
itemlist.append(Item(title=config.get_localized_string(30101), channel="downloads", action="mainlist", itemlist.append(Item(title=config.get_localized_string(30101), channel="downloads", action="mainlist",
thumbnail=get_thumb("downloads.png", view), viewmode="list", thumbnail=get_thumb("downloads.png", view), viewmode="list",
context=CONTEXT + [{"title": config.get_localized_string(70288), "channel": "shortcuts", "action": "SettingOnPosition", "category":4}])) context=[{"title": config.get_localized_string(70288), "channel": "shortcuts", "action": "SettingOnPosition", "category":4}]))
thumb_setting = "setting_%s.png" % 0 # config.get_setting("plugin_updates_available") thumb_setting = "setting_%s.png" % 0 # config.get_setting("plugin_updates_available")
@@ -122,13 +114,13 @@ def getchanneltypes(view="thumb_"):
title = config.get_localized_string(30121) title = config.get_localized_string(30121)
itemlist.append(Item(title=title, channel="channelselector", action="filterchannels", view=view, itemlist.append(Item(title=title, channel="channelselector", action="filterchannels", view=view,
category=title, channel_type="all", thumbnail=get_thumb("channels_all.png", view), category=title, channel_type="all", thumbnail=get_thumb("channels_all.png", view),
viewmode="thumbnails", context = CONTEXT)) viewmode="thumbnails"))
for channel_type in channel_types: for channel_type in channel_types:
title = config.get_localized_category(channel_type) title = config.get_localized_category(channel_type)
itemlist.append(Item(title=title, channel="channelselector", action="filterchannels", category=title, itemlist.append(Item(title=title, channel="channelselector", action="filterchannels", category=title,
channel_type=channel_type, viewmode="thumbnails", channel_type=channel_type, viewmode="thumbnails",
thumbnail=get_thumb("channels_%s.png" % channel_type, view), context = CONTEXT)) thumbnail=get_thumb("channels_%s.png" % channel_type, view)))
# itemlist.append(Item(title='Oggi in TV', channel="filmontv", action="mainlist", view=view, # itemlist.append(Item(title='Oggi in TV', channel="filmontv", action="mainlist", view=view,
# category=title, channel_type="all", thumbnail=get_thumb("on_the_air.png", view), # category=title, channel_type="all", thumbnail=get_thumb("on_the_air.png", view),
@@ -138,7 +130,7 @@ def getchanneltypes(view="thumb_"):
itemlist.append(Item(title=config.get_localized_string(70685), channel="community", action="mainlist", view=view, 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("channels_community.png", view), category=config.get_localized_string(70685), channel_type="all", thumbnail=get_thumb("channels_community.png", view),
viewmode="thumbnails", context = CONTEXT)) viewmode="thumbnails"))
return itemlist return itemlist
@@ -244,7 +236,7 @@ def filterchannels(category, view="thumb_"):
channelslist.append(Item(title=channel_parameters["title"], channel=channel_parameters["channel"], channelslist.append(Item(title=channel_parameters["title"], channel=channel_parameters["channel"],
action="mainlist", thumbnail=channel_parameters["thumbnail"], action="mainlist", thumbnail=channel_parameters["thumbnail"],
fanart=channel_parameters["fanart"], plot=channel_info, category=channel_parameters["title"], fanart=channel_parameters["fanart"], plot=channel_info, category=channel_parameters["title"],
language=channel_parameters["language"], viewmode="list", context=CONTEXT + context)) language=channel_parameters["language"], viewmode="list", context=context))
except: except:
logger.error("Se ha producido un error al leer los datos del canal '%s'" % channel) logger.error("Se ha producido un error al leer los datos del canal '%s'" % channel)
+3 -7
View File
@@ -26,9 +26,7 @@ from core import httptools, scrapertools, servertools, tmdb, channeltools
from core.item import Item from core.item import Item
from lib import unshortenit from lib import unshortenit
from platformcode import logger, config from platformcode import logger, config
from specials import autoplay, shortcuts from specials import autoplay
CONTEXT =shortcuts.context()
def hdpass_get_servers(item): def hdpass_get_servers(item):
def get_hosts(url, quality): def get_hosts(url, quality):
@@ -306,8 +304,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
contentLanguage = lang1, contentLanguage = lang1,
contentEpisodeNumber=episode if episode else '', contentEpisodeNumber=episode if episode else '',
news= item.news if item.news else '', news= item.news if item.news else '',
other = scraped['other'] if scraped['other'] else '', other = scraped['other'] if scraped['other'] else ''
context = CONTEXT
) )
# for lg in list(set(listGroups).difference(known_keys)): # for lg in list(set(listGroups).difference(known_keys)):
@@ -629,8 +626,7 @@ def menuItem(itemlist, filename, title='', action='', url='', contentType='movie
url = url, url = url,
extra = extra, extra = extra,
args = args, args = args,
contentType = contentType, contentType = contentType
context = CONTEXT
)) ))
# Apply auto Thumbnails at the menus # Apply auto Thumbnails at the menus
-4
View File
@@ -14,10 +14,6 @@ logger.info("init...")
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib')) librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
sys.path.insert(0, librerias) sys.path.insert(0, librerias)
if not config.dev_mode():
from platformcode import updater
updater.showSavedChangelog()
from platformcode import launcher from platformcode import launcher
if sys.argv[2] == "": if sys.argv[2] == "":
+4
View File
@@ -41,6 +41,10 @@ def start():
from specials.checkhost import test_conn from specials.checkhost import test_conn
import threading import threading
threading.Thread(target=test_conn, args=(True, not config.get_setting('resolver_dns'), True, [], [], True)).start() threading.Thread(target=test_conn, args=(True, not config.get_setting('resolver_dns'), True, [], [], True)).start()
if not config.dev_mode():
from platformcode import updater
updater.showSavedChangelog()
def run(item=None): def run(item=None):
logger.info() logger.info()
+71 -72
View File
@@ -135,39 +135,43 @@ def render_items(itemlist, parent_item):
""" """
logger.info('START render_items') logger.info('START render_items')
from specials import shortcuts from specials import shortcuts
from core import httptools
_handle = int(sys.argv[1]) _handle = int(sys.argv[1])
default_fanart = config.get_fanart() default_fanart = config.get_fanart()
context_commands = shortcuts.context() def_context_commands = shortcuts.context()
# for adding extendedinfo to contextual menu, if it's used
has_extendedinfo = xbmc.getCondVisibility('System.HasAddon(script.extendedinfo)')
# for adding superfavourites to contextual menu, if it's used
sf_file_path = xbmc.translatePath("special://home/addons/plugin.program.super.favourites/LaunchSFMenu.py")
check_sf = os.path.exists(sf_file_path)
superfavourites = check_sf and xbmc.getCondVisibility('System.HasAddon("plugin.program.super.favourites")')
# if it's not a list, do nothing # if it's not a list, do nothing
if not isinstance(itemlist, list): if not isinstance(itemlist, list):
return return
# if there's no item, add "no elements" item # if there's no item, add "no elements" item
if not len(itemlist): if not len(itemlist):
itemlist.append(Item(title=config.get_localized_string(60347))) itemlist.append(Item(title=config.get_localized_string(60347)))
for item in itemlist: for item in itemlist:
# Si el item no contiene categoria, le ponemos la del item padre item_url = item.tourl()
if item.category == "": if item.category == "":
item.category = parent_item.category item.category = parent_item.category
# Si title no existe, lo iniciamos como str, para evitar errones "NoType"
if not item.title: if not item.title:
item.title = '' item.title = ''
# Si no hay action o es findvideos/play, folder=False porque no se va a devolver ningún listado # Si no hay action o es findvideos/play, folder=False porque no se va a devolver ningún listado
if item.action in ['play', '']: if item.action in ['play', '']:
item.folder = False item.folder = False
# Si el item no contiene fanart, le ponemos el del item padre
if item.fanart == "": if item.fanart == "":
item.fanart = parent_item.fanart item.fanart = parent_item.fanart
# if cloudflare, cookies are needed to display images taken from site # if cloudflare, cookies are needed to display images taken from site
# if scrapertools.get_domain_from_url(item.url) in httptools.domainCF: # before checking domain (time consuming), checking if tmdb failed (so, images scraped from website are used)
# item.thumbnail = httptools.get_url_headers(item.thumbnail) if item.action in ['findvideos', 'play'] and not item.infoLabels['tmdb_id'] and scrapertools.get_domain_from_url(item.thumbnail) in httptools.domainCF:
# item.fanart = httptools.get_url_headers(item.fanart) item.thumbnail = httptools.get_url_headers(item.thumbnail)
item.fanart = httptools.get_url_headers(item.fanart)
icon_image = "DefaultFolder.png" if item.folder else "DefaultVideo.png" icon_image = "DefaultFolder.png" if item.folder else "DefaultVideo.png"
listitem = xbmcgui.ListItem(item.title, offscreen=True) listitem = xbmcgui.ListItem(item.title, offscreen=True)
@@ -178,14 +182,18 @@ def render_items(itemlist, parent_item):
set_infolabels(listitem, item) set_infolabels(listitem, item)
context_commands = set_context_commands(item, parent_item) if parent_item.channel != 'special' else [] if parent_item.channel != 'special':
context_commands = set_context_commands(item, item_url, parent_item, has_extendedinfo=has_extendedinfo,
superfavourites=superfavourites) + def_context_commands
else:
context_commands = def_context_commands
# Añadimos el menu contextual # Añadimos el menu contextual
if config.get_platform(True)['num_version'] >= 17.0 and parent_item.list_type == '': if config.get_platform(True)['num_version'] >= 17.0 and parent_item.list_type == '':
listitem.addContextMenuItems(context_commands) listitem.addContextMenuItems(context_commands)
elif parent_item.list_type == '': elif parent_item.list_type == '':
listitem.addContextMenuItems(context_commands, replaceItems=True) listitem.addContextMenuItems(context_commands, replaceItems=True)
xbmcplugin.addDirectoryItem(_handle, '%s?%s' % (sys.argv[0], item.tourl()), listitem, item.folder) xbmcplugin.addDirectoryItem(_handle, '%s?%s' % (sys.argv[0], item_url), listitem, item.folder)
if parent_item.list_type == '': if parent_item.list_type == '':
breadcrumb = parent_item.category.capitalize() breadcrumb = parent_item.category.capitalize()
@@ -203,7 +211,7 @@ def render_items(itemlist, parent_item):
xbmcplugin.endOfDirectory(_handle) xbmcplugin.endOfDirectory(_handle)
logger.info('END render_items') logger.info('END render_items')
def render_items(itemlist, parent_item): def render_items_old(itemlist, parent_item):
""" """
Función encargada de mostrar el itemlist en kodi, se pasa como parametros el itemlist y el item del que procede Función encargada de mostrar el itemlist en kodi, se pasa como parametros el itemlist y el item del que procede
@type itemlist: list @type itemlist: list
@@ -485,34 +493,39 @@ def set_infolabels(listitem, item, player=False):
'top250': 'top250', 'tracknumber': 'tracknumber', 'trailer': 'trailer', 'thumbnail': 'None', 'top250': 'top250', 'tracknumber': 'tracknumber', 'trailer': 'trailer', 'thumbnail': 'None',
'tvdb_id': 'None', 'tvshowtitle': 'tvshowtitle', 'type': 'None', 'userrating': 'userrating', 'tvdb_id': 'None', 'tvshowtitle': 'tvshowtitle', 'type': 'None', 'userrating': 'userrating',
'url_scraper': 'None', 'votes': 'votes', 'writer': 'writer', 'year': 'year'} 'url_scraper': 'None', 'votes': 'votes', 'writer': 'writer', 'year': 'year'}
infoLabels_kodi = {}
if item.infoLabels: if item.infoLabels:
if 'mediatype' not in item.infoLabels:
item.infoLabels['mediatype'] = item.contentType
try: try:
for label_tag, label_value in list(item.infoLabels.items()): infoLabels_kodi = {infoLabels_dict[label_tag]: item.infoLabels[label_tag] for label_tag, label_value in list(item.infoLabels.items()) if infoLabels_dict[label_tag] != 'None'}
try:
# logger.debug(str(label_tag) + ': ' + str(infoLabels_dict[label_tag]))
if infoLabels_dict[label_tag] != 'None':
infoLabels_kodi.update({infoLabels_dict[label_tag]: item.infoLabels[label_tag]})
except:
continue
listitem.setInfo("video", infoLabels_kodi) listitem.setInfo("video", infoLabels_kodi)
except: except:
listitem.setInfo("video", item.infoLabels) listitem.setInfo("video", item.infoLabels)
logger.error(item.infoLabels) logger.error(item.infoLabels)
logger.error(infoLabels_kodi)
if player and not item.contentTitle: # if item.infoLabels:
listitem.setInfo("video", {"Title": item.title}) # if 'mediatype' not in item.infoLabels:
# item.infoLabels['mediatype'] = item.contentType
elif not player: #
listitem.setInfo("video", {"Title": item.title}) # try:
# for label_tag, label_value in list(item.infoLabels.items()):
# try:
# # logger.debug(str(label_tag) + ': ' + str(infoLabels_dict[label_tag]))
# if infoLabels_dict[label_tag] != 'None':
# infoLabels_kodi.update({infoLabels_dict[label_tag]: item.infoLabels[label_tag]})
# except:
# continue
#
# listitem.setInfo("video", infoLabels_kodi)
#
# except:
# listitem.setInfo("video", item.infoLabels)
# logger.error(item.infoLabels)
# logger.error(infoLabels_kodi)
#
# if player and not item.contentTitle:
# listitem.setInfo("video", {"Title": item.title})
#
# elif not player:
# listitem.setInfo("video", {"Title": item.title})
def set_context_commands(item, item_url, parent_item, **kwargs): def set_context_commands(item, item_url, parent_item, **kwargs):
@@ -546,7 +559,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
@type parent_item: item @type parent_item: item
""" """
context_commands = [] context_commands = []
num_version_xbmc = config.get_platform(True)['num_version'] # num_version_xbmc = config.get_platform(True)['num_version']
# Creamos un list con las diferentes opciones incluidas en item.context # Creamos un list con las diferentes opciones incluidas en item.context
if isinstance(item.context, str): if isinstance(item.context, str):
@@ -626,8 +639,8 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
# Opciones segun criterios, solo si el item no es un tag (etiqueta), ni es "Añadir a la videoteca", etc... # Opciones segun criterios, solo si el item no es un tag (etiqueta), ni es "Añadir a la videoteca", etc...
if item.action and item.action not in ["add_pelicula_to_library", "add_serie_to_library", "buscartrailer", "actualizar_titulos"]: if item.action and item.action not in ["add_pelicula_to_library", "add_serie_to_library", "buscartrailer", "actualizar_titulos"]:
# Mostrar informacion: si el item tiene plot suponemos q es una serie, temporada, capitulo o pelicula # Mostrar informacion: si el item tiene plot suponemos q es una serie, temporada, capitulo o pelicula
if item.infoLabels['plot'] and (num_version_xbmc < 17.0 or item.contentType == 'season'): # if item.infoLabels['plot'] and (num_version_xbmc < 17.0 or item.contentType == 'season'):
context_commands.append((config.get_localized_string(60348), "XBMC.Action(Info)")) # context_commands.append((config.get_localized_string(60348), "XBMC.Action(Info)"))
# ExtendedInfo: Si está instalado el addon y se cumplen una serie de condiciones # ExtendedInfo: Si está instalado el addon y se cumplen una serie de condiciones
if kwargs.get('has_extendedinfo') \ if kwargs.get('has_extendedinfo') \
@@ -668,7 +681,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
# (item.contentTitle and item.infoLabels["year"]) or item.contentSerieName: # (item.contentTitle and item.infoLabels["year"]) or item.contentSerieName:
if item.infoLabels['tmdb_id'] or item.infoLabels['imdb_id'] or item.infoLabels['tvdb_id']: if item.infoLabels['tmdb_id'] or item.infoLabels['imdb_id'] or item.infoLabels['tvdb_id']:
context_commands.append(("InfoPlus", "XBMC.RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, context_commands.append(("InfoPlus", "XBMC.RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url,
urllib.urlencode({'channel': "infoplus", 'action': "start", 'from_channel': item.channel})))) 'channel=infoplus&action=start&from_channel=' + item.channel)))
# Ir al Menu Principal (channel.mainlist) # Ir al Menu Principal (channel.mainlist)
if parent_item.channel not in ["news", "channelselector", "downloads"] and item.action != "mainlist" \ if parent_item.channel not in ["news", "channelselector", "downloads"] and item.action != "mainlist" \
@@ -680,13 +693,11 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
url=item.url).tourl()))) url=item.url).tourl())))
# Añadir a Favoritos # Añadir a Favoritos
if num_version_xbmc < 17.0 and \ # if num_version_xbmc < 17.0 and \
((item.channel not in ["favorites", "videolibrary", "help", ""] # ((item.channel not in ["favorites", "videolibrary", "help", ""]
or item.action in ["update_videolibrary"]) and parent_item.channel != "favorites"): # or item.action in ["update_videolibrary"]) and parent_item.channel != "favorites"):
context_commands.append((config.get_localized_string(30155), "XBMC.RunPlugin(%s?%s&%s)" % # context_commands.append((config.get_localized_string(30155), "XBMC.RunPlugin(%s?%s&%s)" %
(sys.argv[0], item_url, urllib.urlencode({'channel': "favorites", 'action': "addFavourite", # (sys.argv[0], item_url, 'channel=favorites&action=addFavourite&from_channel=' + item.channel + '&from_action=' + item.action)))
'from_channel': item.channel,
'from_action': item.action}))))
# Añadir a Alfavoritos (Mis enlaces) # Añadir a Alfavoritos (Mis enlaces)
if item.channel not in ["favorites", "videolibrary", "help", ""] and parent_item.channel != "favorites": if item.channel not in ["favorites", "videolibrary", "help", ""] and parent_item.channel != "favorites":
@@ -696,7 +707,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
'from_channel': item.channel, 'from_channel': item.channel,
'from_action': item.action})))) 'from_action': item.action}))))
# Buscar en otros canales # Buscar en otros canales
if item.contentType in ['movie', 'tvshow'] and item.channel != 'search' and item.action not in ['play']: if item.contentType in ['movie', 'tvshow'] and item.channel != 'search' and item.action not in ['play'] and parent_item.action != 'mainlist':
# Buscar en otros canales # Buscar en otros canales
if item.contentSerieName != '': if item.contentSerieName != '':
@@ -719,8 +730,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
context_commands.append( context_commands.append(
(config.get_localized_string(70561), "XBMC.Container.Update (%s?%s&%s)" % ( (config.get_localized_string(70561), "XBMC.Container.Update (%s?%s&%s)" % (
sys.argv[0], item_url, urllib.urlencode({'channel': 'search', 'action': 'from_context', 'search_type': 'list', 'page': '1', sys.argv[0], item_url, 'channel=search&action=from_context&search_type=list&page=1&list_type=%s/%s/similar' % (mediatype, item.infoLabels['tmdb_id']))))
'list_type': '%s/%s/similar' % (mediatype, item.infoLabels['tmdb_id'])}))))
# Definir como Pagina de inicio # Definir como Pagina de inicio
if config.get_setting('start_page'): if config.get_setting('start_page'):
if item.action not in ['episodios', 'seasons', 'findvideos', 'play']: if item.action not in ['episodios', 'seasons', 'findvideos', 'play']:
@@ -735,44 +745,33 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
# Añadir Serie a la videoteca # Añadir Serie a la videoteca
if item.action in ["episodios", "get_episodios", "get_seasons"] and item.contentSerieName: if item.action in ["episodios", "get_episodios", "get_seasons"] and item.contentSerieName:
context_commands.append((config.get_localized_string(60352), "XBMC.RunPlugin(%s?%s&%s)" % context_commands.append((config.get_localized_string(60352), "XBMC.RunPlugin(%s?%s&%s)" %
(sys.argv[0], item_url, urllib.urlencode({'action': "add_serie_to_library", (sys.argv[0], item_url, 'action=add_serie_to_library&from_action=' + item.action)))
'from_action': item.action}))))
# Añadir Pelicula a videoteca # Añadir Pelicula a videoteca
elif item.action in ["detail", "findvideos"] and item.contentType == 'movie' and item.contentTitle: elif item.action in ["detail", "findvideos"] and item.contentType == 'movie' and item.contentTitle:
context_commands.append((config.get_localized_string(60353), "XBMC.RunPlugin(%s?%s&%s)" % context_commands.append((config.get_localized_string(60353), "XBMC.RunPlugin(%s?%s&%s)" %
(sys.argv[0], item_url, urllib.urlencode({'action': "add_pelicula_to_library", (sys.argv[0], item_url, 'action=add_pelicula_to_library&from_action=' + item.action)))
'from_action': item.action}))))
if item.channel not in ["downloads", "videolibrary"] and item.server != 'torrent' and config.get_setting('downloadenabled'): if item.channel not in ["downloads", "videolibrary"] and item.server != 'torrent' and parent_item.action != 'mainlist' and config.get_setting('downloadenabled'):
# Descargar pelicula # Descargar pelicula
if item.contentType == "movie": if item.contentType == "movie":
context_commands.append((config.get_localized_string(60354), "XBMC.RunPlugin(%s?%s&%s)" % context_commands.append((config.get_localized_string(60354), "XBMC.RunPlugin(%s?%s&%s)" %
(sys.argv[0], item_url, urllib.urlencode({'channel': "downloads", 'action': "save_download", (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=item.channel&from_action=' + item.action)))
'from_channel': item.channel, 'from_action': item.action}))))
elif item.contentSerieName: elif item.contentSerieName:
# Descargar serie # Descargar serie
if item.contentType == "tvshow": if item.contentType == "tvshow":
context_commands.append((config.get_localized_string(60355), "XBMC.RunPlugin(%s?%s)" % context_commands.append((config.get_localized_string(60355), "XBMC.RunPlugin(%s?%s&%s)" %
(sys.argv[0], urllib.urlencode({'channel': "downloads", 'action': "save_download", (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
'from_channel': item.channel, context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s&%s)" %
'from_action': item.action})))) (sys.argv[0], item_url, 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel + '&from_action=' + item.action)))
context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s)" %
(sys.argv[0], urllib.urlencode({'channel': "downloads", 'action': "save_download", 'download': "seson",
'from_channel': item.channel,
'from_action': item.action}))))
# Descargar episodio # Descargar episodio
elif item.contentType == "episode": elif item.contentType == "episode":
context_commands.append((config.get_localized_string(60356), "XBMC.RunPlugin(%s?%s)" % context_commands.append((config.get_localized_string(60356), "XBMC.RunPlugin(%s?%s&%s)" %
(sys.argv[0], urllib.urlencode({'channel': "downloads", 'action': "save_download", (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
'from_channel': item.channel,
'from_action': item.action}))))
# Descargar temporada # Descargar temporada
elif item.contentType == "season": elif item.contentType == "season":
context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s)" % context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s&%s)" %
(sys.argv[0], urllib.urlencode({'channel': "downloads", 'action': "save_download", (sys.argv[0], item_url, 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel + '&from_action=' + item.action)))
'from_channel': item.channel,
'from_action': item.action}))))
# # Abrir configuración # # Abrir configuración
# if parent_item.channel not in ["setting", "news", "search"] and item.action == "play": # if parent_item.channel not in ["setting", "news", "search"] and item.action == "play":
+1 -1
View File
@@ -400,7 +400,7 @@ if __name__ == "__main__":
# Verificar quick-fixes al abrirse Kodi, y dejarlo corriendo como Thread # Verificar quick-fixes al abrirse Kodi, y dejarlo corriendo como Thread
if not config.dev_mode(): if not config.dev_mode():
updated, needsReload = updater.check() updated, needsReload = updater.check(background=True)
config.set_setting("updater_last_check", str(time.time()), "videolibrary") config.set_setting("updater_last_check", str(time.time()), "videolibrary")
if needsReload: if needsReload:
xbmc.executescript(__file__) xbmc.executescript(__file__)
-3
View File
@@ -10,9 +10,6 @@ from platformcode import config, platformtools
from specials import autoplay from specials import autoplay
from channelselector import get_thumb from channelselector import get_thumb
from specials import shortcuts
CONTEXT = shortcuts.context()
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
try: lang = info_language[config.get_setting("info_language", "videolibrary")] try: lang = info_language[config.get_setting("info_language", "videolibrary")]
except: lang = 'it' except: lang = 'it'
+13 -8
View File
@@ -1,24 +1,29 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from core.item import Item
from platformcode import logger from platformcode import logger
def context(): def context():
from platformcode import config from platformcode import config
context = [] context = []
# original
# if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360).upper(), "XBMC.RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="shortcut_menu").tourl()))
# if config.get_setting('side_menu'): context.append((config.get_localized_string(70737).upper(), "XBMC.RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts',action="side_menu").tourl()))
# if config.get_setting('kod_menu'): context.append((config.get_localized_string(30025), "XBMC.RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="settings_menu").tourl()))
if config.get_setting('quick_menu'): context += [{ 'title': config.get_localized_string(60360).upper(), 'channel': 'shortcuts', 'action': "shortcut_menu"}] # pre-serialised
if config.get_setting('side_menu'): context += [{ 'title': config.get_localized_string(70737).upper(), 'channel': 'shortcuts', 'action': "side_menu"}] if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360).upper(), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaG9ydGN1dF9tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)'))
if config.get_setting('kod_menu'): context += [{ 'title': config.get_localized_string(30025), 'channel': 'shortcuts', 'action': "settings_menu"}] if config.get_setting('side_menu'): context.append((config.get_localized_string(70737).upper(), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaWRlX21lbnUiLCAKICAgICJjaGFubmVsIjogInNob3J0Y3V0cyIsIAogICAgImluZm9MYWJlbHMiOiB7fQp9)'))
if config.get_setting('kod_menu'): context.append((config.get_localized_string(30025), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzZXR0aW5nc19tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)'))
return context return context
def side_menu(item): def side_menu(item):
from specials import side_menu from specials import side_menu
side_menu.open_menu(item) side_menu.open_menu(item)
def shortcut_menu(item): def shortcut_menu(item):
from platformcode import keymaptools from platformcode import keymaptools
keymaptools.open_shortcut_menu() keymaptools.open_shortcut_menu()
def settings_menu(item): def settings_menu(item):
from platformcode import config from platformcode import config