Merge pull request #380 from pipcat/master

Cambio interno para tests
This commit is contained in:
Alfa
2018-08-01 17:39:30 -05:00
committed by GitHub
4 changed files with 71 additions and 30 deletions

View File

@@ -296,16 +296,8 @@ def submenu_tools(item):
#Herramientas de testeo masivo
import os
test_path = os.path.join(config.get_runtime_path(), "channels/test.py")
if filetools.exists(test_path):
itemlist.append(Item(channel=CHANNELNAME, title="Herramientas de Testeo masivo", action="", folder=False,
thumbnail=get_thumb("channels.png")))
itemlist.append(Item(title='- Testear canales ...', channel="test", action="channel_test_selected"))
itemlist.append(Item(title='- Testear servidores ...', channel="test", action="server_test_selected"))
itemlist.append(Item(title='- Testear todos los canales!', channel="test", action="channel_test_all"))
itemlist.append(Item(title='- Testear todos los servidores!', channel="test", action="server_test_all"))
itemlist.append(Item(title='- Testear novedades!', channel="test", action="news_test_all"))
itemlist.append(Item(title='- Upload tests to web!', channel="test", action="web_update_tests"))
itemlist.append(Item(title='Testear canales y servidores ...', channel="test", action="mainlist"))
itemlist.append(
Item(channel=CHANNELNAME, action="", title="", folder=False, thumbnail=get_thumb("setting_0.png")))
@@ -335,6 +327,9 @@ def conf_tools(item):
# Activar o desactivar canales
if item.extra == "channels_onoff":
if config.get_platform(True)['num_version'] >= 17.0: # A partir de Kodi 16 se puede usar multiselect, y de 17 con preselect
return channels_onoff(item)
import channelselector
from core import channeltools
@@ -537,6 +532,60 @@ def conf_tools(item):
return itemlist
def channels_onoff(item):
import channelselector, xbmcgui
from core import channeltools
# Cargar lista de opciones
# ------------------------
lista = []; ids = []
channels_list = channelselector.filterchannels('allchannelstatus')
for channel in channels_list:
channel_parameters = channeltools.get_channel_parameters(channel.channel)
lbl = '%s' % channel_parameters['language']
# ~ lbl += ' %s' % [config.get_localized_category(categ) for categ in channel_parameters['categories']]
lbl += ' %s' % ', '.join(config.get_localized_category(categ) for categ in channel_parameters['categories'])
it = xbmcgui.ListItem(channel.title, lbl)
it.setArt({ 'thumb': channel.thumbnail, 'fanart': channel.fanart })
lista.append(it)
ids.append(channel.channel)
# Diálogo para pre-seleccionar
# ----------------------------
preselecciones = ['Pre-seleccionar activados actualmente', 'Pre-seleccionar todos', 'No pre-seleccionar ninguno']
ret = platformtools.dialog_select(config.get_localized_string(60545), preselecciones)
if ret == -1: return False # pedido cancel
if ret == 2: preselect = []
elif ret == 1: preselect = range(len(ids))
else:
preselect = []
for i, canal in enumerate(ids):
channel_status = config.get_setting('enabled', canal)
if channel_status is None: channel_status = True
if channel_status:
preselect.append(i)
# Diálogo para seleccionar
# ------------------------
ret = xbmcgui.Dialog().multiselect(config.get_localized_string(60545), lista, preselect=preselect, useDetails=True)
if ret == None: return False # pedido cancel
seleccionados = [ids[i] for i in ret]
# Guardar cambios en canales activados
# ------------------------------------
for canal in ids:
channel_status = config.get_setting('enabled', canal)
if channel_status is None: channel_status = True
if channel_status and canal not in seleccionados:
config.set_setting('enabled', False, canal)
elif not channel_status and canal in seleccionados:
config.set_setting('enabled', True, canal)
return False
def channel_status(item, dict_values):
try:
for k in dict_values:

View File

@@ -63,11 +63,6 @@ def getchanneltypes(view="thumb_"):
# Lista de categorias
channel_types = ["movie", "tvshow", "anime", "documentary", "vos", "direct", "torrent"]
dict_types_lang = {'movie': config.get_localized_string(30122), 'tvshow': config.get_localized_string(30123),
'anime': config.get_localized_string(30124), 'documentary': config.get_localized_string(30125),
'vos': config.get_localized_string(30136), 'adult': config.get_localized_string(30126),
'direct': config.get_localized_string(30137)}
if config.get_setting("adult_mode") != 0:
channel_types.append("adult")
@@ -83,7 +78,7 @@ def getchanneltypes(view="thumb_"):
for channel_type in channel_types:
logger.info("channel_type=%s" % channel_type)
title = dict_types_lang.get(channel_type, channel_type)
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)))

View File

@@ -299,6 +299,14 @@ def get_localized_string(code):
return dev
def get_localized_category(categ):
categories = {'movie': get_localized_string(30122), 'tvshow': get_localized_string(30123),
'anime': get_localized_string(30124), 'documentary': get_localized_string(30125),
'vos': get_localized_string(30136), 'adult': get_localized_string(30126),
'direct': get_localized_string(30137), 'torrent': get_localized_string(70015)}
return categories[categ] if categ in categories else categ
def get_videolibrary_config_path():
value = get_setting("videolibrarypath")

View File

@@ -59,6 +59,10 @@ def dialog_select(heading, _list):
return xbmcgui.Dialog().select(heading, _list)
def dialog_multiselect(heading, _list, autoclose=0, preselect=[], useDetails=False):
return xbmcgui.Dialog().multiselect(heading, _list, autoclose=autoclose, preselect=preselect, useDetails=useDetails)
def dialog_progress(heading, line1, line2=" ", line3=" "):
dialog = xbmcgui.DialogProgress()
dialog.create(heading, line1, line2, line3)
@@ -496,19 +500,6 @@ 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())))
#Herramientas de desarrollador
from core import filetools
test_path = os.path.join(config.get_runtime_path(), "channels/test.py")
if parent_item.action == 'filterchannels' and item.action == 'mainlist' and filetools.exists(test_path):
channel_parameters = channeltools.get_channel_parameters(item.channel)
context_commands.append(("TESTEAR ESTE CANAL",
"XBMC.RunPlugin(%s?%s)" %
(sys.argv[0],
Item(channel='test', action='channel_test',
config=channel_parameters['channel']).tourl())))
# Buscar en otros canales
if item.contentType in ['movie', 'tvshow'] and item.channel != 'search':
@@ -522,7 +513,6 @@ def set_context_commands(item, parent_item):
item.clone(channel='search',
action="do_search",
from_channel=item.channel,
contextual=True).tourl())))
if item.contentType == 'tvshow':
mediatype = 'tv'
@@ -606,7 +596,6 @@ def set_context_commands(item, parent_item):
"XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(channel='side_menu',
action="open_menu",
parent=parent_item.tourl()).tourl(
))))
return context_commands