Reorganized channels and support moved to core
This commit is contained in:
7
platformcode/help.json
Normal file
7
platformcode/help.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"id": "help",
|
||||
"name": "Ayuda",
|
||||
"active": false,
|
||||
"adult": false,
|
||||
"language": ["*"]
|
||||
}
|
||||
163
platformcode/help.py
Normal file
163
platformcode/help.py
Normal file
@@ -0,0 +1,163 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
|
||||
from core.item import Item
|
||||
from platformcode import config, logger, platformtools
|
||||
from channelselector import get_thumb
|
||||
|
||||
if config.is_xbmc():
|
||||
|
||||
import xbmcgui
|
||||
|
||||
class TextBox(xbmcgui.WindowXMLDialog):
|
||||
""" Create a skinned textbox window """
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.title = kwargs.get('title')
|
||||
self.text = kwargs.get('text')
|
||||
self.doModal()
|
||||
|
||||
def onInit(self):
|
||||
try:
|
||||
self.getControl(5).setText(self.text)
|
||||
self.getControl(1).setLabel(self.title)
|
||||
except:
|
||||
pass
|
||||
|
||||
def onClick(self, control_id):
|
||||
pass
|
||||
|
||||
def onFocus(self, control_id):
|
||||
pass
|
||||
|
||||
def onAction(self, action):
|
||||
# self.close()
|
||||
if action in [xbmcgui.ACTION_PREVIOUS_MENU, xbmcgui.ACTION_NAV_BACK]:
|
||||
self.close()
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="", title=config.get_localized_string(60447),
|
||||
thumbnail=get_thumb("help.png"),
|
||||
folder=False))
|
||||
if config.is_xbmc():
|
||||
itemlist.append(Item(channel=item.channel, action="faq",
|
||||
title=config.get_localized_string(60448),
|
||||
thumbnail=get_thumb("help.png"),
|
||||
folder=False, extra="report_error"))
|
||||
itemlist.append(Item(channel=item.channel, action="faq",
|
||||
title=config.get_localized_string(60449),
|
||||
thumbnail=get_thumb("help.png"),
|
||||
folder=False, extra="onoff_canales"))
|
||||
itemlist.append(Item(channel=item.channel, action="faq",
|
||||
title=config.get_localized_string(60450),
|
||||
thumbnail=get_thumb("help.png"),
|
||||
folder=False, extra="trakt_sync"))
|
||||
itemlist.append(Item(channel=item.channel, action="faq",
|
||||
title=config.get_localized_string(60451),
|
||||
thumbnail=get_thumb("help.png"),
|
||||
folder=False, extra="buscador_juntos"))
|
||||
itemlist.append(Item(channel=item.channel, action="faq",
|
||||
title=config.get_localized_string(60452),
|
||||
thumbnail=get_thumb("help.png"),
|
||||
folder=False, extra="tiempo_enlaces"))
|
||||
itemlist.append(Item(channel=item.channel, action="faq",
|
||||
title=config.get_localized_string(60453),
|
||||
thumbnail=get_thumb("help.png"),
|
||||
folder=False, extra="prob_busquedacont"))
|
||||
itemlist.append(Item(channel=item.channel, action="faq",
|
||||
title=config.get_localized_string(60454),
|
||||
thumbnail=get_thumb("help.png"),
|
||||
folder=False, extra="canal_fallo"))
|
||||
itemlist.append(Item(channel=item.channel, action="faq",
|
||||
title=config.get_localized_string(70280),
|
||||
thumbnail=get_thumb("help.png"),
|
||||
folder=False, extra="prob_torrent"))
|
||||
itemlist.append(Item(channel=item.channel, action="faq",
|
||||
title=config.get_localized_string(60455),
|
||||
thumbnail=get_thumb("help.png"),
|
||||
folder=True, extra="prob_bib"))
|
||||
itemlist.append(Item(channel=item.channel, action="faq",
|
||||
title=config.get_localized_string(60456),
|
||||
thumbnail=get_thumb("help.png"),
|
||||
folder=False, extra=""))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def faq(item):
|
||||
|
||||
if item.extra == "onoff_canales":
|
||||
respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60458))
|
||||
if respuesta == 1:
|
||||
from specials import setting
|
||||
setting.conf_tools(Item(extra='channels_onoff'))
|
||||
|
||||
elif item.extra == "trakt_sync":
|
||||
respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60459))
|
||||
if respuesta == 1:
|
||||
from specials import videolibrary
|
||||
videolibrary.channel_config(Item(channel='videolibrary'))
|
||||
|
||||
elif item.extra == "tiempo_enlaces":
|
||||
respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60460))
|
||||
if respuesta == 1:
|
||||
from specials import videolibrary
|
||||
videolibrary.channel_config(Item(channel='videolibrary'))
|
||||
|
||||
elif item.extra == "prob_busquedacont":
|
||||
title = config.get_localized_string(60461) % item.title[6:]
|
||||
text = config.get_localized_string(60462)
|
||||
|
||||
return TextBox("DialogTextViewer.xml", os.getcwd(), "Default", title=title, text=text)
|
||||
|
||||
elif item.extra == "canal_fallo":
|
||||
title = config.get_localized_string(60461) % item.title[6:]
|
||||
text = config.get_localized_string(60463)
|
||||
|
||||
return TextBox("DialogTextViewer.xml", os.getcwd(), "Default", title=title, text=text)
|
||||
|
||||
elif item.extra == "prob_bib":
|
||||
platformtools.dialog_ok(config.get_localized_string(60457), # To check
|
||||
config.get_localized_string(60464))
|
||||
|
||||
respuesta = platformtools.dialog_yesno(config.get_localized_string(60457),
|
||||
config.get_localized_string(60465))
|
||||
if respuesta == 1:
|
||||
itemlist = []
|
||||
from specials import setting
|
||||
new_item = Item(channel="setting", action="submenu_tools", folder=True)
|
||||
itemlist.extend(setting.submenu_tools(new_item))
|
||||
return itemlist
|
||||
|
||||
elif item.extra == "prob_torrent":
|
||||
title = config.get_localized_string(60461) % item.title[6:]
|
||||
text = config.get_localized_string(70279)
|
||||
|
||||
return TextBox("DialogTextViewer.xml", os.getcwd(), "Default", title=title, text=text)
|
||||
|
||||
elif item.extra == "buscador_juntos":
|
||||
respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60466))
|
||||
if respuesta == 1:
|
||||
from specials import search
|
||||
search.settings("")
|
||||
|
||||
elif item.extra == "report_error":
|
||||
import xbmc
|
||||
if config.get_platform(True)['num_version'] < 14:
|
||||
log_name = "xbmc.log"
|
||||
else:
|
||||
log_name = "kodi.log"
|
||||
ruta = xbmc.translatePath("special://logpath") + log_name
|
||||
title = config.get_localized_string(60461) % item.title[6:]
|
||||
text = config.get_localized_string(60467) % ruta
|
||||
|
||||
return TextBox("DialogTextViewer.xml", os.getcwd(), "Default", title=title, text=text)
|
||||
|
||||
else:
|
||||
platformtools.dialog_ok(config.get_localized_string(60457), # To check "Tag telegram"
|
||||
config.get_localized_string(60468))
|
||||
|
||||
2412
platformcode/infoplus.py
Normal file
2412
platformcode/infoplus.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -56,7 +56,7 @@ def run(item=None):
|
||||
category = dictCategory[config.get_setting("category")]
|
||||
item = Item(channel="news", action="novedades", extra=category, mode = 'silent')
|
||||
else:
|
||||
from channels import side_menu
|
||||
from specials import side_menu
|
||||
item= Item()
|
||||
item = side_menu.check_user_home(item)
|
||||
item.start = True
|
||||
@@ -140,21 +140,22 @@ def run(item=None):
|
||||
# updater.update_channel(item.channel)
|
||||
|
||||
# Checks if channel exists
|
||||
channel_file = os.path.join(config.get_runtime_path(),
|
||||
'channels', item.channel + ".py")
|
||||
if not os.path.isfile(channel_file):
|
||||
channel_file = os.path.join(config.get_runtime_path(),
|
||||
'special_channels', item.channel + ".py")
|
||||
logger.info("channel_file=%s" % channel_file)
|
||||
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")):
|
||||
CHANNELS = 'channels'
|
||||
else:
|
||||
CHANNELS ='specials'
|
||||
channel_file = os.path.join(config.get_runtime_path(), CHANNELS, item.channel + ".py")
|
||||
|
||||
logger.info("channel_file= " + channel_file)
|
||||
|
||||
channel = None
|
||||
|
||||
if os.path.exists(channel_file):
|
||||
try:
|
||||
channel = __import__('channels.%s' % item.channel, None,
|
||||
None, ["channels.%s" % item.channel])
|
||||
channel = __import__(CHANNELS + item.channel, None, None, [CHANNELS + item.channel])
|
||||
except ImportError:
|
||||
exec("import channels." + item.channel + " as channel")
|
||||
importer = "import " + CHANNELS + "." + item.channel + " as channel"
|
||||
exec(importer)
|
||||
|
||||
logger.info("Running channel %s | %s" % (channel.__name__, channel.__file__))
|
||||
|
||||
@@ -226,7 +227,7 @@ def run(item=None):
|
||||
|
||||
# Special action for downloading all episodes from a serie
|
||||
elif item.action == "download_all_episodes":
|
||||
from channels import downloads
|
||||
from specials import downloads
|
||||
item.action = item.extra
|
||||
del item.extra
|
||||
downloads.save_download(item)
|
||||
@@ -247,7 +248,7 @@ def run(item=None):
|
||||
tecleado = platformtools.dialog_input(last_search)
|
||||
if tecleado is not None:
|
||||
if last_search_active and not tecleado.startswith("http"):
|
||||
from channels import search
|
||||
from specials import search
|
||||
search.save_search(tecleado)
|
||||
|
||||
itemlist = channel.search(item, tecleado)
|
||||
@@ -256,8 +257,9 @@ def run(item=None):
|
||||
|
||||
platformtools.render_items(itemlist, item)
|
||||
|
||||
# For all other actions
|
||||
# For all other actions
|
||||
else:
|
||||
# import web_pdb; web_pdb.set_trace()
|
||||
logger.info("Executing channel '%s' method" % item.action)
|
||||
itemlist = getattr(channel, item.action)(item)
|
||||
if config.get_setting('trakt_sync'):
|
||||
@@ -294,8 +296,7 @@ def run(item=None):
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\",
|
||||
"\\\\") + '([^.]+)\.py"'
|
||||
patron = 'File "' + os.path.join(config.get_runtime_path(), CHANNELS, "").replace("\\", "\\\\") + '([^.]+)\.py"'
|
||||
canal = scrapertools.find_single_match(traceback.format_exc(), patron)
|
||||
|
||||
platformtools.dialog_ok(
|
||||
@@ -305,8 +306,7 @@ def run(item=None):
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\",
|
||||
"\\\\") + '([^.]+)\.py"'
|
||||
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + '([^.]+)\.py"'
|
||||
canal = scrapertools.find_single_match(traceback.format_exc(), patron)
|
||||
|
||||
try:
|
||||
@@ -433,7 +433,7 @@ def play_from_library(item):
|
||||
|
||||
else:
|
||||
# Ventana emergente
|
||||
from channels import videolibrary
|
||||
from specials import videolibrary
|
||||
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(70004))
|
||||
p_dialog.update(0, '')
|
||||
|
||||
@@ -491,6 +491,6 @@ def play_from_library(item):
|
||||
item = videolibrary.play(itemlist[seleccion])[0]
|
||||
platformtools.play_video(item)
|
||||
|
||||
from channels import autoplay
|
||||
from specials import autoplay
|
||||
if (platformtools.is_playing() and item.action) or item.server == 'torrent' or autoplay.is_active(item.contentChannel):
|
||||
break
|
||||
|
||||
@@ -180,7 +180,7 @@ def render_items(itemlist, parent_item):
|
||||
item.thumbnail = get_thumb("videolibrary_tvshow.png")
|
||||
|
||||
|
||||
if unify_enabled and parent_item.channel != 'alfavorites':
|
||||
if unify_enabled and parent_item.channel != 'kodfavorites':
|
||||
# Formatear titulo con unify
|
||||
item = unify.title_format(item)
|
||||
else:
|
||||
@@ -268,11 +268,11 @@ def render_items(itemlist, parent_item):
|
||||
# ...forzamos segun el viewcontent
|
||||
xbmcplugin.setContent(int(sys.argv[1]), parent_item.viewcontent)
|
||||
|
||||
elif parent_item.channel not in ["channelselector", "", "alfavorites"]:
|
||||
elif parent_item.channel not in ["channelselector", "", "kodfavorites"]:
|
||||
# ... o segun el canal
|
||||
xbmcplugin.setContent(int(sys.argv[1]), "movies")
|
||||
|
||||
elif parent_item.channel == "alfavorites" and parent_item.action == 'mostrar_perfil':
|
||||
elif parent_item.channel == "kodfavorites" and parent_item.action == 'mostrar_perfil':
|
||||
xbmcplugin.setContent(int(sys.argv[1]), "movies")
|
||||
|
||||
# Fijamos el "breadcrumb"
|
||||
@@ -470,7 +470,7 @@ def set_context_commands(item, parent_item):
|
||||
|
||||
# Si no se está dentro de Alfavoritos y hay los contextos de alfavoritos, descartarlos.
|
||||
# (pasa al ir a un enlace de alfavoritos, si este se clona en el canal)
|
||||
if parent_item.channel != 'alfavorites' and 'i_perfil' in command and 'i_enlace' in command:
|
||||
if parent_item.channel != 'kodfavorites' and 'i_perfil' in command and 'i_enlace' in command:
|
||||
continue
|
||||
|
||||
if "goto" in command:
|
||||
@@ -481,7 +481,7 @@ def set_context_commands(item, parent_item):
|
||||
(command["title"], "XBMC.RunPlugin(%s?%s)" % (sys.argv[0], item.clone(**command).tourl())))
|
||||
|
||||
# No añadir más opciones predefinidas si se está dentro de Alfavoritos
|
||||
if parent_item.channel == 'alfavorites':
|
||||
if parent_item.channel == 'kodfavorites':
|
||||
return context_commands
|
||||
|
||||
# Opciones segun criterios, solo si el item no es un tag (etiqueta), ni es "Añadir a la videoteca", etc...
|
||||
@@ -548,7 +548,7 @@ def set_context_commands(item, parent_item):
|
||||
# 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)" %
|
||||
(sys.argv[0], item.clone(channel="alfavorites", action="addFavourite",
|
||||
(sys.argv[0], item.clone(channel="kodfavorites", action="addFavourite",
|
||||
from_channel=item.channel,
|
||||
from_action=item.action).tourl())))
|
||||
|
||||
@@ -596,7 +596,7 @@ def set_context_commands(item, parent_item):
|
||||
|
||||
if item.channel != "downloads" and downloadenabled != "false":
|
||||
# Descargar pelicula
|
||||
if item.contentType == "movie" and item.contentTitle:
|
||||
if item.contentType == "movie":
|
||||
context_commands.append((config.get_localized_string(60354), "XBMC.RunPlugin(%s?%s)" %
|
||||
(sys.argv[0], item.clone(channel="downloads", action="save_download",
|
||||
from_channel=item.channel, from_action=item.action)
|
||||
@@ -966,7 +966,7 @@ def set_opcion(item, seleccion, opciones, video_urls):
|
||||
|
||||
# "Descargar"
|
||||
elif opciones[seleccion] == config.get_localized_string(30153):
|
||||
from channels import downloads
|
||||
from specials import downloads
|
||||
import xbmcaddon
|
||||
import xbmcgui
|
||||
__addon__ = xbmcaddon.Addon()
|
||||
@@ -984,13 +984,13 @@ def set_opcion(item, seleccion, opciones, video_urls):
|
||||
|
||||
# "Quitar de favoritos"
|
||||
elif opciones[seleccion] == config.get_localized_string(30154):
|
||||
from channels import favorites
|
||||
from specials import favorites
|
||||
favorites.delFavourite(item)
|
||||
salir = True
|
||||
|
||||
# "Añadir a favoritos":
|
||||
elif opciones[seleccion] == config.get_localized_string(30155):
|
||||
from channels import favorites
|
||||
from specials import favorites
|
||||
item.from_channel = "favorites"
|
||||
favorites.addFavourite(item)
|
||||
salir = True
|
||||
|
||||
@@ -174,12 +174,12 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
|
||||
channelpath = inspect.currentframe().f_back.f_back.f_code.co_filename
|
||||
self.channel = os.path.basename(channelpath).replace(".py", "")
|
||||
self.ch_type = os.path.basename(os.path.dirname(channelpath))
|
||||
|
||||
logger.info('PATH= ' + channelpath)
|
||||
# Si no tenemos list_controls, hay que sacarlos del json del canal
|
||||
if not self.list_controls:
|
||||
|
||||
# Si la ruta del canal esta en la carpeta "channels", obtenemos los controles y valores mediante chaneltools
|
||||
if os.path.join(config.get_runtime_path(), "channels") in channelpath:
|
||||
if os.path.join(config.get_runtime_path(), "channels") or os.path.join(config.get_runtime_path(), "specials") in channelpath:
|
||||
|
||||
# La llamada se hace desde un canal
|
||||
self.list_controls, default_values = channeltools.get_channel_controls_settings(self.channel)
|
||||
@@ -544,7 +544,7 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
|
||||
default = ""
|
||||
|
||||
c["default"] = c.get("default", default)
|
||||
c["color"] = c.get("color", "0xFF0066CC")
|
||||
c["color"] = c.get("color", "0xFFFFFFFF")
|
||||
c["visible"] = c.get("visible", True)
|
||||
c["enabled"] = c.get("enabled", True)
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ def mark_auto_as_watched(item):
|
||||
logger.debug("marcado")
|
||||
item.playcount = 1
|
||||
sync_with_trakt = True
|
||||
from channels import videolibrary
|
||||
from specials import videolibrary
|
||||
videolibrary.mark_content_as_watched2(item)
|
||||
break
|
||||
|
||||
@@ -326,7 +326,7 @@ def mark_season_as_watched_on_kodi(item, value=1):
|
||||
|
||||
|
||||
def mark_content_as_watched_on_alfa(path):
|
||||
from channels import videolibrary
|
||||
from specials import videolibrary
|
||||
from core import videolibrarytools
|
||||
from core import scrapertools
|
||||
from core import filetools
|
||||
|
||||
Reference in New Issue
Block a user