diff --git a/channelselector.py b/channelselector.py index b723288d..03b51bf5 100644 --- a/channelselector.py +++ b/channelselector.py @@ -2,6 +2,7 @@ import glob import os +import sys from core import channeltools from core.item import Item @@ -11,6 +12,8 @@ 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() @@ -19,49 +22,55 @@ 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")) + category=config.get_localized_string(30119), viewmode="thumbnails", + context = CONTEXT)) # 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", thumbnail=get_thumb("news.png", view), category=config.get_localized_string(30119), viewmode="thumbnails", - context=[{"title": config.get_localized_string(70285), "channel": "news", "action": "menu_opciones", - "goto": True}])) + context=CONTEXT + [{"title": config.get_localized_string(70285), "channel": "news", "action": "menu_opciones","goto": True}])) 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")) + category=config.get_localized_string(30119), viewmode="thumbnails", + context = CONTEXT)) 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", 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"}, + {"title": config.get_localized_string(70286), "action": "settings", "channel": "search"}])) 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")) + thumbnail=get_thumb("on_the_air.png"), viewmode="thumbnails", + context = CONTEXT)) 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")) + category=config.get_localized_string(70527), viewmode="thumbnails", + context = CONTEXT)) 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")) + category=config.get_localized_string(30102), viewmode="thumbnails", + context = CONTEXT)) 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", view), category=config.get_localized_string(30119), viewmode="thumbnails", - context=[{"title": config.get_localized_string(70287), "channel": "videolibrary", + context=CONTEXT + [{"title": config.get_localized_string(70287), "channel": "videolibrary", "action": "channel_config"}])) if downloadenabled != "false": itemlist.append(Item(title=config.get_localized_string(30101), channel="downloads", action="mainlist", thumbnail=get_thumb("downloads.png", view), viewmode="list", - context=[{"title": config.get_localized_string(70288), "channel": "setting", "config": "downloads", + context=CONTEXT + [{"title": config.get_localized_string(70288), "channel": "setting", "config": "downloads", "action": "channel_config"}])) thumb_setting = "setting_%s.png" % 0 # config.get_setting("plugin_updates_available") @@ -93,13 +102,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")) + viewmode="thumbnails", context = CONTEXT)) 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))) + thumbnail=get_thumb("channels_%s.png" % channel_type, view), context = CONTEXT)) # 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), @@ -109,7 +118,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")) + viewmode="thumbnails", context = CONTEXT)) return itemlist @@ -215,7 +224,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)) + language=channel_parameters["language"], viewmode="list", context=CONTEXT + context)) except: logger.error("Se ha producido un error al leer los datos del canal '%s'" % channel) diff --git a/core/support.py b/core/support.py index 60eeb4d8..a4cb2bd2 100755 --- a/core/support.py +++ b/core/support.py @@ -24,7 +24,9 @@ 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 +from specials import autoplay, shortcuts + +CONTEXT =shortcuts.context() def hdpass_get_servers(item): def get_hosts(url, quality): @@ -299,7 +301,8 @@ 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 '' + other = scraped['other'] if scraped['other'] else '', + context = CONTEXT ) # for lg in list(set(listGroups).difference(known_keys)): @@ -620,7 +623,8 @@ def menuItem(itemlist, filename, title='', action='', url='', contentType='movie url = url, extra = extra, args = args, - contentType = contentType + contentType = contentType, + context = CONTEXT )) # Apply auto Thumbnails at the menus @@ -668,7 +672,7 @@ def menu(func): url = host + var[0] if len(var) > 0 else '', action = var[1] if len(var) > 1 else 'peliculas', args=var[2] if len(var) > 2 else '', - contentType= var[3] if len(var) > 3 else 'movie',) + contentType= var[3] if len(var) > 3 else 'movie') # Make MAIN MENU elif dictUrl[name] is not None: @@ -687,7 +691,7 @@ def menu(func): url = host + var[0] if len(var) > 0 else '', action = var[1] if len(var) > 1 else 'peliculas', args=var[2] if len(var) > 2 else '', - contentType= var[3] if len(var) > 3 else 'movie' if name == 'film' else 'tvshow',) + contentType= var[3] if len(var) > 3 else 'movie' if name == 'film' else 'tvshow') # add search menu for category if 'search' not in args: menuItem(itemlist, filename, config.get_localized_string(70741) % title + ' … submenu bold', 'search', host + url, contentType='movie' if name == 'film' else 'tvshow') @@ -768,6 +772,12 @@ def typo(string, typography=''): string = ' - ' + re.sub(r'\s--','',string) if 'bullet' in string: string = '[B]' + "•" + '[/B] ' + re.sub(r'\sbullet','',string) + if 'capitalize' in string.lower(): + string = re.sub(r'\scapitalize','',string).capitalize() + if 'uppercase' in string.lower(): + string = re.sub(r'\suppercase','',string).upper() + if 'lowercase' in string.lower(): + string = re.sub(r'\slowercase','',string).lower() return string diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 5f2a0b72..6c4178e5 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -584,9 +584,9 @@ def set_context_commands(item, parent_item): # Ir al Menu Principal (channel.mainlist) if parent_item.channel not in ["news", "channelselector"] and item.action != "mainlist" \ and parent_item.action != "mainlist": - context_commands.append((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()))) - context_commands.insert(2, (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", url=item.url).tourl()))) @@ -598,11 +598,11 @@ def set_context_commands(item, parent_item): (sys.argv[0], item.clone(channel="favorites", action="addFavourite", from_channel=item.channel, from_action=item.action).tourl()))) - + # Añadir a Alfavoritos (Mis enlaces) if item.channel not in ["favorites", "videolibrary", "help", ""] and parent_item.channel != "favorites": context_commands.append( - ('[COLOR blue]%s[/COLOR]' % config.get_localized_string(70557), "XBMC.RunPlugin(%s?%s)" % + (config.get_localized_string(70557), "XBMC.RunPlugin(%s?%s)" % (sys.argv[0], item.clone(channel="kodfavourites", action="addFavourite", from_channel=item.channel, from_action=item.action).tourl()))) @@ -630,7 +630,7 @@ def set_context_commands(item, parent_item): text=item.wanted).tourl()))) context_commands.append( - ("[COLOR yellow]%s[/COLOR]" % config.get_localized_string(70561), "XBMC.Container.Update (%s?%s)" % ( + (config.get_localized_string(70561), "XBMC.Container.Update (%s?%s)" % ( sys.argv[0], item.clone(channel='search', action='from_context', search_type='list', page='1', list_type='%s/%s/similar' % ( mediatype, item.infoLabels['tmdb_id'])).tourl()))) @@ -703,7 +703,7 @@ def set_context_commands(item, parent_item): context_commands.append((config.get_localized_string(60361), "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]) # Menu Rapido # context_commands.insert(0, (config.get_localized_string(60360), @@ -712,7 +712,7 @@ def set_context_commands(item, parent_item): # parent=parent_item.tourl()).tourl( # )))) if config.dev_mode(): - context_commands.insert(2, ("item info", + context_commands.insert(0, ("item info", "XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(action="itemInfo", parent=item.tojson()).tourl()))) return context_commands diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po index f817700b..676e8542 100644 --- a/resources/language/English/strings.po +++ b/resources/language/English/strings.po @@ -105,6 +105,14 @@ msgctxt "#30023" msgid "NO" msgstr "" +msgctxt "#30024" +msgid "Contextual Menu" +msgstr "" + +msgctxt "#30025" +msgid "KoD Preferences" +msgstr "Preferenze KoD" + msgctxt "#30043" msgid "Force view mode:" msgstr "" @@ -1539,7 +1547,7 @@ msgid "Search Trailer" msgstr "" msgctxt "#60360" -msgid "[B]QUICK MENU[/B]" +msgid "Quick Menu" msgstr "" msgctxt "#60361" @@ -5670,7 +5678,7 @@ msgid "%s Special Episode Number" msgstr "" msgctxt "#70737" -msgid "[B]SIDE MENU[/B]" +msgid "Side Menu" msgstr "" msgctxt "#70738" diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index 3eed066d..07c70c6b 100644 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -105,6 +105,14 @@ msgctxt "#30023" msgid "NO" msgstr "NO" +msgctxt "#30024" +msgid "Contextual Menu" +msgstr "Menu Contestuale" + +msgctxt "#30025" +msgid "KoD Preferences" +msgstr "Preferenze KoD" + msgctxt "#30043" msgid "Force view mode:" msgstr "Forza modalità di visualizzazione:" @@ -1538,8 +1546,8 @@ msgid "Search Trailer" msgstr "Cerca Trailer" msgctxt "#60360" -msgid "[B]QUICK MENU[/B]" -msgstr "[B]MENU RAPIDO[/B]" +msgid "Qiuick Menu" +msgstr "Menu Rapido" msgctxt "#60361" msgid "Super Favourites Menu" @@ -5674,8 +5682,8 @@ msgid "Completed Serie" msgstr "Serie Completa" msgctxt "#70737" -msgid "[B]SIDE MENU[/B]" -msgstr "[B]MENU LATERALE[/B]" +msgid "Side Menu" +msgstr "Menu Laterale" msgctxt "#70738" msgid "Ready channels %d/%d" diff --git a/resources/settings.xml b/resources/settings.xml index 62c9c475..d41e9395 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -79,6 +79,11 @@ + + + + + diff --git a/specials/help.py b/specials/help.py index 182b22b0..53d9cac8 100644 --- a/specials/help.py +++ b/specials/help.py @@ -42,7 +42,7 @@ 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")) + thumbnail=get_thumb("error.png"), viewmode="list",folder=True)) itemlist.append(Item(channel=item.channel, action="", title=config.get_localized_string(60447), thumbnail=get_thumb("help.png"), @@ -78,7 +78,7 @@ def mainlist(item): itemlist.append(Item(channel=item.channel, action="faq", title=config.get_localized_string(60455), thumbnail=get_thumb("help.png"), - folder=True, extra="prob_bib")) + folder=False, extra="prob_bib")) itemlist.append(Item(channel=item.channel, action="faq", title=config.get_localized_string(60456), thumbnail=get_thumb("help.png"), diff --git a/specials/kodfavorites.py b/specials/kodfavorites.py index 6fc0feac..0322ec3c 100644 --- a/specials/kodfavorites.py +++ b/specials/kodfavorites.py @@ -129,7 +129,7 @@ class KodfavouritesData(object): def addFavourite(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() # Si se llega aquí mediante el menú contextual, hay que recuperar los parámetros action y channel if item.from_action: @@ -182,7 +182,7 @@ def addFavourite(item): def mainlist(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() item.category = get_name_from_filename(os.path.basename(alfav.user_favorites_file)) itemlist = [] @@ -219,7 +219,7 @@ def mainlist(item): def mostrar_perfil(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() itemlist = [] @@ -294,7 +294,7 @@ def _crea_perfil(alfav): def crear_perfil(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() if not _crea_perfil(alfav): return False @@ -304,7 +304,7 @@ def crear_perfil(item): def editar_perfil_titulo(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() if not alfav.user_favorites[item.i_perfil]: return False @@ -321,7 +321,7 @@ def editar_perfil_titulo(item): def eliminar_perfil(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() if not alfav.user_favorites[item.i_perfil]: return False @@ -369,7 +369,7 @@ def acciones_enlace(item): def editar_enlace_titulo(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() if not alfav.user_favorites[item.i_perfil]: return False if not alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]: return False @@ -391,7 +391,7 @@ def editar_enlace_titulo(item): def editar_enlace_color(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() if not alfav.user_favorites[item.i_perfil]: return False if not alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]: return False @@ -415,7 +415,7 @@ def editar_enlace_color(item): def editar_enlace_thumbnail(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() if not alfav.user_favorites[item.i_perfil]: return False if not alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]: return False @@ -475,7 +475,7 @@ def editar_enlace_thumbnail(item): def editar_enlace_carpeta(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() if not alfav.user_favorites[item.i_perfil]: return False if not alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]: return False @@ -494,7 +494,7 @@ def editar_enlace_carpeta(item): def editar_enlace_lista(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() if not alfav.user_favorites[item.i_perfil]: return False if not alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]: return False @@ -515,7 +515,7 @@ def editar_enlace_lista(item): if ret == -1: return False # pedido cancel - alfav_destino = kodfavoritesData(opciones[ret]) + alfav_destino = KodfavouritesData(opciones[ret]) # Diálogo para escoger/crear carpeta en la lista de destino i_perfil = _selecciona_perfil(alfav_destino, 'Seleccionar carpeta destino', -1) @@ -532,7 +532,7 @@ def editar_enlace_lista(item): def eliminar_enlace(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() if not alfav.user_favorites[item.i_perfil]: return False if not alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]: return False @@ -548,7 +548,7 @@ def eliminar_enlace(item): # ------------------------ def mover_perfil(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() alfav.user_favorites = _mover_item(alfav.user_favorites, item.i_perfil, item.direccion) alfav.save() @@ -558,7 +558,7 @@ def mover_perfil(item): def mover_enlace(item): logger.info() - alfav = kodfavoritesData() + alfav = KodfavouritesData() if not alfav.user_favorites[item.i_perfil]: return False alfav.user_favorites[item.i_perfil]['items'] = _mover_item(alfav.user_favorites[item.i_perfil]['items'], item.i_enlace, item.direccion) @@ -726,7 +726,7 @@ def informacion_lista(item): platformtools.dialog_ok('Alfa', config.get_localized_string(70630), item.lista) return False - alfav = kodfavoritesData(item.lista) + alfav = KodfavouritesData(item.lista) txt = 'Lista: [COLOR gold]%s[/COLOR]' % item.lista txt += '[CR]' + config.get_localized_string(70634) + ' ' + alfav.info_lista['created'] + ' ' + config.get_localized_string(70635) + ' ' + alfav.info_lista['updated'] @@ -790,7 +790,7 @@ def compartir_lista(item): # Apuntar código en fichero de log y dentro de la lista save_log_lista_shared(config.get_localized_string(70648) + ' ' + item.lista + ' ' + codigo + ' ' + config.get_localized_string(70649)) - alfav = kodfavoritesData(item.lista) + alfav = KodfavouritesData(item.lista) alfav.info_lista['tinyupload_date'] = fechahora_actual() alfav.info_lista['tinyupload_code'] = codigo alfav.save() @@ -851,7 +851,7 @@ def crear_lista(item): return False # Provocar que se guarde con las carpetas vacías por defecto - alfav = kodfavoritesData(filename) + alfav = KodfavouritesData(filename) platformtools.itemlist_refresh() return True diff --git a/specials/shortcuts.py b/specials/shortcuts.py new file mode 100644 index 00000000..423181f1 --- /dev/null +++ b/specials/shortcuts.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +def context(): + from platformcode import config + context = [] + + 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"}] + + return context + +def side_menu(item): + from specials import side_menu + side_menu.open_menu(item) + +def shortcut_menu(item): + from platformcode import keymaptools + keymaptools.open_shortcut_menu() + +def settings_menu(item): + from platformcode import config + config.open_settings() \ No newline at end of file