test render_items
This commit is contained in:
@@ -47,8 +47,13 @@ def run(item=None):
|
|||||||
if not item:
|
if not item:
|
||||||
# Extract item from sys.argv
|
# Extract item from sys.argv
|
||||||
if sys.argv[2]:
|
if sys.argv[2]:
|
||||||
item = Item().fromurl(sys.argv[2])
|
sp = sys.argv[2].split('&')
|
||||||
|
url = sp[0]
|
||||||
|
item = Item().fromurl(url)
|
||||||
|
if len(sp) > 1:
|
||||||
|
for e in sp[1:]:
|
||||||
|
key, val = e.split('=')
|
||||||
|
item.__setattr__(key, val)
|
||||||
# If no item, this is mainlist
|
# If no item, this is mainlist
|
||||||
else:
|
else:
|
||||||
if config.get_setting("start_page"):
|
if config.get_setting("start_page"):
|
||||||
|
|||||||
+137
-64
@@ -129,6 +129,80 @@ def itemlist_update(item, replace=False):
|
|||||||
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")")
|
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")")
|
||||||
|
|
||||||
|
|
||||||
|
def render_items(itemlist, parent_item):
|
||||||
|
"""
|
||||||
|
Function used to render itemlist on kodi
|
||||||
|
"""
|
||||||
|
logger.info('START render_items')
|
||||||
|
from specials import shortcuts
|
||||||
|
_handle = int(sys.argv[1])
|
||||||
|
default_fanart = config.get_fanart()
|
||||||
|
context_commands = shortcuts.context()
|
||||||
|
|
||||||
|
# if it's not a list, do nothing
|
||||||
|
if not isinstance(itemlist, list):
|
||||||
|
return
|
||||||
|
|
||||||
|
# if there's no item, add "no elements" item
|
||||||
|
if not len(itemlist):
|
||||||
|
itemlist.append(Item(title=config.get_localized_string(60347)))
|
||||||
|
|
||||||
|
for item in itemlist:
|
||||||
|
# Si el item no contiene categoria, le ponemos la del item padre
|
||||||
|
if item.category == "":
|
||||||
|
item.category = parent_item.category
|
||||||
|
|
||||||
|
# Si title no existe, lo iniciamos como str, para evitar errones "NoType"
|
||||||
|
if not item.title:
|
||||||
|
item.title = ''
|
||||||
|
|
||||||
|
# Si no hay action o es findvideos/play, folder=False porque no se va a devolver ningún listado
|
||||||
|
if item.action in ['play', '']:
|
||||||
|
item.folder = False
|
||||||
|
|
||||||
|
# Si el item no contiene fanart, le ponemos el del item padre
|
||||||
|
if item.fanart == "":
|
||||||
|
item.fanart = parent_item.fanart
|
||||||
|
|
||||||
|
# if cloudflare, cookies are needed to display images taken from site
|
||||||
|
# if scrapertools.get_domain_from_url(item.url) in httptools.domainCF:
|
||||||
|
# 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"
|
||||||
|
listitem = xbmcgui.ListItem(item.title, offscreen=True)
|
||||||
|
listitem.setArt({'icon': icon_image, 'thumb': item.thumbnail, 'poster': item.thumbnail,
|
||||||
|
'fanart': item.fanart if item.fanart else default_fanart})
|
||||||
|
if config.get_setting("player_mode") == 1 and item.action == "play":
|
||||||
|
listitem.setProperty('IsPlayable', 'true')
|
||||||
|
|
||||||
|
set_infolabels(listitem, item)
|
||||||
|
|
||||||
|
context_commands = set_context_commands(item, parent_item) if parent_item.channel != 'special' else []
|
||||||
|
# Añadimos el menu contextual
|
||||||
|
if config.get_platform(True)['num_version'] >= 17.0 and parent_item.list_type == '':
|
||||||
|
listitem.addContextMenuItems(context_commands)
|
||||||
|
elif parent_item.list_type == '':
|
||||||
|
listitem.addContextMenuItems(context_commands, replaceItems=True)
|
||||||
|
|
||||||
|
xbmcplugin.addDirectoryItem(_handle, '%s?%s' % (sys.argv[0], item.tourl()), listitem, item.folder)
|
||||||
|
|
||||||
|
if parent_item.list_type == '':
|
||||||
|
breadcrumb = parent_item.category.capitalize()
|
||||||
|
else:
|
||||||
|
if 'similar' in parent_item.list_type:
|
||||||
|
if parent_item.contentTitle != '':
|
||||||
|
breadcrumb = config.get_localized_string(70693) + parent_item.contentTitle
|
||||||
|
else:
|
||||||
|
breadcrumb = config.get_localized_string(70693) + parent_item.contentSerieName
|
||||||
|
else:
|
||||||
|
breadcrumb = config.get_localized_string(70693)
|
||||||
|
|
||||||
|
xbmcplugin.setPluginCategory(handle=_handle, category=breadcrumb)
|
||||||
|
xbmcplugin.setContent(handle=_handle, content=breadcrumb)
|
||||||
|
xbmcplugin.endOfDirectory(_handle)
|
||||||
|
logger.info('END render_items')
|
||||||
|
|
||||||
def render_items(itemlist, parent_item):
|
def render_items(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
|
||||||
@@ -166,7 +240,14 @@ def render_items(itemlist, parent_item):
|
|||||||
# except:
|
# except:
|
||||||
force_unify = False
|
force_unify = False
|
||||||
|
|
||||||
unify_enabled = config.get_setting('unify')
|
unify_enabled = False
|
||||||
|
|
||||||
|
has_extendedinfo = xbmc.getCondVisibility('System.HasAddon(script.extendedinfo)')
|
||||||
|
|
||||||
|
# Añadir SuperFavourites al menu contextual (1.0.53 o superior necesario)
|
||||||
|
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")')
|
||||||
# try:
|
# try:
|
||||||
# if channeltools.get_channel_parameters(parent_item.channel)['adult']:
|
# if channeltools.get_channel_parameters(parent_item.channel)['adult']:
|
||||||
# unify_enabled = False
|
# unify_enabled = False
|
||||||
@@ -178,6 +259,7 @@ def render_items(itemlist, parent_item):
|
|||||||
for item in itemlist:
|
for item in itemlist:
|
||||||
# logger.debug(item)
|
# logger.debug(item)
|
||||||
# Si el item no contiene categoria, le ponemos la del item padre
|
# 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
|
||||||
|
|
||||||
@@ -270,7 +352,7 @@ def render_items(itemlist, parent_item):
|
|||||||
|
|
||||||
# Montamos el menu contextual
|
# Montamos el menu contextual
|
||||||
if parent_item.channel != 'special':
|
if parent_item.channel != 'special':
|
||||||
context_commands = set_context_commands(item, parent_item)
|
context_commands = set_context_commands(item, item_url, parent_item, has_extendedinfo=has_extendedinfo, superfavourites=superfavourites)
|
||||||
else:
|
else:
|
||||||
context_commands = []
|
context_commands = []
|
||||||
# Añadimos el menu contextual
|
# Añadimos el menu contextual
|
||||||
@@ -284,7 +366,7 @@ def render_items(itemlist, parent_item):
|
|||||||
|
|
||||||
if not item.totalItems:
|
if not item.totalItems:
|
||||||
item.totalItems = 0
|
item.totalItems = 0
|
||||||
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url='%s?%s' % (sys.argv[0], item.tourl()),
|
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url='%s?%s' % (sys.argv[0], item_url),
|
||||||
listitem=listitem, isFolder=item.folder,
|
listitem=listitem, isFolder=item.folder,
|
||||||
totalItems=item.totalItems)
|
totalItems=item.totalItems)
|
||||||
|
|
||||||
@@ -433,7 +515,7 @@ def set_infolabels(listitem, item, player=False):
|
|||||||
listitem.setInfo("video", {"Title": item.title})
|
listitem.setInfo("video", {"Title": item.title})
|
||||||
|
|
||||||
|
|
||||||
def set_context_commands(item, parent_item):
|
def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||||
"""
|
"""
|
||||||
Función para generar los menus contextuales.
|
Función para generar los menus contextuales.
|
||||||
1. Partiendo de los datos de item.context
|
1. Partiendo de los datos de item.context
|
||||||
@@ -487,7 +569,7 @@ def set_context_commands(item, parent_item):
|
|||||||
# if itemBK.infoLabels["tvdb_id"]: infoLabels["tvdb_id"] = itemBK.infoLabels["tvdb_id"]
|
# if itemBK.infoLabels["tvdb_id"]: infoLabels["tvdb_id"] = itemBK.infoLabels["tvdb_id"]
|
||||||
# if itemBK.infoLabels["noscrap_id"]: infoLabels["noscrap_id"] = itemBK.infoLabels["noscrap_id"]
|
# if itemBK.infoLabels["noscrap_id"]: infoLabels["noscrap_id"] = itemBK.infoLabels["noscrap_id"]
|
||||||
# if len(infoLabels) > 0: item.infoLabels = infoLabels
|
# if len(infoLabels) > 0: item.infoLabels = infoLabels
|
||||||
|
#
|
||||||
# if itemBK.thumbnail: item.thumbnail = itemBK.thumbnail
|
# if itemBK.thumbnail: item.thumbnail = itemBK.thumbnail
|
||||||
# if itemBK.extra: item.extra = itemBK.extra
|
# if itemBK.extra: item.extra = itemBK.extra
|
||||||
# if itemBK.contentEpisodeNumber: item.contentEpisodeNumber = itemBK.contentEpisodeNumber
|
# if itemBK.contentEpisodeNumber: item.contentEpisodeNumber = itemBK.contentEpisodeNumber
|
||||||
@@ -541,15 +623,14 @@ def set_context_commands(item, parent_item):
|
|||||||
# No añadir más opciones predefinidas si se está dentro de Alfavoritos
|
# No añadir más opciones predefinidas si se está dentro de Alfavoritos
|
||||||
if parent_item.channel == 'kodfavorites':
|
if parent_item.channel == 'kodfavorites':
|
||||||
return context_commands
|
return context_commands
|
||||||
|
# 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 xbmc.getCondVisibility('System.HasAddon(script.extendedinfo)') \
|
if kwargs.get('has_extendedinfo') \
|
||||||
and config.get_setting("extended_info") == True:
|
and config.get_setting("extended_info") == True:
|
||||||
if item.contentType == "episode" and item.contentEpisodeNumber and item.contentSeason \
|
if item.contentType == "episode" and item.contentEpisodeNumber and item.contentSeason \
|
||||||
and (item.infoLabels['tmdb_id'] or item.contentSerieName):
|
and (item.infoLabels['tmdb_id'] or item.contentSerieName):
|
||||||
@@ -581,20 +662,19 @@ def set_context_commands(item, parent_item):
|
|||||||
|
|
||||||
context_commands.append(("ExtendedInfo",
|
context_commands.append(("ExtendedInfo",
|
||||||
"XBMC.RunScript(script.extendedinfo,info=extendedinfo,%s)" % param))
|
"XBMC.RunScript(script.extendedinfo,info=extendedinfo,%s)" % param))
|
||||||
|
# InfoPlus
|
||||||
# InfoPlus
|
|
||||||
if config.get_setting("infoplus"):
|
if config.get_setting("infoplus"):
|
||||||
#if item.infoLabels['tmdb_id'] or item.infoLabels['imdb_id'] or item.infoLabels['tvdb_id'] or \
|
#if item.infoLabels['tmdb_id'] or item.infoLabels['imdb_id'] or item.infoLabels['tvdb_id'] or \
|
||||||
# (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)" % (sys.argv[0], item.clone(
|
context_commands.append(("InfoPlus", "XBMC.RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url,
|
||||||
channel="infoplus", action="start", from_channel=item.channel).tourl())))
|
urllib.urlencode({'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" \
|
||||||
and parent_item.action != "mainlist":
|
and parent_item.action != "mainlist":
|
||||||
context_commands.insert(0, (config.get_localized_string(60349), "XBMC.Container.Refresh (%s?%s)" %
|
context_commands.insert(0, (config.get_localized_string(60349), "XBMC.Container.Refresh (%s?%s)" %
|
||||||
(sys.argv[0], Item(channel=item.channel, action="mainlist").tourl())))
|
(sys.argv[0], Item(channel=item.channel, action="mainlist").tourl())))
|
||||||
context_commands.insert(1, (config.get_localized_string(70739),
|
context_commands.insert(1, (config.get_localized_string(70739),
|
||||||
"XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(action="open_browser",
|
"XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(action="open_browser",
|
||||||
url=item.url).tourl())))
|
url=item.url).tourl())))
|
||||||
@@ -603,20 +683,19 @@ def set_context_commands(item, parent_item):
|
|||||||
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)" %
|
context_commands.append((config.get_localized_string(30155), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||||
(sys.argv[0], item.clone(channel="favorites", action="addFavourite",
|
(sys.argv[0], item_url, urllib.urlencode({'channel': "favorites", 'action': "addFavourite",
|
||||||
from_channel=item.channel,
|
'from_channel': item.channel,
|
||||||
from_action=item.action).tourl())))
|
'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":
|
||||||
context_commands.append(
|
context_commands.append(
|
||||||
(config.get_localized_string(70557), "XBMC.RunPlugin(%s?%s)" %
|
(config.get_localized_string(70557), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||||
(sys.argv[0], item.clone(channel="kodfavourites", action="addFavourite",
|
(sys.argv[0], item_url, urllib.urlencode({'channel': "kodfavourites", 'action': "addFavourite",
|
||||||
from_channel=item.channel,
|
'from_channel': item.channel,
|
||||||
from_action=item.action).tourl())))
|
'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']:
|
||||||
|
|
||||||
# Buscar en otros canales
|
# Buscar en otros canales
|
||||||
@@ -631,20 +710,18 @@ def set_context_commands(item, parent_item):
|
|||||||
mediatype = item.contentType
|
mediatype = item.contentType
|
||||||
|
|
||||||
context_commands.append((config.get_localized_string(60350),
|
context_commands.append((config.get_localized_string(60350),
|
||||||
"XBMC.Container.Update (%s?%s)" % (sys.argv[0],
|
"XBMC.Container.Update (%s?%s&%s)" % (sys.argv[0],
|
||||||
item.clone(channel='search',
|
item_url, urllib.urlencode({'channel': 'search',
|
||||||
action="from_context",
|
'action': "from_context",
|
||||||
from_channel=item.channel,
|
'from_channel': item.channel,
|
||||||
contextual=True,
|
'contextual': True,
|
||||||
text=item.wanted).tourl())))
|
'text': item.wanted}))))
|
||||||
|
|
||||||
context_commands.append(
|
context_commands.append(
|
||||||
(config.get_localized_string(70561), "XBMC.Container.Update (%s?%s)" % (
|
(config.get_localized_string(70561), "XBMC.Container.Update (%s?%s&%s)" % (
|
||||||
sys.argv[0], item.clone(channel='search', action='from_context', search_type='list', page='1',
|
sys.argv[0], item_url, urllib.urlencode({'channel': 'search', 'action': 'from_context', 'search_type': 'list', 'page': '1',
|
||||||
list_type='%s/%s/similar' % (
|
'list_type': '%s/%s/similar' % (mediatype, item.infoLabels['tmdb_id'])}))))
|
||||||
mediatype, item.infoLabels['tmdb_id'])).tourl())))
|
# 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']:
|
||||||
context_commands.insert(0, (config.get_localized_string(60351),
|
context_commands.insert(0, (config.get_localized_string(60351),
|
||||||
@@ -657,46 +734,45 @@ def set_context_commands(item, parent_item):
|
|||||||
or (item.channel != "videolibrary" and config.get_localized_string(70585) in str(item.context) and config.get_localized_string(70714) in str(item.context)):
|
or (item.channel != "videolibrary" and config.get_localized_string(70585) in str(item.context) and config.get_localized_string(70714) in str(item.context)):
|
||||||
# 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)" %
|
context_commands.append((config.get_localized_string(60352), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||||
(sys.argv[0], item.clone(action="add_serie_to_library",
|
(sys.argv[0], item_url, urllib.urlencode({'action': "add_serie_to_library",
|
||||||
from_action=item.action).tourl())))
|
'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)" %
|
context_commands.append((config.get_localized_string(60353), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||||
(sys.argv[0], item.clone(action="add_pelicula_to_library",
|
(sys.argv[0], item_url, urllib.urlencode({'action': "add_pelicula_to_library",
|
||||||
from_action=item.action).tourl())))
|
'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 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)" %
|
context_commands.append((config.get_localized_string(60354), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||||
(sys.argv[0], item.clone(channel="downloads", action="save_download",
|
(sys.argv[0], item_url, urllib.urlencode({'channel': "downloads", 'action': "save_download",
|
||||||
from_channel=item.channel, from_action=item.action)
|
'from_channel': item.channel, 'from_action': item.action}))))
|
||||||
.tourl())))
|
|
||||||
|
|
||||||
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)" %
|
||||||
(sys.argv[0], item.clone(channel="downloads", action="save_download",
|
(sys.argv[0], urllib.urlencode({'channel': "downloads", 'action': "save_download",
|
||||||
from_channel=item.channel,
|
'from_channel': item.channel,
|
||||||
from_action=item.action).tourl())))
|
'from_action': item.action}))))
|
||||||
context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s)" %
|
context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s)" %
|
||||||
(sys.argv[0], item.clone(channel="downloads", action="save_download", download="seson",
|
(sys.argv[0], urllib.urlencode({'channel': "downloads", 'action': "save_download", 'download': "seson",
|
||||||
from_channel=item.channel,
|
'from_channel': item.channel,
|
||||||
from_action=item.action).tourl())))
|
'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)" %
|
||||||
(sys.argv[0], item.clone(channel="downloads", action="save_download",
|
(sys.argv[0], urllib.urlencode({'channel': "downloads", 'action': "save_download",
|
||||||
from_channel=item.channel,
|
'from_channel': item.channel,
|
||||||
from_action=item.action).tourl())))
|
'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)" %
|
||||||
(sys.argv[0], item.clone(channel="downloads", action="save_download",
|
(sys.argv[0], urllib.urlencode({'channel': "downloads", 'action': "save_download",
|
||||||
from_channel=item.channel,
|
'from_channel': item.channel,
|
||||||
from_action=item.action).tourl())))
|
'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":
|
||||||
@@ -706,14 +782,11 @@ def set_context_commands(item, parent_item):
|
|||||||
# Buscar Trailer
|
# Buscar Trailer
|
||||||
if item.action == "findvideos" or "buscar_trailer" in context:
|
if item.action == "findvideos" or "buscar_trailer" in context:
|
||||||
context_commands.append(
|
context_commands.append(
|
||||||
(config.get_localized_string(60359), "XBMC.RunPlugin(%s?%s)" % (sys.argv[0], item.clone(
|
(config.get_localized_string(60359), "XBMC.RunPlugin(%s?%s)" % (sys.argv[0], urllib.urlencode({
|
||||||
channel="trailertools", action="buscartrailer", contextual=True).tourl())))
|
'channel': "trailertools", 'action': "buscartrailer", 'contextual': True}))))
|
||||||
|
|
||||||
# Añadir SuperFavourites al menu contextual (1.0.53 o superior necesario)
|
if kwargs.get('superfavourites'):
|
||||||
sf_file_path = xbmc.translatePath("special://home/addons/plugin.program.super.favourites/LaunchSFMenu.py")
|
context_commands.append((config.get_localized_string(60361),
|
||||||
check_sf = os.path.exists(sf_file_path)
|
|
||||||
if check_sf and xbmc.getCondVisibility('System.HasAddon("plugin.program.super.favourites")'):
|
|
||||||
context_commands.append((config.get_localized_string(60361),
|
|
||||||
"XBMC.RunScript(special://home/addons/plugin.program.super.favourites/LaunchSFMenu.py)"))
|
"XBMC.RunScript(special://home/addons/plugin.program.super.favourites/LaunchSFMenu.py)"))
|
||||||
|
|
||||||
# context_commands = sorted(context_commands, key=lambda comand: comand[0])
|
# context_commands = sorted(context_commands, key=lambda comand: comand[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user