nuovo render_items, changelog solo all'apertura di kod
This commit is contained in:
@@ -12,9 +12,6 @@ import xbmcaddon
|
||||
addon = xbmcaddon.Addon('plugin.video.kod')
|
||||
downloadenabled = addon.getSetting('downloadenabled')
|
||||
|
||||
from specials import shortcuts
|
||||
CONTEXT = shortcuts.context()
|
||||
|
||||
def getmainlist(view="thumb_"):
|
||||
logger.info()
|
||||
itemlist = list()
|
||||
@@ -22,8 +19,7 @@ def getmainlist(view="thumb_"):
|
||||
if config.dev_mode():
|
||||
itemlist.append(Item(title="Redirect", channel="checkhost", action="check_channels",
|
||||
thumbnail='',
|
||||
category=config.get_localized_string(30119), viewmode="thumbnails",
|
||||
context = CONTEXT))
|
||||
category=config.get_localized_string(30119), viewmode="thumbnails"))
|
||||
# Añade los canales que forman el menú principal
|
||||
if addon.getSetting('enable_news_menu') == "true":
|
||||
# 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",
|
||||
thumbnail=get_thumb("news.png", view),
|
||||
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":
|
||||
itemlist.append(Item(title=config.get_localized_string(30118), channel="channelselector", action="getchanneltypes",
|
||||
thumbnail=get_thumb("channels.png", view), view=view,
|
||||
category=config.get_localized_string(30119), viewmode="thumbnails",
|
||||
context = CONTEXT))
|
||||
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",
|
||||
@@ -50,25 +45,22 @@ def getmainlist(view="thumb_"):
|
||||
itemlist.append(Item(title=config.get_localized_string(30103), channel="search", path='special', action="mainlist",
|
||||
thumbnail=get_thumb("search.png", view),
|
||||
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}]))
|
||||
|
||||
if addon.getSetting('enable_onair_menu') == "true":
|
||||
itemlist.append(Item(channel="filmontv", action="mainlist", title=config.get_localized_string(50001),
|
||||
thumbnail=get_thumb("on_the_air.png"), viewmode="thumbnails",
|
||||
context = CONTEXT))
|
||||
thumbnail=get_thumb("on_the_air.png"), 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", view), view=view,
|
||||
category=config.get_localized_string(70527), viewmode="thumbnails",
|
||||
context = CONTEXT))
|
||||
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", view),
|
||||
category=config.get_localized_string(30102), viewmode="thumbnails",
|
||||
context = CONTEXT))
|
||||
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",
|
||||
@@ -79,7 +71,7 @@ def getmainlist(view="thumb_"):
|
||||
itemlist.append(Item(title=config.get_localized_string(30131), channel="videolibrary", action="mainlist",
|
||||
thumbnail=get_thumb("videolibrary.png", view),
|
||||
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"}]))
|
||||
if downloadenabled != "false":
|
||||
# itemlist.append(Item(title=config.get_localized_string(30101), channel="downloads", action="mainlist",
|
||||
@@ -88,7 +80,7 @@ def getmainlist(view="thumb_"):
|
||||
# "action": "channel_config"}]))
|
||||
itemlist.append(Item(title=config.get_localized_string(30101), channel="downloads", action="mainlist",
|
||||
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")
|
||||
|
||||
@@ -122,13 +114,13 @@ def getchanneltypes(view="thumb_"):
|
||||
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("channels_all.png", view),
|
||||
viewmode="thumbnails", context = CONTEXT))
|
||||
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("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,
|
||||
# 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,
|
||||
category=config.get_localized_string(70685), channel_type="all", thumbnail=get_thumb("channels_community.png", view),
|
||||
viewmode="thumbnails", context = CONTEXT))
|
||||
viewmode="thumbnails"))
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -244,7 +236,7 @@ def filterchannels(category, view="thumb_"):
|
||||
channelslist.append(Item(title=channel_parameters["title"], channel=channel_parameters["channel"],
|
||||
action="mainlist", thumbnail=channel_parameters["thumbnail"],
|
||||
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:
|
||||
logger.error("Se ha producido un error al leer los datos del canal '%s'" % channel)
|
||||
|
||||
@@ -26,9 +26,7 @@ from core import httptools, scrapertools, servertools, tmdb, channeltools
|
||||
from core.item import Item
|
||||
from lib import unshortenit
|
||||
from platformcode import logger, config
|
||||
from specials import autoplay, shortcuts
|
||||
|
||||
CONTEXT =shortcuts.context()
|
||||
from specials import autoplay
|
||||
|
||||
def hdpass_get_servers(item):
|
||||
def get_hosts(url, quality):
|
||||
@@ -306,8 +304,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
|
||||
contentLanguage = lang1,
|
||||
contentEpisodeNumber=episode if episode else '',
|
||||
news= item.news if item.news else '',
|
||||
other = scraped['other'] if scraped['other'] else '',
|
||||
context = CONTEXT
|
||||
other = scraped['other'] if scraped['other'] else ''
|
||||
)
|
||||
|
||||
# for lg in list(set(listGroups).difference(known_keys)):
|
||||
@@ -629,8 +626,7 @@ def menuItem(itemlist, filename, title='', action='', url='', contentType='movie
|
||||
url = url,
|
||||
extra = extra,
|
||||
args = args,
|
||||
contentType = contentType,
|
||||
context = CONTEXT
|
||||
contentType = contentType
|
||||
))
|
||||
|
||||
# Apply auto Thumbnails at the menus
|
||||
|
||||
@@ -14,10 +14,6 @@ logger.info("init...")
|
||||
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
|
||||
sys.path.insert(0, librerias)
|
||||
|
||||
if not config.dev_mode():
|
||||
from platformcode import updater
|
||||
updater.showSavedChangelog()
|
||||
|
||||
from platformcode import launcher
|
||||
|
||||
if sys.argv[2] == "":
|
||||
|
||||
@@ -41,6 +41,10 @@ def start():
|
||||
from specials.checkhost import test_conn
|
||||
import threading
|
||||
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):
|
||||
logger.info()
|
||||
|
||||
@@ -135,39 +135,43 @@ def render_items(itemlist, parent_item):
|
||||
"""
|
||||
logger.info('START render_items')
|
||||
from specials import shortcuts
|
||||
from core import httptools
|
||||
_handle = int(sys.argv[1])
|
||||
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 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
|
||||
item_url = item.tourl()
|
||||
|
||||
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)
|
||||
# before checking domain (time consuming), checking if tmdb failed (so, images scraped from website are used)
|
||||
if item.action in ['findvideos', 'play'] and not item.infoLabels['tmdb_id'] and scrapertools.get_domain_from_url(item.thumbnail) 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)
|
||||
@@ -178,14 +182,18 @@ def render_items(itemlist, parent_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
|
||||
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)
|
||||
xbmcplugin.addDirectoryItem(_handle, '%s?%s' % (sys.argv[0], item_url), listitem, item.folder)
|
||||
|
||||
if parent_item.list_type == '':
|
||||
breadcrumb = parent_item.category.capitalize()
|
||||
@@ -203,7 +211,7 @@ def render_items(itemlist, parent_item):
|
||||
xbmcplugin.endOfDirectory(_handle)
|
||||
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
|
||||
@type itemlist: list
|
||||
@@ -485,34 +493,39 @@ def set_infolabels(listitem, item, player=False):
|
||||
'top250': 'top250', 'tracknumber': 'tracknumber', 'trailer': 'trailer', 'thumbnail': 'None',
|
||||
'tvdb_id': 'None', 'tvshowtitle': 'tvshowtitle', 'type': 'None', 'userrating': 'userrating',
|
||||
'url_scraper': 'None', 'votes': 'votes', 'writer': 'writer', 'year': 'year'}
|
||||
|
||||
infoLabels_kodi = {}
|
||||
|
||||
if item.infoLabels:
|
||||
if 'mediatype' not in item.infoLabels:
|
||||
item.infoLabels['mediatype'] = item.contentType
|
||||
|
||||
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
|
||||
|
||||
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'}
|
||||
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})
|
||||
# if item.infoLabels:
|
||||
# if 'mediatype' not in item.infoLabels:
|
||||
# item.infoLabels['mediatype'] = item.contentType
|
||||
#
|
||||
# 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):
|
||||
@@ -546,7 +559,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
@type parent_item: item
|
||||
"""
|
||||
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
|
||||
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...
|
||||
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
|
||||
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)"))
|
||||
# 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)"))
|
||||
|
||||
# ExtendedInfo: Si está instalado el addon y se cumplen una serie de condiciones
|
||||
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:
|
||||
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,
|
||||
urllib.urlencode({'channel': "infoplus", 'action': "start", 'from_channel': item.channel}))))
|
||||
'channel=infoplus&action=start&from_channel=' + item.channel)))
|
||||
|
||||
# Ir al Menu Principal (channel.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())))
|
||||
|
||||
# Añadir a Favoritos
|
||||
if num_version_xbmc < 17.0 and \
|
||||
((item.channel not in ["favorites", "videolibrary", "help", ""]
|
||||
or item.action in ["update_videolibrary"]) and parent_item.channel != "favorites"):
|
||||
context_commands.append((config.get_localized_string(30155), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||
(sys.argv[0], item_url, urllib.urlencode({'channel': "favorites", 'action': "addFavourite",
|
||||
'from_channel': item.channel,
|
||||
'from_action': item.action}))))
|
||||
# if num_version_xbmc < 17.0 and \
|
||||
# ((item.channel not in ["favorites", "videolibrary", "help", ""]
|
||||
# or item.action in ["update_videolibrary"]) and parent_item.channel != "favorites"):
|
||||
# context_commands.append((config.get_localized_string(30155), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||
# (sys.argv[0], item_url, 'channel=favorites&action=addFavourite&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||
|
||||
# Añadir a Alfavoritos (Mis enlaces)
|
||||
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_action': item.action}))))
|
||||
# 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
|
||||
if item.contentSerieName != '':
|
||||
@@ -719,8 +730,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
|
||||
context_commands.append(
|
||||
(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',
|
||||
'list_type': '%s/%s/similar' % (mediatype, item.infoLabels['tmdb_id'])}))))
|
||||
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']))))
|
||||
# Definir como Pagina de inicio
|
||||
if config.get_setting('start_page'):
|
||||
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
|
||||
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)" %
|
||||
(sys.argv[0], item_url, urllib.urlencode({'action': "add_serie_to_library",
|
||||
'from_action': item.action}))))
|
||||
(sys.argv[0], item_url, 'action=add_serie_to_library&from_action=' + item.action)))
|
||||
# Añadir Pelicula a videoteca
|
||||
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)" %
|
||||
(sys.argv[0], item_url, urllib.urlencode({'action': "add_pelicula_to_library",
|
||||
'from_action': item.action}))))
|
||||
(sys.argv[0], item_url, 'action=add_pelicula_to_library&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
|
||||
if item.contentType == "movie":
|
||||
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",
|
||||
'from_channel': item.channel, 'from_action': item.action}))))
|
||||
(sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=item.channel&from_action=' + item.action)))
|
||||
|
||||
elif item.contentSerieName:
|
||||
# Descargar serie
|
||||
if item.contentType == "tvshow":
|
||||
context_commands.append((config.get_localized_string(60355), "XBMC.RunPlugin(%s?%s)" %
|
||||
(sys.argv[0], urllib.urlencode({'channel': "downloads", 'action': "save_download",
|
||||
'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}))))
|
||||
context_commands.append((config.get_localized_string(60355), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||
(sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||
context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||
(sys.argv[0], item_url, 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||
# Descargar episodio
|
||||
elif item.contentType == "episode":
|
||||
context_commands.append((config.get_localized_string(60356), "XBMC.RunPlugin(%s?%s)" %
|
||||
(sys.argv[0], urllib.urlencode({'channel': "downloads", 'action': "save_download",
|
||||
'from_channel': item.channel,
|
||||
'from_action': item.action}))))
|
||||
context_commands.append((config.get_localized_string(60356), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||
(sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||
# Descargar temporada
|
||||
elif item.contentType == "season":
|
||||
context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s)" %
|
||||
(sys.argv[0], urllib.urlencode({'channel': "downloads", 'action': "save_download",
|
||||
'from_channel': item.channel,
|
||||
'from_action': item.action}))))
|
||||
context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||
(sys.argv[0], item_url, 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||
|
||||
# # Abrir configuración
|
||||
# if parent_item.channel not in ["setting", "news", "search"] and item.action == "play":
|
||||
|
||||
@@ -400,7 +400,7 @@ if __name__ == "__main__":
|
||||
|
||||
# Verificar quick-fixes al abrirse Kodi, y dejarlo corriendo como Thread
|
||||
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")
|
||||
if needsReload:
|
||||
xbmc.executescript(__file__)
|
||||
|
||||
@@ -10,9 +10,6 @@ from platformcode import config, platformtools
|
||||
from specials import autoplay
|
||||
from channelselector import get_thumb
|
||||
|
||||
from specials import shortcuts
|
||||
CONTEXT = shortcuts.context()
|
||||
|
||||
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
|
||||
try: lang = info_language[config.get_setting("info_language", "videolibrary")]
|
||||
except: lang = 'it'
|
||||
|
||||
@@ -1,24 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from core.item import Item
|
||||
from platformcode import logger
|
||||
|
||||
def context():
|
||||
from platformcode import config
|
||||
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"}]
|
||||
if config.get_setting('side_menu'): context += [{ 'title': config.get_localized_string(70737).upper(), 'channel': 'shortcuts', 'action': "side_menu"}]
|
||||
if config.get_setting('kod_menu'): context += [{ 'title': config.get_localized_string(30025), 'channel': 'shortcuts', 'action': "settings_menu"}]
|
||||
# pre-serialised
|
||||
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('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
|
||||
|
||||
def side_menu(item):
|
||||
from specials import side_menu
|
||||
side_menu.open_menu(item)
|
||||
from specials import side_menu
|
||||
side_menu.open_menu(item)
|
||||
|
||||
def shortcut_menu(item):
|
||||
from platformcode import keymaptools
|
||||
keymaptools.open_shortcut_menu()
|
||||
from platformcode import keymaptools
|
||||
keymaptools.open_shortcut_menu()
|
||||
|
||||
def settings_menu(item):
|
||||
from platformcode import config
|
||||
|
||||
Reference in New Issue
Block a user