KoD 0.8.1
- riorganizzate le impostazioni - aggiunte descrizioni tag qualità su cb01 (presto anche sugli altri) - aggiunto il supporto alle serie di polpotv - fixato server mystream - fix Rinumerazione per episodi Nuovi
This commit is contained in:
+300
-303
@@ -33,7 +33,7 @@ except:
|
||||
xbmcgui = None
|
||||
import xbmc
|
||||
import re, base64, json, os, inspect
|
||||
from core import jsontools, tvdb, scrapertools
|
||||
from core import jsontools, tvdb, scrapertools, filetools
|
||||
from core.support import typo, log, dbg
|
||||
from platformcode import config, platformtools, logger
|
||||
from platformcode.config import get_setting
|
||||
@@ -49,29 +49,202 @@ TAG_CHECK = "ReCheck"
|
||||
TAG_SPLIST = "SpList"
|
||||
TAG_TYPE = "Type"
|
||||
|
||||
__channel__ = "autorenumber"
|
||||
|
||||
def access():
|
||||
allow = False
|
||||
def renumber(itemlist, item='', typography=''):
|
||||
log()
|
||||
dict_series = load(itemlist[0])
|
||||
|
||||
if config.is_xbmc():
|
||||
allow = True
|
||||
if item:
|
||||
item.channel = item.from_channel if item.from_channel else item.channel
|
||||
title = item.fulltitle.rstrip()
|
||||
|
||||
return allow
|
||||
if inspect.stack()[2][3] == 'find_episodes':
|
||||
return itemlist
|
||||
|
||||
def context(exist):
|
||||
if access():
|
||||
modify = config.get_localized_string(70714) if exist else ''
|
||||
_context = [{"title": typo(modify + config.get_localized_string(70585), 'bold'),
|
||||
"action": "select_type",
|
||||
"channel": "autorenumber",}]
|
||||
elif title in dict_series and TAG_ID in dict_series[title]:
|
||||
ID = dict_series[title][TAG_ID]
|
||||
Episode = dict_series[title][TAG_EPISODE]
|
||||
Season = dict_series[title][TAG_SEASON] if TAG_SEASON in dict_series[title] else ''
|
||||
Mode = dict_series[title][TAG_MODE] if TAG_MODE in dict_series[title] else False
|
||||
Type = dict_series[title][TAG_TYPE] if TAG_TYPE in dict_series[title] else 'auto'
|
||||
|
||||
return _context
|
||||
renumeration(itemlist, item, typography, dict_series, ID, Season, Episode, Mode, title, Type)
|
||||
|
||||
else:
|
||||
if config.get_setting('autorenumber', item.channel):
|
||||
config_item(item, itemlist, typography, True)
|
||||
else:
|
||||
return itemlist
|
||||
|
||||
else:
|
||||
for item in itemlist:
|
||||
title = item.fulltitle.rstrip()
|
||||
if title in dict_series and TAG_ID in dict_series[title]:
|
||||
ID = dict_series[title][TAG_ID]
|
||||
exist = True
|
||||
else:
|
||||
exist = False
|
||||
|
||||
if item.contentType != 'movie':
|
||||
if item.context:
|
||||
context2 = item.context
|
||||
item.show = item.fulltitle = title
|
||||
item.context = context(exist) + context2
|
||||
else:
|
||||
item.show = item.fulltitle = title
|
||||
item.context = context(exist)
|
||||
|
||||
|
||||
def config_item(item, itemlist=[], typography='', active=False):
|
||||
log()
|
||||
# Configurazione Automatica, Tenta la numerazione Automatica degli episodi
|
||||
title = item.fulltitle.rstrip()
|
||||
|
||||
dict_series = load(item)
|
||||
ID = dict_series[title][TAG_ID] if title in dict_series and TAG_ID in dict_series[title] else ''
|
||||
|
||||
# Pulizia del Titolo
|
||||
if any( word in title.lower() for word in ['specials', 'speciali']):
|
||||
title = re.sub(r'\sspecials|\sspeciali', '', title.lower())
|
||||
tvdb.find_and_set_infoLabels(item)
|
||||
elif not item.infoLabels['tvdb_id']:
|
||||
item.contentSerieName= title.rstrip('123456789 ')
|
||||
tvdb.find_and_set_infoLabels(item)
|
||||
|
||||
if not ID and active:
|
||||
if item.infoLabels['tvdb_id']:
|
||||
ID = item.infoLabels['tvdb_id']
|
||||
dict_renumerate = {TAG_ID: ID}
|
||||
dict_series[title] = dict_renumerate
|
||||
# Trova La Stagione
|
||||
if any(word in title.lower() for word in ['specials', 'speciali']):
|
||||
dict_renumerate[TAG_SEASON] = '0'
|
||||
elif RepresentsInt(title.split()[-1]):
|
||||
dict_renumerate[TAG_SEASON] = title.split()[-1]
|
||||
else: dict_renumerate[TAG_SEASON] = '1'
|
||||
dict_renumerate[TAG_EPISODE] = ''
|
||||
write(item, dict_series)
|
||||
return renumber(itemlist, item, typography)
|
||||
else:
|
||||
return itemlist
|
||||
|
||||
else:
|
||||
return renumber(itemlist, item, typography)
|
||||
|
||||
|
||||
def semiautomatic_config_item(item):
|
||||
log()
|
||||
# Configurazione Semi Automatica, utile in caso la numerazione automatica fallisca
|
||||
|
||||
tvdb.find_and_set_infoLabels(item)
|
||||
item.channel = item.from_channel
|
||||
dict_series = load(item)
|
||||
title = item.fulltitle.rstrip()
|
||||
|
||||
# Trova l'ID della serie
|
||||
while not item.infoLabels['tvdb_id']:
|
||||
try:
|
||||
item.show = platformtools.dialog_input(default=item.show, heading=config.get_localized_string(30112)) # <- Enter title to search
|
||||
tvdb.find_and_set_infoLabels(item)
|
||||
except:
|
||||
heading = config.get_localized_string(70704) # <- TMDB ID (0 to cancel)
|
||||
info = platformtools.dialog_numeric(0, heading)
|
||||
item.infoLabels['tvdb_id'] = '0' if info == '' else info
|
||||
|
||||
|
||||
if item.infoLabels['tvdb_id']:
|
||||
ID = item.infoLabels['tvdb_id']
|
||||
dict_renumerate = {TAG_ID: ID}
|
||||
dict_series[title] = dict_renumerate
|
||||
|
||||
# Trova la Stagione
|
||||
if any( word in title.lower() for word in ['specials', 'speciali'] ):
|
||||
heading = config.get_localized_string(70686) # <- Enter the number of the starting season (for specials)
|
||||
season = platformtools.dialog_numeric(0, heading, '0')
|
||||
dict_renumerate[TAG_SEASON] = season
|
||||
elif RepresentsInt(title.split()[-1]):
|
||||
heading = config.get_localized_string(70686) # <- Enter the number of the starting season (for season > 1)
|
||||
season = platformtools.dialog_numeric(0, heading, title.split()[-1])
|
||||
dict_renumerate[TAG_SEASON] = season
|
||||
else:
|
||||
heading = config.get_localized_string(70686) # <- Enter the number of the starting season (for season 1)
|
||||
season = platformtools.dialog_numeric(0, heading, '1')
|
||||
dict_renumerate[TAG_SEASON] = season
|
||||
|
||||
mode = platformtools.dialog_yesno(config.get_localized_string(70687), config.get_localized_string(70688), nolabel=config.get_localized_string(30023), yeslabel=config.get_localized_string(30022))
|
||||
if mode == True:
|
||||
dict_renumerate[TAG_MODE] = False
|
||||
|
||||
if TAG_SPECIAL in dict_series[title]:
|
||||
specials = dict_renumerate[TAG_SPECIAL]
|
||||
else:
|
||||
specials = []
|
||||
|
||||
write(item, dict_series)
|
||||
_list = []
|
||||
|
||||
itemlist = find_episodes(item)
|
||||
for item in itemlist:
|
||||
Title = re.sub(r'\d+x\d+ - ', '', item.title)
|
||||
if item.action == 'findvideos':
|
||||
_list.append(Title)
|
||||
|
||||
selected = platformtools.dialog_multiselect(config.get_localized_string(70734), _list)
|
||||
# if len(selected) > 0:
|
||||
for select in selected:
|
||||
specials.append(int(scrapertools.find_single_match(_list[select], r'(\d+)')))
|
||||
dict_renumerate[TAG_SPECIAL] = specials
|
||||
|
||||
dict_renumerate[TAG_MODE] = False
|
||||
|
||||
dict_renumerate[TAG_TYPE] = 'auto'
|
||||
dict_renumerate[TAG_EPISODE] = ''
|
||||
write(item, dict_series)
|
||||
# xbmc.executebuiltin("Container.Refresh")
|
||||
|
||||
else:
|
||||
message = config.get_localized_string(60444)
|
||||
heading = item.fulltitle.strip()
|
||||
platformtools.dialog_notification(heading, message)
|
||||
|
||||
|
||||
def renumeration (itemlist, item, typography, dict_series, ID, Season, Episode, Mode, Title, Type):
|
||||
|
||||
# Se ID è 0 salta la rinumerazione
|
||||
if ID == '0':
|
||||
return itemlist
|
||||
|
||||
# Numerazione per gli Speciali
|
||||
elif Season == '0':
|
||||
EpisodeDict = {}
|
||||
for item in itemlist:
|
||||
if config.get_localized_string(30992) not in item.title:
|
||||
number = scrapertools.find_single_match(item.title, r'\d+')
|
||||
item.title = typo('0x' + number + ' - ', typography) + item.title
|
||||
|
||||
|
||||
# Usa la lista degli Episodi se esiste nel Json
|
||||
|
||||
elif Episode:
|
||||
EpisodeDict = json.loads(base64.b64decode(Episode))
|
||||
|
||||
# Controlla che la lista egli Episodi sia della stessa lunghezza di Itemlist
|
||||
if EpisodeDict == 'none':
|
||||
return error(itemlist)
|
||||
if Type == 'manual' and len(EpisodeDict) < len(itemlist):
|
||||
EpisodeDict = manual_renumeration(item, True)
|
||||
if len(EpisodeDict) >= len(itemlist) and scrapertools.find_single_match(itemlist[0].title, r'\d+') in EpisodeDict:
|
||||
for item in itemlist:
|
||||
if config.get_localized_string(30992) not in item.title:
|
||||
number = scrapertools.find_single_match(item.title, r'\d+')
|
||||
number = int(number) # if number !='0': number.lstrip('0')
|
||||
item.title = typo(EpisodeDict[str(number)] + ' - ', typography) + item.title
|
||||
else:
|
||||
make_list(itemlist, item, typography, dict_series, ID, Season, Episode, Mode, Title)
|
||||
|
||||
else:
|
||||
make_list(itemlist, item, typography, dict_series, ID, Season, Episode, Mode, Title)
|
||||
|
||||
def select_type(item):
|
||||
select = platformtools.dialog_select(config.get_localized_string(70730),[typo(config.get_localized_string(70731),'bold'), typo(config.get_localized_string(70732),'bold')])
|
||||
if select == 0: semiautomatic_config_item(item)
|
||||
else: manual_renumeration(item)
|
||||
|
||||
def manual_renumeration(item, modify=False):
|
||||
log()
|
||||
@@ -79,23 +252,24 @@ def manual_renumeration(item, modify=False):
|
||||
if item.from_channel: item.channel = item.from_channel
|
||||
title = item.fulltitle.rstrip()
|
||||
|
||||
dict_series = jsontools.get_node_from_file(item.channel, TAG_TVSHOW_RENUMERATE)
|
||||
if not dict_series.has_key(title): dict_series[title] = {}
|
||||
dict_series = load(item)
|
||||
|
||||
if dict_series[title].has_key(TAG_EPISODE) and dict_series[title][TAG_EPISODE]:
|
||||
if title not in dict_series: dict_series[title] = {}
|
||||
|
||||
if TAG_EPISODE in dict_series[title] and dict_series[title][TAG_EPISODE]:
|
||||
EpisodeDict = json.loads(base64.b64decode(dict_series[title][TAG_EPISODE]))
|
||||
del dict_series[title][TAG_EPISODE]
|
||||
else: EpisodeDict = {}
|
||||
|
||||
if dict_series[title].has_key(TAG_EPLIST): del dict_series[title][TAG_EPLIST]
|
||||
if dict_series[title].has_key(TAG_MODE): del dict_series[title][TAG_MODE]
|
||||
if dict_series[title].has_key(TAG_CHECK): del dict_series[title][TAG_CHECK]
|
||||
if dict_series[title].has_key(TAG_SEASON): del dict_series[title][TAG_SEASON]
|
||||
if dict_series[title].has_key(TAG_SPECIAL): del dict_series[title][TAG_SPECIAL]
|
||||
if TAG_EPLIST in dict_series[title]: del dict_series[title][TAG_EPLIST]
|
||||
if TAG_MODE in dict_series[title]: del dict_series[title][TAG_MODE]
|
||||
if TAG_CHECK in dict_series[title]: del dict_series[title][TAG_CHECK]
|
||||
if TAG_SEASON in dict_series[title]: del dict_series[title][TAG_SEASON]
|
||||
if TAG_SPECIAL in dict_series[title]: del dict_series[title][TAG_SPECIAL]
|
||||
dict_series[title][TAG_TYPE] = 'manual'
|
||||
write(item, dict_series)
|
||||
|
||||
jsontools.update_node(dict_series, item.channel, TAG_TVSHOW_RENUMERATE)[0]
|
||||
if not dict_series[title].has_key(TAG_ID) or (dict_series[title].has_key(TAG_ID) and not dict_series[title][TAG_ID]):
|
||||
if TAG_ID not in dict_series[title] or (TAG_ID in dict_series[title] and not dict_series[title][TAG_ID]):
|
||||
tvdb.find_and_set_infoLabels(item)
|
||||
|
||||
# Trova l'ID della serie
|
||||
@@ -113,13 +287,12 @@ def manual_renumeration(item, modify=False):
|
||||
dict_renumerate = {TAG_ID: ID}
|
||||
dict_series[title] = dict_renumerate
|
||||
|
||||
# channel = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel])
|
||||
itemlist = find_episodes(item)
|
||||
for item in itemlist:
|
||||
Title = re.sub(r'\d+x\d+ - ', '', item.title)
|
||||
if modify == True:
|
||||
ep = int(scrapertools.find_single_match(Title, r'(\d+)'))
|
||||
if item.action == 'findvideos' and not EpisodeDict.has_key(str(ep)):
|
||||
if item.action == 'findvideos' and str(ep) not in EpisodeDict:
|
||||
_list.append(Title)
|
||||
else:
|
||||
if item.action == 'findvideos':
|
||||
@@ -153,253 +326,25 @@ def manual_renumeration(item, modify=False):
|
||||
|
||||
|
||||
dict_series[title][TAG_TYPE] = 'manual'
|
||||
EpisodeDict = base64.b64encode(json.dumps(EpisodeDict))
|
||||
dict_series[title][TAG_EPISODE] = EpisodeDict
|
||||
jsontools.update_node(dict_series, item.channel, TAG_TVSHOW_RENUMERATE)[0]
|
||||
xbmc.executebuiltin("Container.Refresh")
|
||||
EpisodeDict = base64.b64encode(json.dumps(EpisodeDict).encode())
|
||||
dict_series[title][TAG_EPISODE] = EpisodeDict.decode()
|
||||
write(item, dict_series)
|
||||
# xbmc.executebuiltin("Container.Refresh")
|
||||
if modify == True:
|
||||
return json.loads(base64.b64decode(EpisodeDict))
|
||||
|
||||
|
||||
def semiautomatic_config_item(item):
|
||||
log()
|
||||
# Configurazione Semi Automatica, utile in caso la numerazione automatica fallisca
|
||||
|
||||
tvdb.find_and_set_infoLabels(item)
|
||||
item.channel = item.from_channel
|
||||
dict_series = jsontools.get_node_from_file(item.channel, TAG_TVSHOW_RENUMERATE)
|
||||
title = item.fulltitle.rstrip()
|
||||
|
||||
# Trova l'ID della serie
|
||||
while not item.infoLabels['tvdb_id']:
|
||||
try:
|
||||
item.show = platformtools.dialog_input(default=item.show, heading=config.get_localized_string(30112)) # <- Enter title to search
|
||||
tvdb.find_and_set_infoLabels(item)
|
||||
except:
|
||||
heading = config.get_localized_string(70704) # <- TMDB ID (0 to cancel)
|
||||
info = platformtools.dialog_numeric(0, heading)
|
||||
item.infoLabels['tvdb_id'] = '0' if info == '' else info
|
||||
|
||||
|
||||
if item.infoLabels['tvdb_id']:
|
||||
ID = item.infoLabels['tvdb_id']
|
||||
dict_renumerate = {TAG_ID: ID}
|
||||
dict_series[title] = dict_renumerate
|
||||
# Trova la Stagione
|
||||
if any( word in title.lower() for word in ['specials', 'speciali'] ):
|
||||
heading = config.get_localized_string(70686) # <- Enter the number of the starting season (for specials)
|
||||
season = platformtools.dialog_numeric(0, heading, '0')
|
||||
dict_renumerate[TAG_SEASON] = season
|
||||
elif RepresentsInt(title.split()[-1]):
|
||||
heading = config.get_localized_string(70686) # <- Enter the number of the starting season (for season > 1)
|
||||
season = platformtools.dialog_numeric(0, heading, title.split()[-1])
|
||||
dict_renumerate[TAG_SEASON] = season
|
||||
else:
|
||||
heading = config.get_localized_string(70686) # <- Enter the number of the starting season (for season 1)
|
||||
season = platformtools.dialog_numeric(0, heading, '1')
|
||||
dict_renumerate[TAG_SEASON] = season
|
||||
|
||||
|
||||
mode = platformtools.dialog_yesno(config.get_localized_string(70687), config.get_localized_string(70688), nolabel=config.get_localized_string(30023), yeslabel=config.get_localized_string(30022))
|
||||
if mode == True:
|
||||
dict_renumerate[TAG_MODE] = False
|
||||
if dict_series[title].has_key(TAG_SPECIAL):
|
||||
specials = dict_renumerate[TAG_SPECIAL]
|
||||
else:
|
||||
specials = []
|
||||
jsontools.update_node(dict_series, item.channel, TAG_TVSHOW_RENUMERATE)[0]
|
||||
_list = []
|
||||
# channel = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel])
|
||||
itemlist = find_episodes(item)
|
||||
for item in itemlist:
|
||||
Title = re.sub(r'\d+x\d+ - ', '', item.title)
|
||||
if item.action == 'findvideos':
|
||||
_list.append(Title)
|
||||
|
||||
selected = platformtools.dialog_multiselect(config.get_localized_string(70734), _list)
|
||||
# if len(selected) > 0:
|
||||
for select in selected:
|
||||
specials.append(int(scrapertools.find_single_match(_list[select], r'(\d+)')))
|
||||
dict_renumerate[TAG_SPECIAL] = specials
|
||||
|
||||
# stop = False
|
||||
# while not stop:
|
||||
# heading = config.get_localized_string(70718) + str(specials)
|
||||
# special = platformtools.dialog_numeric(0, heading, '')
|
||||
# if special:
|
||||
# specials.append(int(special))
|
||||
# dict_renumerate[TAG_SPECIAL] = specials
|
||||
# else: stop = True
|
||||
dict_renumerate[TAG_MODE] = False
|
||||
|
||||
dict_renumerate[TAG_TYPE] = 'auto'
|
||||
# Imposta la voce Episode
|
||||
dict_renumerate[TAG_EPISODE] = ''
|
||||
# Scrive nel json
|
||||
jsontools.update_node(dict_series, item.channel, TAG_TVSHOW_RENUMERATE)[0]
|
||||
xbmc.executebuiltin("Container.Refresh")
|
||||
|
||||
else:
|
||||
message = config.get_localized_string(60444)
|
||||
heading = item.fulltitle.strip()
|
||||
platformtools.dialog_notification(heading, message)
|
||||
|
||||
|
||||
def config_item(item, itemlist=[], typography='', active=False):
|
||||
log()
|
||||
# Configurazione Automatica, Tenta la numerazione Automatica degli episodi
|
||||
title = item.fulltitle.rstrip()
|
||||
|
||||
dict_series = jsontools.get_node_from_file(item.channel, TAG_TVSHOW_RENUMERATE)
|
||||
try: ID = dict_series[item.fulltitle.rstrip()][TAG_ID]
|
||||
except: ID = ''
|
||||
|
||||
# Pulizia del Titolo
|
||||
if any( word in title.lower() for word in ['specials', 'speciali']):
|
||||
item.fulltitle = re.sub(r'\sspecials|\sspeciali', '', item.fulltitle.lower())
|
||||
tvdb.find_and_set_infoLabels(item)
|
||||
elif not item.infoLabels['tvdb_id']:
|
||||
item.fulltitle = title.rstrip('123456789 ')
|
||||
tvdb.find_and_set_infoLabels(item)
|
||||
|
||||
if not ID and active:
|
||||
if item.infoLabels['tvdb_id']:
|
||||
ID = item.infoLabels['tvdb_id']
|
||||
dict_renumerate = {TAG_ID: ID}
|
||||
dict_series[title] = dict_renumerate
|
||||
# Trova La Stagione
|
||||
if any( word in title.lower() for word in ['specials', 'speciali']):
|
||||
dict_renumerate[TAG_SEASON] = '0'
|
||||
elif RepresentsInt(title.split()[-1]):
|
||||
dict_renumerate[TAG_SEASON] = title.split()[-1]
|
||||
else: dict_renumerate[TAG_SEASON] = '1'
|
||||
dict_renumerate[TAG_EPISODE] = ''
|
||||
settings_node = jsontools.get_node_from_file(item.channel, 'settings')
|
||||
dict_renumerate[TAG_MODE] = settings_node['autorenumber_mode']
|
||||
jsontools.update_node(dict_series, item.channel, TAG_TVSHOW_RENUMERATE)[0]
|
||||
return renumber(itemlist, item, typography)
|
||||
else:
|
||||
return itemlist
|
||||
|
||||
else:
|
||||
return renumber(itemlist, item, typography)
|
||||
|
||||
|
||||
def renumber(itemlist, item='', typography=''):
|
||||
log()
|
||||
# Carica Impostazioni
|
||||
if itemlist:
|
||||
settings_node = jsontools.get_node_from_file(itemlist[0].channel, 'settings')
|
||||
else:
|
||||
settings_node = {}
|
||||
try: dict_series = jsontools.get_node_from_file(itemlist[0].channel, TAG_TVSHOW_RENUMERATE)
|
||||
except: dict_series = {}
|
||||
# Seleziona la funzione Adatta, Menu Contestuale o Rinumerazione
|
||||
if item:
|
||||
item.channel = item.from_channel if item.from_channel else item.channel
|
||||
# Controlla se la Serie è già stata rinumerata
|
||||
TITLE = item.fulltitle.rstrip()
|
||||
log(item)
|
||||
|
||||
if inspect.stack()[2][3] == 'find_episodes':
|
||||
return itemlist
|
||||
|
||||
elif dict_series.has_key(TITLE) and dict_series[TITLE].has_key(TAG_ID):
|
||||
ID = dict_series[TITLE][TAG_ID]
|
||||
EPISODE = dict_series[TITLE][TAG_EPISODE]
|
||||
|
||||
if dict_series[TITLE].has_key(TAG_SEASON): SEASON = dict_series[TITLE][TAG_SEASON]
|
||||
else: SEASON = ''
|
||||
|
||||
if dict_series[TITLE].has_key(TAG_MODE): MODE = dict_series[TITLE][TAG_MODE]
|
||||
else: MODE = False
|
||||
|
||||
if dict_series[TITLE].has_key(TAG_TYPE):
|
||||
TYPE = dict_series[TITLE][TAG_TYPE]
|
||||
else:
|
||||
TYPE = 'auto'
|
||||
dict_series[TITLE][TAG_TYPE] = TYPE
|
||||
jsontools.update_node(dict_series, item.channel, TAG_TVSHOW_RENUMERATE)[0]
|
||||
|
||||
renumeration(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE, TYPE)
|
||||
|
||||
else:
|
||||
# se non è stata rinumerata controlla se è attiva la rinumerazione automatica
|
||||
if 'autorenumber' not in settings_node:
|
||||
return itemlist
|
||||
if settings_node['autorenumber'] == True:
|
||||
config_item(item, itemlist, typography, True)
|
||||
|
||||
else:
|
||||
for item in itemlist:
|
||||
TITLE =item.fulltitle.rstrip()
|
||||
if dict_series.has_key(TITLE) and dict_series[TITLE].has_key(TAG_ID):
|
||||
ID = dict_series[TITLE][TAG_ID]
|
||||
exist = True
|
||||
else:
|
||||
exist = False
|
||||
|
||||
if item.contentType != 'movie':
|
||||
if item.context:
|
||||
context2 = item.context
|
||||
item.show = item.fulltitle = TITLE
|
||||
item.context = context(exist) + context2
|
||||
else:
|
||||
item.show = item.fulltitle = TITLE
|
||||
item.context = context(exist)
|
||||
|
||||
def renumeration (itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE, TYPE):
|
||||
|
||||
# Se ID è 0 salta la rinumerazione
|
||||
if ID == '0':
|
||||
return itemlist
|
||||
|
||||
# Numerazione per gli Speciali
|
||||
elif SEASON == '0':
|
||||
EpisodeDict = {}
|
||||
for item in itemlist:
|
||||
if config.get_localized_string(30992) not in item.title:
|
||||
number = scrapertools.find_single_match(item.title, r'\d+')
|
||||
item.title = typo('0x' + number + ' - ', typography) + item.title
|
||||
|
||||
|
||||
# Usa la lista degli Episodi se esiste nel Json
|
||||
|
||||
elif EPISODE:
|
||||
EpisodeDict = json.loads(base64.b64decode(EPISODE))
|
||||
|
||||
# Controlla che la lista egli Episodi sia della stessa lunghezza di Itemlist
|
||||
if EpisodeDict == 'none':
|
||||
return error(itemlist)
|
||||
if TYPE == 'manual' and len(EpisodeDict) < len(itemlist):
|
||||
EpisodeDict = manual_renumeration(item, True)
|
||||
if len(EpisodeDict) >= len(itemlist) and EpisodeDict.has_key(scrapertools.find_single_match(itemlist[0].title, r'\d+')):
|
||||
for item in itemlist:
|
||||
if config.get_localized_string(30992) not in item.title:
|
||||
number = scrapertools.find_single_match(item.title, r'\d+')
|
||||
number = int(number) # if number !='0': number.lstrip('0')
|
||||
item.title = typo(EpisodeDict[str(number)] + ' - ', typography) + item.title
|
||||
else:
|
||||
make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE)
|
||||
|
||||
else:
|
||||
make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE)
|
||||
|
||||
def make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE):
|
||||
def make_list(itemlist, item, typography, dict_series, ID, Season, Episode, Mode, title):
|
||||
log()
|
||||
exist = True
|
||||
item.infoLabels['tvdb_id'] = ID
|
||||
tvdb.set_infoLabels_item(item)
|
||||
FirstOfSeason= 0
|
||||
|
||||
if EPISODE: EpisodeDict = json.loads(base64.b64decode(EPISODE))
|
||||
else: EpisodeDict = {}
|
||||
try: SPECIAL = dict_series[TITLE][TAG_SPECIAL]
|
||||
except: SPECIAL = []
|
||||
try: EpList = json.loads(base64.b64decode(dict_series[TITLE][TAG_EPLIST]))
|
||||
except: EpList = []
|
||||
try: Pages = dict_series[TITLE][TAG_CHECK]
|
||||
except: Pages = [1]
|
||||
EpisodeDict = json.loads(base64.b64decode(Episode)) if Episode else {}
|
||||
Special = dict_series[title][TAG_SPECIAL] if TAG_SPECIAL in dict_series[title] else []
|
||||
EpList = json.loads(base64.b64decode(dict_series[title][TAG_EPLIST])) if TAG_EPLIST in dict_series[title] else []
|
||||
Pages = dict_series[title][TAG_CHECK] if TAG_CHECK in dict_series[title] else [1]
|
||||
|
||||
# Ricava Informazioni da TVDB
|
||||
checkpages = []
|
||||
@@ -431,14 +376,14 @@ def make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE
|
||||
|
||||
EpList.sort()
|
||||
|
||||
dict_series[TITLE][TAG_CHECK] = checkpages
|
||||
EpList = base64.b64encode(json.dumps(EpList))
|
||||
dict_series[TITLE][TAG_EPLIST] = EpList
|
||||
jsontools.update_node(dict_series, item.channel, TAG_TVSHOW_RENUMERATE)[0]
|
||||
dict_series[title][TAG_CHECK] = checkpages
|
||||
EpList = base64.b64encode(json.dumps(EpList).encode())
|
||||
dict_series[title][TAG_EPLIST] = EpList.decode()
|
||||
write(item, dict_series)
|
||||
|
||||
# Crea Dizionari per la numerazione
|
||||
if EpList:
|
||||
EpList = json.loads(base64.b64decode(dict_series[TITLE][TAG_EPLIST]))
|
||||
EpList = json.loads(base64.b64decode(dict_series[title][TAG_EPLIST]))
|
||||
specials = []
|
||||
regular = {}
|
||||
complete = {}
|
||||
@@ -456,12 +401,12 @@ def make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE
|
||||
allep = allep + 1
|
||||
|
||||
# seleziona l'Episodio di partenza
|
||||
if int(SEASON) > 1:
|
||||
if int(Season) > 1:
|
||||
for numbers, data in regular.items():
|
||||
if data[0] == SEASON + 'x1':
|
||||
if data[0] == Season + 'x1':
|
||||
FirstOfSeason = numbers - 1
|
||||
|
||||
if MODE == True: SPECIAL = specials
|
||||
if Mode == True: Special = specials
|
||||
|
||||
addiction = 0
|
||||
for item in itemlist:
|
||||
@@ -474,8 +419,8 @@ def make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE
|
||||
|
||||
if episode == 0:
|
||||
EpisodeDict[str(episode)] = str(complete[regular[FirstOfSeason+1][2]][0])
|
||||
elif addiction < len(SPECIAL):
|
||||
if episode in SPECIAL:
|
||||
elif addiction < len(Special):
|
||||
if episode in Special:
|
||||
try:
|
||||
season = complete[regular[count][2]][0]
|
||||
EpisodeDict[str(episode)] = str(complete[regular[count][2]][0]) if season.startswith( '0' ) else '0x' + platformtools.dialog_numeric(0, item.title + '?', '')
|
||||
@@ -499,22 +444,41 @@ def make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE
|
||||
item.title = typo(EpisodeDict[str(episode)] + ' - ', typography) + item.title
|
||||
|
||||
# Scrive Dizionario Episodi sul json
|
||||
EpisodeDict = base64.b64encode(json.dumps(EpisodeDict))
|
||||
dict_series[TITLE][TAG_EPISODE] = EpisodeDict
|
||||
jsontools.update_node(dict_series, item.channel, TAG_TVSHOW_RENUMERATE)[0]
|
||||
EpisodeDict = base64.b64encode(json.dumps(EpisodeDict).encode())
|
||||
dict_series[title][TAG_EPISODE] = EpisodeDict.decode()
|
||||
write(item, dict_series)
|
||||
|
||||
else:
|
||||
heading = config.get_localized_string(70704)
|
||||
ID = platformtools.dialog_numeric(0, heading)
|
||||
dict_series[TITLE][TAG_ID] = ID
|
||||
jsontools.update_node(dict_series, item.channel, TAG_TVSHOW_RENUMERATE)[0]
|
||||
dict_series[title][TAG_ID] = ID
|
||||
write(item, dict_series)
|
||||
if ID == '0':
|
||||
return itemlist
|
||||
else:
|
||||
return make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE)
|
||||
return make_list(itemlist, item, typography, dict_series, ID, Season, Episode, Mode, title)
|
||||
|
||||
# return itemlist
|
||||
|
||||
def check(item):
|
||||
log()
|
||||
dict_series = load(item)
|
||||
title = item.fulltitle.rstrip()
|
||||
if title in dict_series: title = dict_series[title]
|
||||
return True if TAG_ID in title and TAG_EPISODE in title else False
|
||||
|
||||
|
||||
def error(itemlist):
|
||||
message = config.get_localized_string(70713)
|
||||
heading = itemlist[0].fulltitle.strip()
|
||||
platformtools.dialog_notification(heading, message)
|
||||
return itemlist
|
||||
|
||||
|
||||
def find_episodes(item):
|
||||
log()
|
||||
ch = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel])
|
||||
itemlist = ch.episodios(item)
|
||||
return itemlist
|
||||
|
||||
|
||||
def RepresentsInt(s):
|
||||
@@ -526,25 +490,58 @@ def RepresentsInt(s):
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
def error(itemlist):
|
||||
message = config.get_localized_string(70713)
|
||||
heading = itemlist[0].fulltitle.strip()
|
||||
platformtools.dialog_notification(heading, message)
|
||||
return itemlist
|
||||
|
||||
def check(item):
|
||||
try:
|
||||
dict_series = jsontools.get_node_from_file(item.channel, TAG_TVSHOW_RENUMERATE)
|
||||
TITLE = item.fulltitle.rstrip()
|
||||
dict_series[TITLE][TAG_ID]
|
||||
dict_series[TITLE][TAG_EPISODE]
|
||||
exist = True
|
||||
except:
|
||||
exist = False
|
||||
return exist
|
||||
def access():
|
||||
allow = False
|
||||
|
||||
def find_episodes(item):
|
||||
if config.is_xbmc():
|
||||
allow = True
|
||||
|
||||
return allow
|
||||
|
||||
|
||||
def context(exist):
|
||||
if access():
|
||||
modify = config.get_localized_string(70714) if exist else ''
|
||||
_context = [{"title": typo(modify + config.get_localized_string(70585), 'bold'),
|
||||
"action": "select_type",
|
||||
"channel": "autorenumber",}]
|
||||
|
||||
return _context
|
||||
|
||||
|
||||
def select_type(item):
|
||||
select = platformtools.dialog_select(config.get_localized_string(70730),[typo(config.get_localized_string(70731),'bold'), typo(config.get_localized_string(70732),'bold')])
|
||||
if select == 0: semiautomatic_config_item(item)
|
||||
else: manual_renumeration(item)
|
||||
|
||||
|
||||
def filename(item):
|
||||
log()
|
||||
ch = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel])
|
||||
itemlist = ch.episodios(item)
|
||||
return itemlist
|
||||
name_file = item.channel + "_data.json"
|
||||
path = filetools.join(config.get_data_path(), "settings_channels")
|
||||
fname = filetools.join(path, name_file)
|
||||
|
||||
return fname
|
||||
|
||||
|
||||
def load(item):
|
||||
log()
|
||||
try:
|
||||
json_file = open(filename(item), "r").read()
|
||||
json = jsontools.load(json_file)[TAG_TVSHOW_RENUMERATE]
|
||||
|
||||
except:
|
||||
json = {}
|
||||
|
||||
return json
|
||||
|
||||
|
||||
def write(item, json):
|
||||
log()
|
||||
json_file = open(filename(item), "r").read()
|
||||
js = jsontools.load(json_file)
|
||||
js[TAG_TVSHOW_RENUMERATE] = json
|
||||
with open(filename(item), "w") as file:
|
||||
file.write(jsontools.dump(js))
|
||||
file.close()
|
||||
|
||||
+39
-8
@@ -168,7 +168,14 @@ def peliculas(item, json='', key='', itemlist=[]):
|
||||
itlist = filterkey = []
|
||||
action = 'findvideos'
|
||||
|
||||
for option in json:
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'search']:
|
||||
Pagination = int(defp) if defp.isdigit() else ''
|
||||
else: Pagination = ''
|
||||
pag = item.page if item.page else 1
|
||||
|
||||
for i, option in enumerate(json):
|
||||
if Pagination and (pag - 1) * Pagination > i: continue # pagination
|
||||
if Pagination and i >= pag * Pagination: break
|
||||
if item.filterkey and item.filterkey in option:
|
||||
filterkey = [it.lower() for it in option[item.filterkey]] if type(option[item.filterkey]) == list else [option[item.filterkey].lower()]
|
||||
title = option['title'] if 'title' in option else ''
|
||||
@@ -203,7 +210,13 @@ def peliculas(item, json='', key='', itemlist=[]):
|
||||
if not 'generic_list' in key:
|
||||
tmdb.set_infoLabels(itlist, seekTmdb=True)
|
||||
itemlist += itlist
|
||||
itemlist = pagination(item, itemlist)
|
||||
|
||||
if Pagination and len(itemlist) >= Pagination:
|
||||
if inspect.stack()[1][3] != 'get_newest':
|
||||
item.title = support.typo(config.get_localized_string(30992), 'color kod bold')
|
||||
item.page = pag + 1
|
||||
item.thumbnail = support.thumb()
|
||||
itemlist.append(item)
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -259,8 +272,16 @@ def episodios(item, json ='', key='', itemlist =[]):
|
||||
# set variable
|
||||
ep = 1
|
||||
season = infoLabels['season'] if 'season' in infoLabels else item.contentSeason if item.contentSeason else 1
|
||||
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'search']:
|
||||
Pagination = int(defp) if defp.isdigit() else ''
|
||||
else: Pagination = ''
|
||||
pag = item.page if item.page else 1
|
||||
|
||||
# make items
|
||||
for option in json:
|
||||
for i, option in enumerate(json):
|
||||
if Pagination and (pag - 1) * Pagination > i: continue # pagination
|
||||
if Pagination and i >= pag * Pagination: break
|
||||
# build numeration of episodes
|
||||
numeration = option['number'] if 'number' in option else option['title']
|
||||
match = support.match(numeration , patron=r'(?P<season>\d+)x(?P<episode>\d+)').match
|
||||
@@ -300,7 +321,7 @@ def episodios(item, json ='', key='', itemlist =[]):
|
||||
path = item.path))
|
||||
|
||||
# if showseason
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'get_newest']:
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'get_newest', 'search']:
|
||||
if show_seasons and not item.filterseason:
|
||||
itm.contentType='season'
|
||||
season_list = []
|
||||
@@ -320,8 +341,14 @@ def episodios(item, json ='', key='', itemlist =[]):
|
||||
infoLabels=infoLabels,
|
||||
filterseason=str(season),
|
||||
path=item.path))
|
||||
|
||||
elif defpage and inspect.stack()[1][3] not in ['get_seasons']:
|
||||
itemlist = pagination(item, itemlist)
|
||||
if Pagination and len(itemlist) >= Pagination:
|
||||
if inspect.stack()[1][3] != 'get_newest':
|
||||
item.title = support.typo(config.get_localized_string(30992), 'color kod bold')
|
||||
item.page = pag + 1
|
||||
item.thumbnail = support.thumb()
|
||||
itemlist.append(item)
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -449,7 +476,11 @@ def get_search_menu(item, json='', itemlist=[], channel_name=''):
|
||||
|
||||
|
||||
def submenu(item, json, key, itemlist = []):
|
||||
from lib.concurrent import futures
|
||||
import sys
|
||||
if sys.version_info[0] >= 3:
|
||||
from concurrent import futures
|
||||
else:
|
||||
from concurrent_py2 import futures
|
||||
|
||||
filter_list = []
|
||||
for option in json[key]:
|
||||
@@ -632,7 +663,7 @@ def pagination(item, itemlist = []):
|
||||
encoded_itemlist = []
|
||||
for it in itemlist:
|
||||
encoded_itemlist.append(it.tourl())
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes']:
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'search']:
|
||||
Pagination = int(defp) if defp.isdigit() else ''
|
||||
else: Pagination = ''
|
||||
pag = item.page if item.page else 1
|
||||
@@ -643,7 +674,7 @@ def pagination(item, itemlist = []):
|
||||
|
||||
itlist.append(item)
|
||||
|
||||
if Pagination and len(itemlist) > pag * Pagination:
|
||||
if Pagination and len(itemlist) >= Pagination:
|
||||
if inspect.stack()[1][3] != 'get_newest':
|
||||
itlist.append(
|
||||
Item(channel=item.channel,
|
||||
|
||||
+4
-56
@@ -8,36 +8,6 @@
|
||||
"movie"
|
||||
],
|
||||
"settings": [
|
||||
{
|
||||
"type": "label",
|
||||
"label": "@70229",
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "library_add",
|
||||
"type": "bool",
|
||||
"label": "@70230",
|
||||
"default": false,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "library_move",
|
||||
"type": "bool",
|
||||
"label": "@70231",
|
||||
"default": false,
|
||||
"enabled": "eq(-1,true)",
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "browser",
|
||||
"type": "bool",
|
||||
"label": "@70232",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"type": "label",
|
||||
"label": "@70243",
|
||||
@@ -122,28 +92,6 @@
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "quality",
|
||||
"type": "list",
|
||||
"label": "@70240",
|
||||
"lvalues": [
|
||||
"@70241",
|
||||
"HD 1080",
|
||||
"HD 720",
|
||||
"SD"
|
||||
],
|
||||
"default": 0,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "server_speed",
|
||||
"type": "bool",
|
||||
"label": "@70242",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "server_reorder",
|
||||
"type": "list",
|
||||
@@ -161,10 +109,10 @@
|
||||
"type": "list",
|
||||
"label": "@70246",
|
||||
"lvalues": [
|
||||
"Ita, Sub, Eng, Vos, Vosi",
|
||||
"Eng, Ita, Sub, Vos, Vosi",
|
||||
"Sub, Ita, Eng, Vos, Vosi",
|
||||
"Eng, Sub, Ita, Vos, Vosi"
|
||||
"Ita, Sub, Eng",
|
||||
"Eng, Ita, Sub",
|
||||
"Sub, Ita, Eng",
|
||||
"Eng, Sub, Ita"
|
||||
],
|
||||
"default": 0,
|
||||
"enabled": "eq(-1,'@70245')",
|
||||
|
||||
+25
-10
@@ -112,7 +112,7 @@ def mainlist(item):
|
||||
contentType=item.contentType, contentChannel=item.contentChannel,
|
||||
contentSerieName=item.contentSerieName))
|
||||
|
||||
if not item.contentType == "tvshow" and config.get_setting("browser", "downloads") == True:
|
||||
if not item.contentType == "tvshow" and config.get_setting("browser") == True:
|
||||
itemlist.insert(0, Item(channel=item.channel, action="browser", title=support.typo(config.get_localized_string(70222),'bold'),url=DOWNLOAD_PATH))
|
||||
|
||||
if not item.contentType == "tvshow":
|
||||
@@ -130,18 +130,31 @@ def settings(item):
|
||||
def browser(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
context = [{ 'title': 'cancella', 'channel': 'downloads', 'action': "del_file"}]
|
||||
|
||||
for file in filetools.listdir(item.url):
|
||||
if file == "list": continue
|
||||
if filetools.isdir(filetools.join(item.url, file)):
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, title=file, action=item.action, url=filetools.join(item.url, file)))
|
||||
itemlist.append(Item(channel=item.channel, title=file, action=item.action, url=filetools.join(item.url, file), context=[{ 'title': config.get_localized_string(30037), 'channel': 'downloads', 'action': "del_dir"}]))
|
||||
else:
|
||||
itemlist.append(Item(channel=item.channel, title=file, action="play", url=filetools.join(item.url, file)))
|
||||
itemlist.append(Item(channel=item.channel, title=file, action="play", url=filetools.join(item.url, file), context=[{ 'title': config.get_localized_string(30039), 'channel': 'downloads', 'action': "del_file"}]))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def del_file(item):
|
||||
ok = platformtools.dialog_yesno(config.get_localized_string(30039),config.get_localized_string(30040))
|
||||
if ok:
|
||||
filetools.remove(item.url)
|
||||
platformtools.itemlist_refresh()
|
||||
|
||||
def del_dir(item):
|
||||
ok = platformtools.dialog_yesno(config.get_localized_string(30037),config.get_localized_string(30038))
|
||||
if ok:
|
||||
filetools.rmdirtree(item.url)
|
||||
platformtools.itemlist_refresh()
|
||||
|
||||
|
||||
def clean_all(item):
|
||||
logger.info()
|
||||
|
||||
@@ -285,7 +298,7 @@ def move_to_libray(item):
|
||||
library_path = filetools.join(move_path, *filetools.split(item.downloadFilename))
|
||||
final_path = download_path
|
||||
|
||||
if config.get_setting("library_add", "downloads") == True and config.get_setting("library_move", "downloads") == True:
|
||||
if config.get_setting("library_add") == True and config.get_setting("library_move") == True:
|
||||
if not filetools.isdir(filetools.dirname(library_path)):
|
||||
filetools.mkdir(filetools.dirname(library_path))
|
||||
|
||||
@@ -322,7 +335,7 @@ def move_to_libray(item):
|
||||
xbmc.sleep(500)
|
||||
xbmc_videolibrary.clean()
|
||||
|
||||
if config.get_setting("library_add", "downloads") == True and config.get_setting("library_move", "downloads") == False:
|
||||
if config.get_setting("library_add") == True and config.get_setting("library_move") == False:
|
||||
if filetools.isfile(final_path):
|
||||
if item.contentType == "movie" and item.infoLabels["tmdb_id"]:
|
||||
library_item = Item(title=config.get_localized_string(70228) % item.downloadFilename, channel="downloads",
|
||||
@@ -471,7 +484,7 @@ def sort_method(item):
|
||||
"VOSI": ["VOSI"]}
|
||||
|
||||
order_list_calidad = ["BLURAY", "FULLHD", "HD", "480P", "360P", "240P"]
|
||||
order_list_calidad = quality_orders[int(config.get_setting("quality", "downloads"))]
|
||||
order_list_calidad = quality_orders[int(config.get_setting("quality"))]
|
||||
match_list_calidad = {"BLURAY": ["BR", "BLURAY", '4K'],
|
||||
"FULLHD": ["FULLHD", "FULL HD", "1080", "HD1080", "HD 1080", "1080p"],
|
||||
"HD": ["HD", "HD REAL", "HD 720", "720", "HDTV", "720p"],
|
||||
@@ -482,7 +495,7 @@ def sort_method(item):
|
||||
value = (get_match_list(item.title, match_list_idimas, order_list_idiomas, ignorecase=True, only_ascii=True).index, \
|
||||
get_match_list(item.title, match_list_calidad, order_list_calidad, ignorecase=True, only_ascii=True).index)
|
||||
|
||||
if config.get_setting("server_speed", "downloads"):
|
||||
if config.get_setting("server_speed"):
|
||||
value += tuple([get_server_position(item.server)])
|
||||
|
||||
return value
|
||||
@@ -723,8 +736,8 @@ def start_download(item):
|
||||
|
||||
|
||||
def get_episodes(item):
|
||||
logger.info("contentAction: %s | contentChannel: %s | contentType: %s" % (
|
||||
item.contentAction, item.contentChannel, item.contentType))
|
||||
logger.info("contentAction: %s | contentChannel: %s | contentType: %s" % (item.contentAction, item.contentChannel, item.contentType))
|
||||
|
||||
if 'dlseason' in item:
|
||||
season = True
|
||||
season_number = item.dlseason
|
||||
@@ -787,6 +800,8 @@ def get_episodes(item):
|
||||
itemlist.append(episode)
|
||||
else:
|
||||
itemlist.append(episode)
|
||||
|
||||
|
||||
# Cualquier otro resultado no nos vale, lo ignoramos
|
||||
else:
|
||||
logger.info("Omitiendo item no válido: %s" % episode.tostring())
|
||||
|
||||
@@ -82,7 +82,7 @@ def mainlist(item):
|
||||
return itemlist
|
||||
|
||||
def server_config(item):
|
||||
return platformtools.show_channel_settings(channelpath=filetools.join(config.get_runtime_path(), "specials", item.config))
|
||||
return platformtools.show_channel_settings(channelpath=filetools.join(config.get_runtime_path(), "server", item.config))
|
||||
|
||||
def now_on_misc_film(item):
|
||||
logger.info("filmontv tvoggi")
|
||||
|
||||
+2
-2
@@ -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"),
|
||||
|
||||
@@ -56,6 +56,8 @@ if xinfoplus_set == config.get_localized_string(70129):
|
||||
set_animation = False
|
||||
if xinfoplus_set == config.get_localized_string(70130):
|
||||
set_animation = True
|
||||
else:
|
||||
set_animation = xinfoplus_set
|
||||
|
||||
def start(item, recomendaciones=[], from_window=False):
|
||||
if from_window:
|
||||
|
||||
+18
-18
@@ -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
|
||||
|
||||
+2
-2
@@ -591,8 +591,8 @@ def menu_opciones(item):
|
||||
# itemlist.append(Item(channel=item.channel, action="setting_channel", extra="latino", title=config.get_localized_string(70213),
|
||||
# thumbnail=get_thumb("channels_documentary.png"), folder=False))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="setting_channel", extra="Torrent", title=config.get_localized_string(70214),
|
||||
thumbnail=get_thumb("channels_documentary.png"), folder=False))
|
||||
# itemlist.append(Item(channel=item.channel, action="setting_channel", extra="torrent", title=config.get_localized_string(70214),
|
||||
# thumbnail=get_thumb("channels_documentary.png"), folder=False))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="setting_channel", extra="documentales",
|
||||
title=config.get_localized_string(60530),
|
||||
|
||||
+8
-2
@@ -4,7 +4,11 @@ from platformcode import config, platformtools, logger
|
||||
from time import time, sleep
|
||||
from core import scrapertools
|
||||
from core import jsontools, filetools
|
||||
from lib.concurrent import futures
|
||||
import sys
|
||||
if sys.version_info[0] >= 3:
|
||||
from concurrent import futures
|
||||
else:
|
||||
from concurrent_py2 import futures
|
||||
|
||||
next_dialogs = ['NextDialog.xml', 'NextDialogExtended.xml', 'NextDialogCompact.xml']
|
||||
next_ep_type = config.get_setting('next_ep_type')
|
||||
@@ -53,7 +57,9 @@ def next_ep(item):
|
||||
time_over = False
|
||||
time_limit = time() + 30
|
||||
time_steps = [20,30,40,50,60,70,80,90,100,110,120]
|
||||
TimeFromEnd = time_steps[config.get_setting('next_ep_seconds')]
|
||||
time_setting = config.get_setting('next_ep_seconds')
|
||||
TimeFromEnd = time_setting if time_setting > 10 else time_steps[time_setting]
|
||||
|
||||
|
||||
# wait until the video plays
|
||||
while not platformtools.is_playing() and time() < time_limit:
|
||||
|
||||
+14
-10
@@ -12,7 +12,11 @@ PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
import os, json, time, inspect, channelselector
|
||||
from concurrent import futures
|
||||
|
||||
if PY3:
|
||||
from concurrent import futures
|
||||
else:
|
||||
from concurrent_py2 import futures
|
||||
from core.item import Item
|
||||
from core import tmdb, scrapertools, channeltools, filetools, jsontools
|
||||
from channelselector import get_thumb
|
||||
@@ -43,7 +47,7 @@ def mainlist(item):
|
||||
|
||||
Item(channel=item.channel, title=typo(config.get_localized_string(59994), 'color kod bold'), action='opciones', thumbnail=get_thumb('setting_0.png')),
|
||||
|
||||
Item(channel=item.channel, title=typo(config.get_localized_string(30100), 'color kod bold'), action='settings', thumbnail=get_thumb('setting_0.png'))]
|
||||
Item(channel='shortcuts', title=typo(config.get_localized_string(30100), 'color kod bold'), action='SettingOnPosition', category=3, thumbnail=get_thumb('setting_0.png'))]
|
||||
|
||||
itemlist = set_context(itemlist)
|
||||
|
||||
@@ -110,7 +114,8 @@ def new_search(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
if channeltools.get_channel_setting('last_search', 'search'):
|
||||
if config.get_setting('last_search'):
|
||||
# if channeltools.get_channel_setting('last_search', 'search'):
|
||||
last_search = channeltools.get_channel_setting('Last_searched', 'search', '')
|
||||
else:
|
||||
last_search = ''
|
||||
@@ -249,7 +254,7 @@ def channel_search(item):
|
||||
if it in valid:
|
||||
continue
|
||||
if mode == 'all' or (it.contentType and mode == it.contentType):
|
||||
if config.get_setting('result_mode', 'search') != 0:
|
||||
if config.get_setting('result_mode') != 0:
|
||||
if config.get_localized_string(30992) not in it.title:
|
||||
it.title += typo(ch_name,'_ [] color kod bold')
|
||||
results.append(it)
|
||||
@@ -263,7 +268,7 @@ def channel_search(item):
|
||||
if not grouped:
|
||||
continue
|
||||
# to_temp[key] = grouped
|
||||
if config.get_setting('result_mode', 'search') == 0:
|
||||
if config.get_setting('result_mode') == 0:
|
||||
if not config.get_setting('unify'):
|
||||
title = typo(ch_name,'bold') + typo(str(len(grouped)), '_ [] color kod bold')
|
||||
else:
|
||||
@@ -353,7 +358,7 @@ def get_channels(item):
|
||||
list_cat[n] = 'tvshow'
|
||||
|
||||
if item.mode == 'all' or (item.mode in list_cat):
|
||||
if config.get_setting("include_in_global_search", channel):
|
||||
if config.get_setting("include_in_global_search", channel) and ch_param.get("active", False):
|
||||
channels_list.append(channel)
|
||||
title_list.append(ch_param.get('title', channel))
|
||||
|
||||
@@ -367,9 +372,8 @@ def settings(item):
|
||||
return platformtools.show_channel_settings(caption=config.get_localized_string(59993))
|
||||
|
||||
def set_workers():
|
||||
list_mode=[None,1,2,4,6,8,16,24,32,64]
|
||||
index = config.get_setting('thread_number', 'search')
|
||||
return list_mode[index]
|
||||
workers = config.get_setting('thread_number') if config.get_setting('thread_number') > 0 else None
|
||||
return workers
|
||||
|
||||
def setting_channel_new(item):
|
||||
import xbmcgui
|
||||
@@ -719,7 +723,7 @@ def get_from_temp(item):
|
||||
|
||||
def save_search(text):
|
||||
if text:
|
||||
saved_searches_limit = int((10, 20, 30, 40)[int(config.get_setting("saved_searches_limit", "search"))])
|
||||
saved_searches_limit = config.get_setting("saved_searches_limit")
|
||||
|
||||
current_saved_searches_list = config.get_setting("saved_searches_list", "search")
|
||||
if current_saved_searches_list is None:
|
||||
|
||||
+8
-8
@@ -155,7 +155,7 @@ def setting_torrent(item):
|
||||
{
|
||||
"id": "mct_buffer",
|
||||
"type": "text",
|
||||
"label": "MCT - Tamaño del Buffer a descargar antes de la reproducción",
|
||||
"label": "MCT - " + config.get_localized_string(70758),
|
||||
"default": BUFFER,
|
||||
"enabled": True,
|
||||
"visible": "eq(-1,%s)" % torrent_options[2]
|
||||
@@ -163,7 +163,7 @@ def setting_torrent(item):
|
||||
{
|
||||
"id": "mct_download_path",
|
||||
"type": "text",
|
||||
"label": "MCT - Ruta de la carpeta de descarga",
|
||||
"label": "MCT - " + config.get_localized_string(30017),
|
||||
"default": DOWNLOAD_PATH,
|
||||
"enabled": True,
|
||||
"visible": "eq(-2,%s)" % torrent_options[2]
|
||||
@@ -171,7 +171,7 @@ def setting_torrent(item):
|
||||
{
|
||||
"id": "bt_buffer",
|
||||
"type": "text",
|
||||
"label": "BT - Tamaño del Buffer a descargar antes de la reproducción",
|
||||
"label": "BT - " + config.get_localized_string(70758),
|
||||
"default": BUFFER_BT,
|
||||
"enabled": True,
|
||||
"visible": "eq(-3,%s)" % torrent_options[1]
|
||||
@@ -179,7 +179,7 @@ def setting_torrent(item):
|
||||
{
|
||||
"id": "bt_download_path",
|
||||
"type": "text",
|
||||
"label": "BT - Ruta de la carpeta de descarga",
|
||||
"label": "BT - " + config.get_localized_string(30017),
|
||||
"default": DOWNLOAD_PATH_BT,
|
||||
"enabled": True,
|
||||
"visible": "eq(-4,%s)" % torrent_options[1]
|
||||
@@ -187,7 +187,7 @@ def setting_torrent(item):
|
||||
{
|
||||
"id": "mct_download_limit",
|
||||
"type": "text",
|
||||
"label": "Límite (en Kb's) de la velocidad de descarga en segundo plano (NO afecta a RAR)",
|
||||
"label": config.get_localized_string(70759),
|
||||
"default": DOWNLOAD_LIMIT,
|
||||
"enabled": True,
|
||||
"visible": "eq(-5,%s) | eq(-5,%s)" % (torrent_options[1], torrent_options[2])
|
||||
@@ -195,7 +195,7 @@ def setting_torrent(item):
|
||||
{
|
||||
"id": "mct_rar_unpack",
|
||||
"type": "bool",
|
||||
"label": "¿Quiere que se descompriman los archivos RAR y ZIP para su reproducción?",
|
||||
"label": config.get_localized_string(70760),
|
||||
"default": RAR,
|
||||
"enabled": True,
|
||||
"visible": True
|
||||
@@ -203,7 +203,7 @@ def setting_torrent(item):
|
||||
{
|
||||
"id": "mct_background_download",
|
||||
"type": "bool",
|
||||
"label": "¿Se procesa la descompresión de RARs en segundo plano?",
|
||||
"label": config.get_localized_string(70761),
|
||||
"default": BACKGROUND,
|
||||
"enabled": True,
|
||||
"visible": True
|
||||
@@ -211,7 +211,7 @@ def setting_torrent(item):
|
||||
{
|
||||
"id": "magnet2torrent",
|
||||
"type": "bool",
|
||||
"label": "¿Quiere convertir los Magnets a Torrents para ver tamaños y almacenarlos?",
|
||||
"label": config.get_localized_string(70762),
|
||||
"default": MAGNET2TORRENT,
|
||||
"enabled": True,
|
||||
"visible": True
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from platformcode import logger
|
||||
|
||||
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()
|
||||
|
||||
def servers_menu(item):
|
||||
# from core.support import dbg; dbg()
|
||||
from core import servertools
|
||||
from core.item import Item
|
||||
from platformcode import config, platformtools
|
||||
from specials import setting
|
||||
|
||||
names = []
|
||||
ids = []
|
||||
|
||||
if item.type == 'debriders':
|
||||
action = 'server_debrid_config'
|
||||
server_list = list(servertools.get_debriders_list().keys())
|
||||
for server in server_list:
|
||||
server_parameters = servertools.get_server_parameters(server)
|
||||
if server_parameters['has_settings']:
|
||||
names.append(server_parameters['name'])
|
||||
ids.append(server)
|
||||
|
||||
select = platformtools.dialog_select(config.get_localized_string(60552), names)
|
||||
ID = ids[select]
|
||||
|
||||
it = Item(channel = 'settings',
|
||||
action = action,
|
||||
config = ID)
|
||||
return setting.server_debrid_config(it)
|
||||
else:
|
||||
action = 'server_config'
|
||||
server_list = list(servertools.get_servers_list().keys())
|
||||
for server in sorted(server_list):
|
||||
server_parameters = servertools.get_server_parameters(server)
|
||||
if server_parameters["has_settings"] and [x for x in server_parameters["settings"] if x["id"] not in ["black_list", "white_list"]]:
|
||||
names.append(server_parameters['name'])
|
||||
ids.append(server)
|
||||
|
||||
select = platformtools.dialog_select(config.get_localized_string(60538), names)
|
||||
ID = ids[select]
|
||||
|
||||
it = Item(channel = 'settings',
|
||||
action = action,
|
||||
config = ID)
|
||||
|
||||
return setting.server_config(it)
|
||||
|
||||
def channels_menu(item):
|
||||
import channelselector
|
||||
from core import channeltools
|
||||
from core.item import Item
|
||||
from platformcode import config, platformtools
|
||||
from specials import setting
|
||||
|
||||
names = []
|
||||
ids = []
|
||||
|
||||
channel_list = channelselector.filterchannels("all")
|
||||
for channel in channel_list:
|
||||
if not channel.channel:
|
||||
continue
|
||||
channel_parameters = channeltools.get_channel_parameters(channel.channel)
|
||||
if channel_parameters["has_settings"]:
|
||||
names.append(channel.title)
|
||||
ids.append(channel.channel)
|
||||
|
||||
select = platformtools.dialog_select(config.get_localized_string(60537), names)
|
||||
ID = ids[select]
|
||||
|
||||
it = Item(channel='settings',
|
||||
action="channel_config",
|
||||
config=ID)
|
||||
|
||||
return setting.channel_config(it)
|
||||
|
||||
def check_channels(item):
|
||||
from specials import setting
|
||||
from platformcode import config, platformtools
|
||||
# from core.support import dbg; dbg()
|
||||
item.channel = 'setting'
|
||||
item.extra = 'lib_check_datajson'
|
||||
itemlist = setting.conf_tools(item)
|
||||
text = ''
|
||||
for item in itemlist:
|
||||
text += item.title + '\n'
|
||||
|
||||
platformtools.dialog_textviewer(config.get_localized_string(60537), text)
|
||||
|
||||
|
||||
def SettingOnPosition(item):
|
||||
# addonId is the Addon ID
|
||||
# item.category is the Category (Tab) offset (0=first, 1=second, 2...etc)
|
||||
# item.setting is the Setting (Control) offse (0=first, 1=second, 2...etc)
|
||||
# This will open settings dialog focusing on fourth setting (control) inside the third category (tab)
|
||||
|
||||
import xbmc
|
||||
|
||||
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.kod)')
|
||||
category = item.category if item.category else 0
|
||||
setting = item.setting if item.setting else 0
|
||||
logger.info('SETTING= ' + str(setting))
|
||||
xbmc.executebuiltin('SetFocus(%i)' % (category - 100))
|
||||
xbmc.executebuiltin('SetFocus(%i)' % (setting - 80))
|
||||
|
||||
|
||||
def select(item):
|
||||
from platformcode import config, platformtools
|
||||
# item.id = setting ID
|
||||
# item.type = labels or values
|
||||
# item.values = values separeted by |
|
||||
# item.label = string or string id
|
||||
|
||||
label = config.get_localized_string(int(item.label)) if item.label.isdigit() else item.label
|
||||
values = []
|
||||
|
||||
if item.type == 'labels':
|
||||
for val in item.values.split('|'):
|
||||
values.append(config.get_localized_string(int(val)))
|
||||
else:
|
||||
values = item.values.split('|')
|
||||
|
||||
select = platformtools.dialog_select(label, values)
|
||||
config.set_setting(item.id, values[select])
|
||||
Reference in New Issue
Block a user