Modifiche del 26/11/2021
This commit is contained in:
+8
-4
@@ -36,9 +36,13 @@ def encode(obj):
|
||||
def decode(obj):
|
||||
return pickle.loads(zlib.decompress(bytes(obj)))
|
||||
|
||||
db_name = filetools.join(config.get_data_path(), "db.sqlite")
|
||||
db = nested_dict_sqlite(lambda table: SqliteDict(db_name, table, 'c', True))
|
||||
db_name = filetools.join(config.getDataPath(), "db.sqlite")
|
||||
vdb_name = filetools.join(config.getVideolibraryPath(), "videolibrary.sqlite")
|
||||
|
||||
vdb_name = filetools.join(config.get_videolibrary_path(), "videolibrary.sqlite")
|
||||
# videolibrarydb = nested_dict_sqlite(lambda table: SqliteDict(vdb_name, table, 'c', True))
|
||||
db = nested_dict_sqlite(lambda table: SqliteDict(db_name, table, 'c', True))
|
||||
videolibrarydb = nested_dict_sqlite(lambda table: SqliteDict(vdb_name, table, 'c', True, encode=encode, decode=decode))
|
||||
|
||||
|
||||
if 'played_time' not in SqliteDict.get_tablenames(vdb_name):
|
||||
for k, v in dict(db['viewed']).items():
|
||||
videolibrarydb['played_time'][k] = v
|
||||
|
||||
+21
-21
@@ -32,13 +32,13 @@ def start(itemlist, item):
|
||||
if not config.is_xbmc():
|
||||
return itemlist
|
||||
|
||||
if config.get_setting('autoplay') or item.autoplay:
|
||||
if config.getSetting('autoplay') or item.autoplay:
|
||||
# Save the current value of "Action and Player Mode" in preferences
|
||||
user_config_setting_action = config.get_setting("default_action")
|
||||
# user_config_setting_player = config.get_setting("player_mode")
|
||||
user_config_setting_action = config.getSetting("default_action")
|
||||
# user_config_setting_player = config.getSetting("player_mode")
|
||||
|
||||
# Enable the "View in high quality" action (if the server returns more than one quality, eg gdrive)
|
||||
if not user_config_setting_action: config.set_setting("default_action", 2)
|
||||
if not user_config_setting_action: config.setSetting("default_action", 2)
|
||||
|
||||
from core.servertools import sort_servers
|
||||
autoplay_list = sort_servers(itemlist)
|
||||
@@ -48,8 +48,8 @@ def start(itemlist, item):
|
||||
max_intents_servers = {}
|
||||
|
||||
# If something is playing it stops playing
|
||||
if platformtools.is_playing():
|
||||
platformtools.stop_video()
|
||||
if platformtools.isPlaying():
|
||||
platformtools.stopVideo()
|
||||
|
||||
for autoplay_elem in autoplay_list:
|
||||
play_item = Item
|
||||
@@ -57,7 +57,7 @@ def start(itemlist, item):
|
||||
if autoplay_elem.channel == 'videolibrary':
|
||||
channel_id = autoplay_elem.contentChannel
|
||||
|
||||
if not platformtools.is_playing() and not PLAYED:
|
||||
if not platformtools.isPlaying() and not PLAYED:
|
||||
videoitem = autoplay_elem
|
||||
if videoitem.server.lower() not in max_intents_servers:
|
||||
max_intents_servers[videoitem.server.lower()] = max_intents
|
||||
@@ -69,16 +69,16 @@ def start(itemlist, item):
|
||||
lang = " [{}]".format(videoitem.language) if videoitem.language else ''
|
||||
quality = ' [{}]'.format(videoitem.quality) if videoitem.quality and videoitem.quality != 'default' else ''
|
||||
name = servername(videoitem.server)
|
||||
platformtools.dialog_notification('AutoPlay', '{}{}{}'.format(name, lang, quality), sound=False)
|
||||
platformtools.dialogNotification('AutoPlay', '{}{}{}'.format(name, lang, quality), sound=False)
|
||||
|
||||
# Try to play the links If the channel has its own play method, use it
|
||||
channel = platformtools.channel_import(channel_id)
|
||||
channel = platformtools.channelImport(channel_id)
|
||||
if not channel:
|
||||
return
|
||||
if hasattr(channel, 'play'):
|
||||
resolved_item = getattr(channel, 'play')(videoitem)
|
||||
if len(resolved_item) > 0:
|
||||
if isinstance(resolved_item[0], list): videoitem.video_urls = resolved_item
|
||||
if isinstance(resolved_item[0], list): videoitem.videoUrls = resolved_item
|
||||
else: videoitem = resolved_item[0]
|
||||
|
||||
play_item.autoplay = True
|
||||
@@ -88,16 +88,16 @@ def start(itemlist, item):
|
||||
if base_item.contentChannel == 'videolibrary' or base_item.nfo:
|
||||
# Fill the video with the data of the main item and play
|
||||
play_item = base_item.clone(**videoitem.__dict__)
|
||||
platformtools.play_video(play_item, autoplay=True)
|
||||
platformtools.playVideo(play_item, autoplay=True)
|
||||
else:
|
||||
videoitem.window = base_item.window
|
||||
# If it doesn't come from the video library, just play
|
||||
platformtools.play_video(videoitem, autoplay=True)
|
||||
platformtools.playVideo(videoitem, autoplay=True)
|
||||
except:
|
||||
pass
|
||||
# sleep(3)
|
||||
try:
|
||||
if platformtools.is_playing():
|
||||
if platformtools.isPlaying():
|
||||
PLAYED = True
|
||||
break
|
||||
except:
|
||||
@@ -108,20 +108,20 @@ def start(itemlist, item):
|
||||
|
||||
# If the maximum number of attempts of this server has been reached, ask if we want to continue testing or ignore it.
|
||||
if max_intents_servers[videoitem.server.lower()] == 0:
|
||||
text = config.get_localized_string(60072) % name
|
||||
if not platformtools.dialog_yesno("AutoPlay", text, config.get_localized_string(60073)):
|
||||
text = config.getLocalizedString(60072) % name
|
||||
if not platformtools.dialogYesNo("AutoPlay", text, config.getLocalizedString(60073)):
|
||||
max_intents_servers[videoitem.server.lower()] = max_intents
|
||||
|
||||
# If there are no items in the list, it is reported
|
||||
if autoplay_elem == autoplay_list[-1]:
|
||||
platformtools.dialog_notification('AutoPlay', config.get_localized_string(60072) % name)
|
||||
platformtools.dialogNotification('AutoPlay', config.getLocalizedString(60072) % name)
|
||||
|
||||
else:
|
||||
platformtools.dialog_notification(config.get_localized_string(60074), config.get_localized_string(60075))
|
||||
platformtools.dialogNotification(config.getLocalizedString(60074), config.getLocalizedString(60075))
|
||||
|
||||
# Restore if necessary the previous value of "Action and Player Mode" in preferences
|
||||
if not user_config_setting_action: config.set_setting("default_action", user_config_setting_action)
|
||||
# if user_config_setting_player != 0: config.set_setting("player_mode", user_config_setting_player)
|
||||
if not user_config_setting_action: config.setSetting("default_action", user_config_setting_action)
|
||||
# if user_config_setting_player != 0: config.setSetting("player_mode", user_config_setting_player)
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -133,7 +133,7 @@ def play_multi_channel(item, itemlist):
|
||||
|
||||
def servername(server):
|
||||
from core.servertools import translate_server_name
|
||||
path = filetools.join(config.get_runtime_path(), 'servers', server.lower() + '.json')
|
||||
path = filetools.join(config.getRuntimePath(), 'servers', server.lower() + '.json')
|
||||
name = jsontools.load(open(path, "rb").read())['name']
|
||||
if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
|
||||
if name.startswith('@'): name = config.getLocalizedString(int(name.replace('@','')))
|
||||
return translate_server_name(name)
|
||||
|
||||
+29
-26
@@ -16,8 +16,7 @@ remote_path = 'https://raw.githubusercontent.com/kodiondemand/media/master/'
|
||||
|
||||
def is_enabled(channel_name):
|
||||
logger.debug("channel_name=" + channel_name)
|
||||
return get_channel_parameters(channel_name)["active"] and get_channel_setting("enabled", channel=channel_name,
|
||||
default=True)
|
||||
return get_channel_parameters(channel_name)["active"] and getChannelSetting("enabled", channel=channel_name, default=True)
|
||||
|
||||
|
||||
def get_channel_parameters(channel_name):
|
||||
@@ -90,13 +89,13 @@ def get_channel_json(channel_name):
|
||||
from core import filetools
|
||||
channel_json = None
|
||||
try:
|
||||
channel_path = filetools.join(config.get_runtime_path(), "channels", channel_name + ".json")
|
||||
channel_path = filetools.join(config.getRuntimePath(), "channels", channel_name + ".json")
|
||||
if not filetools.isfile(channel_path):
|
||||
channel_path = filetools.join(config.get_runtime_path(), "specials", channel_name + ".json")
|
||||
channel_path = filetools.join(config.getRuntimePath(), "specials", channel_name + ".json")
|
||||
if not filetools.isfile(channel_path):
|
||||
channel_path = filetools.join(config.get_runtime_path(), "servers", channel_name + ".json")
|
||||
channel_path = filetools.join(config.getRuntimePath(), "servers", channel_name + ".json")
|
||||
if not filetools.isfile(channel_path):
|
||||
channel_path = filetools.join(config.get_runtime_path(), "servers", "debriders",
|
||||
channel_path = filetools.join(config.getRuntimePath(), "servers", "debriders",
|
||||
channel_name + ".json")
|
||||
|
||||
if filetools.isfile(channel_path):
|
||||
@@ -115,24 +114,27 @@ def get_channel_json(channel_name):
|
||||
def get_channel_controls_settings(channel_name):
|
||||
logger.debug("channel_name=" + channel_name)
|
||||
dict_settings = {}
|
||||
# import web_pdb; web_pdb.set_trace()
|
||||
# list_controls = get_channel_json(channel_name).get('settings', list())
|
||||
|
||||
list_controls = get_default_settings(channel_name)
|
||||
|
||||
for c in list_controls:
|
||||
if 'id' not in c or 'type' not in c or 'default' not in c:
|
||||
# If any control in the list does not have id, type or default, we ignore it
|
||||
continue
|
||||
|
||||
# new dict with key(id) and value(default) from settings
|
||||
dict_settings[c['id']] = c['default']
|
||||
if c['type'] == 'list' and c.get('values'):
|
||||
dict_settings[c['id']] = list(c['values'])[c['default']]
|
||||
elif c['type'] == 'list' and c.get('dvalues'):
|
||||
dict_settings[c['id']] = list(c['dvalues'].values())[c['default']]
|
||||
else:
|
||||
dict_settings[c['id']] = c['default']
|
||||
|
||||
return list_controls, dict_settings
|
||||
|
||||
|
||||
def get_lang(channel_name):
|
||||
channel = __import__('channels.%s' % channel_name, fromlist=["channels.%s" % channel_name])
|
||||
list_language = [config.get_localized_string(70522)]
|
||||
list_language = [config.getLocalizedString(70522)]
|
||||
if hasattr(channel, 'list_language'):
|
||||
for language in channel.list_language:
|
||||
list_language.append(language)
|
||||
@@ -160,7 +162,7 @@ def get_default_settings(channel_name):
|
||||
from core import filetools
|
||||
import copy
|
||||
|
||||
default_path = filetools.join(config.get_runtime_path(), 'default_channel_settings' + '.json')
|
||||
default_path = filetools.join(config.getRuntimePath(), 'default_channel_settings' + '.json')
|
||||
if channel_name not in ['trakt', 'autoplay']:
|
||||
global default_file
|
||||
else:
|
||||
@@ -168,7 +170,7 @@ def get_default_settings(channel_name):
|
||||
if not default_file:
|
||||
default_file = jsontools.load(filetools.read(default_path))
|
||||
|
||||
channel_path = filetools.join(config.get_runtime_path(), 'channels', channel_name + '.json')
|
||||
channel_path = filetools.join(config.getRuntimePath(), 'channels', channel_name + '.json')
|
||||
|
||||
if filetools.exists(channel_path):
|
||||
default_controls = default_file['settings']
|
||||
@@ -183,35 +185,36 @@ def get_default_settings(channel_name):
|
||||
default_off = channel_json['default_off'] if 'default_off' in channel_json else []
|
||||
|
||||
# Apply default configurations if they do not exist
|
||||
# logger.dbg()
|
||||
for control in copy.deepcopy(default_controls):
|
||||
if control['id'] not in str(channel_controls):
|
||||
if 'include_in_newest' in control['id'] and 'include_in_newest' not in not_active and control['id'] not in not_active:
|
||||
label = control['id'].split('_')
|
||||
label = label[-1]
|
||||
if label == 'movies':
|
||||
if label == 'movie':
|
||||
if 'movie' in categories:
|
||||
control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string( 30122)
|
||||
control['label'] = config.getLocalizedString(70727) + ' - ' + config.getLocalizedString( 30122)
|
||||
control['default'] = False if ('include_in_newest' in default_off) or ( ' include_in_newest_movie' in default_off) else True
|
||||
channel_controls.append(control)
|
||||
else:
|
||||
pass
|
||||
elif label == 'tvshows':
|
||||
elif label == 'tvshow':
|
||||
if 'tvshow' in categories:
|
||||
control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string( 30123)
|
||||
control['default'] = False if ('include_in_newest' in default_off) or ( 'include_in_newest_series' in default_off) else True
|
||||
control['label'] = config.getLocalizedString(70727) + ' - ' + config.getLocalizedString( 30123)
|
||||
control['default'] = False if ('include_in_newest' in default_off) or ( 'include_in_newest_tvshow' in default_off) else True
|
||||
channel_controls.append(control)
|
||||
else:
|
||||
pass
|
||||
elif label == 'anime':
|
||||
if 'anime' in categories:
|
||||
control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string( 30124)
|
||||
control['label'] = config.getLocalizedString(70727) + ' - ' + config.getLocalizedString( 30124)
|
||||
control['default'] = False if ('include_in_newest' in default_off) or ( 'include_in_newest_anime' in default_off) else True
|
||||
channel_controls.append(control)
|
||||
else:
|
||||
pass
|
||||
|
||||
else:
|
||||
control['label'] = config.get_localized_string(70727) + ' - ' + label.capitalize()
|
||||
control['label'] = config.getLocalizedString(70727) + ' - ' + label.capitalize()
|
||||
control['default'] = control['default'] if control['id'] not in default_off else False
|
||||
channel_controls.append(control)
|
||||
|
||||
@@ -231,7 +234,7 @@ def get_default_settings(channel_name):
|
||||
return channel_controls
|
||||
|
||||
|
||||
def get_channel_setting(name, channel, default=None):
|
||||
def getChannelSetting(name, channel, default=None):
|
||||
from core import filetools
|
||||
"""
|
||||
Returns the configuration value of the requested parameter.
|
||||
@@ -255,7 +258,7 @@ def get_channel_setting(name, channel, default=None):
|
||||
@rtype: any
|
||||
|
||||
"""
|
||||
file_settings = filetools.join(config.get_data_path(), "settings_channels", channel + "_data.json")
|
||||
file_settings = filetools.join(config.getDataPath(), "settings_channels", channel + "_data.json")
|
||||
dict_settings = {}
|
||||
dict_file = {}
|
||||
|
||||
@@ -288,7 +291,7 @@ def get_channel_setting(name, channel, default=None):
|
||||
return dict_settings.get(name, default)
|
||||
|
||||
|
||||
def set_channel_setting(name, value, channel):
|
||||
def setChannelSetting(name, value, channel):
|
||||
from core import filetools
|
||||
"""
|
||||
Sets the configuration value of the indicated parameter.
|
||||
@@ -312,10 +315,10 @@ def set_channel_setting(name, value, channel):
|
||||
|
||||
"""
|
||||
# We create the folder if it does not exist
|
||||
if not filetools.exists(filetools.join(config.get_data_path(), "settings_channels")):
|
||||
filetools.mkdir(filetools.join(config.get_data_path(), "settings_channels"))
|
||||
if not filetools.exists(filetools.join(config.getDataPath(), "settings_channels")):
|
||||
filetools.mkdir(filetools.join(config.getDataPath(), "settings_channels"))
|
||||
|
||||
file_settings = filetools.join(config.get_data_path(), "settings_channels", channel + "_data.json")
|
||||
file_settings = filetools.join(config.getDataPath(), "settings_channels", channel + "_data.json")
|
||||
dict_settings = {}
|
||||
|
||||
dict_file = None
|
||||
|
||||
+4
-4
@@ -102,16 +102,16 @@ class Downloader(object):
|
||||
return os.path.abspath(filetools.join(self._path, self._filename))
|
||||
|
||||
# Features
|
||||
def start_dialog(self, title=config.get_localized_string(60200)):
|
||||
def start_dialog(self, title=config.getLocalizedString(60200)):
|
||||
from platformcode import platformtools
|
||||
progreso = platformtools.dialog_progress_bg(title, config.get_localized_string(60201))
|
||||
progreso = platformtools.dialogProgressBg(title, config.getLocalizedString(60201))
|
||||
try:
|
||||
self.start()
|
||||
while self.state == self.states.downloading:
|
||||
time.sleep(0.2)
|
||||
line1 = "%s" % (self.filename)
|
||||
line2 = config.get_localized_string(59983) % ( self.downloaded[1], self.downloaded[2], self.size[1], self.size[2], self.speed[1], self.speed[2], self.connections[0], self.connections[1])
|
||||
line3 = config.get_localized_string(60202) % (self.remaining_time)
|
||||
line2 = config.getLocalizedString(59983) % ( self.downloaded[1], self.downloaded[2], self.size[1], self.size[2], self.speed[1], self.speed[2], self.connections[0], self.connections[1])
|
||||
line3 = config.getLocalizedString(60202) % (self.remaining_time)
|
||||
|
||||
progreso.update(int(self.progress), line1 + '\n' + line2 + " " + line3)
|
||||
self.__update_json()
|
||||
|
||||
+15
-15
@@ -127,7 +127,7 @@ def getfilefromtitle(url, title):
|
||||
# Print in the log what you will discard
|
||||
logger.info("title=" + title)
|
||||
logger.info("url=" + url)
|
||||
plataforma = config.get_system_platform()
|
||||
plataforma = config.getSystemPlatform()
|
||||
logger.info("platform=" + plataforma)
|
||||
|
||||
# filename = xbmc.makeLegalFilename(title + url[-4:])
|
||||
@@ -146,7 +146,7 @@ def getfilefromtitle(url, title):
|
||||
|
||||
logger.info("filename= %s" % nombrefichero)
|
||||
|
||||
fullpath = filetools.join(config.get_setting("downloadpath"), nombrefichero)
|
||||
fullpath = filetools.join(config.getSetting("downloadpath"), nombrefichero)
|
||||
logger.info("fullpath= %s" % fullpath)
|
||||
|
||||
if config.is_xbmc() and fullpath.startswith("special://"):
|
||||
@@ -161,11 +161,11 @@ def downloadtitle(url, title):
|
||||
return downloadfile(url, fullpath)
|
||||
|
||||
|
||||
def downloadbest(video_urls, title, continuar=False):
|
||||
def downloadbest(videoUrls, title, continuar=False):
|
||||
logger.info()
|
||||
|
||||
# Flip it over, to put the highest quality one first (list () is for you to make a copy of)
|
||||
invertida = list(video_urls)
|
||||
invertida = list(videoUrls)
|
||||
invertida.reverse()
|
||||
|
||||
for elemento in invertida:
|
||||
@@ -271,7 +271,7 @@ def downloadfile(url, nombrefichero, headers=None, silent=False, continuar=False
|
||||
|
||||
# Create the progress dialog
|
||||
if not silent:
|
||||
progreso = platformtools.dialog_progress(header, "Downloading..." + '\n' + url + '\n' + nombrefichero)
|
||||
progreso = platformtools.dialogProgress(header, "Downloading..." + '\n' + url + '\n' + nombrefichero)
|
||||
|
||||
# If the platform does not return a valid dialog box, it assumes silent mode
|
||||
if progreso is None:
|
||||
@@ -399,7 +399,7 @@ def downloadfile(url, nombrefichero, headers=None, silent=False, continuar=False
|
||||
if not silent:
|
||||
progreso.close()
|
||||
|
||||
# platformtools.dialog_ok('Error al descargar' , 'Se ha producido un error' , 'al descargar el archivo')
|
||||
# platformtools.dialogOk('Error al descargar' , 'Se ha producido un error' , 'al descargar el archivo')
|
||||
|
||||
return -2
|
||||
|
||||
@@ -408,7 +408,7 @@ def downloadfile(url, nombrefichero, headers=None, silent=False, continuar=False
|
||||
error = downloadfileRTMP(url, nombrefichero, silent)
|
||||
if error and not silent:
|
||||
from platformcode import platformtools
|
||||
platformtools.dialog_ok("You cannot download that video "," RTMP downloads not yet supported")
|
||||
platformtools.dialogOk("You cannot download that video "," RTMP downloads not yet supported")
|
||||
else:
|
||||
import traceback
|
||||
from pprint import pprint
|
||||
@@ -448,7 +448,7 @@ def downloadfileRTMP(url, nombrefichero, silent):
|
||||
|
||||
if not filetools.isfile(rtmpdump_cmd) and not silent:
|
||||
from platformcode import platformtools
|
||||
advertencia = platformtools.dialog_ok("Lack " + rtmpdump_cmd, "Check that rtmpdump is installed")
|
||||
advertencia = platformtools.dialogOk("Lack " + rtmpdump_cmd, "Check that rtmpdump is installed")
|
||||
return True
|
||||
|
||||
valid_rtmpdump_options = ["help", "url", "rtmp", "host", "port", "socks", "protocol", "playpath", "playlist",
|
||||
@@ -480,7 +480,7 @@ def downloadfileRTMP(url, nombrefichero, silent):
|
||||
rtmpdump_exit = spawnv(P_NOWAIT, rtmpdump_cmd, rtmpdump_args)
|
||||
if not silent:
|
||||
from platformcode import platformtools
|
||||
advertencia = platformtools.dialog_ok("RTMP download option is experimental", "and the video will download in the background. \n No progress bar will be displayed.")
|
||||
advertencia = platformtools.dialogOk("RTMP download option is experimental", "and the video will download in the background. \n No progress bar will be displayed.")
|
||||
except:
|
||||
return True
|
||||
|
||||
@@ -520,7 +520,7 @@ def downloadfileGzipped(url, pathfichero):
|
||||
|
||||
# Create the progress dialog
|
||||
from platformcode import platformtools
|
||||
progreso = platformtools.dialog_progress("addon", config.get_localized_string(60200) + '\n' + url.split("|")[0] + '\n' + nombrefichero)
|
||||
progreso = platformtools.dialogProgress("addon", config.getLocalizedString(60200) + '\n' + url.split("|")[0] + '\n' + nombrefichero)
|
||||
|
||||
# Socket timeout at 60 seconds
|
||||
socket.setdefaulttimeout(10)
|
||||
@@ -662,7 +662,7 @@ def downloadfileGzipped(url, pathfichero):
|
||||
def GetTitleFromFile(title):
|
||||
# Print in the log what you will discard
|
||||
logger.info("title= " + title)
|
||||
plataforma = config.get_system_platform()
|
||||
plataforma = config.getSystemPlatform()
|
||||
logger.info("plataform= " + plataforma)
|
||||
|
||||
# nombrefichero = xbmc.makeLegalFilename(title + url[-4:])
|
||||
@@ -852,14 +852,14 @@ def download_all_episodes(item, channel, first_episode="", preferred_server="vid
|
||||
video_item = video_items[0]
|
||||
|
||||
# Check that it is available
|
||||
video_urls, puedes, motivo = servertools.resolve_video_urls_for_playing(video_item.server, video_item.url, video_password="", muestra_dialogo=False)
|
||||
videoUrls, puedes, motivo = servertools.resolve_videoUrls_for_playing(video_item.server, video_item.url, video_password="", muestra_dialogo=False)
|
||||
|
||||
# Adds it to the download list
|
||||
if puedes:
|
||||
logger.info("downloading mirror started...")
|
||||
# The highest quality video is the latest
|
||||
# mediaurl = video_urls[len(video_urls) - 1][1]
|
||||
devuelve = downloadbest(video_urls, show_title + " " + episode_title + " " + idioma +
|
||||
# mediaUrl = videoUrls[len(videoUrls) - 1][1]
|
||||
devuelve = downloadbest(videoUrls, show_title + " " + episode_title + " " + idioma +
|
||||
" [" + video_item.server + "]", continuar=False)
|
||||
|
||||
if devuelve == 0:
|
||||
@@ -869,7 +869,7 @@ def download_all_episodes(item, channel, first_episode="", preferred_server="vid
|
||||
elif devuelve == -1:
|
||||
try:
|
||||
from platformcode import platformtools
|
||||
platformtools.dialog_ok("plugin", "Descarga abortada")
|
||||
platformtools.dialogOk("plugin", "Descarga abortada")
|
||||
except:
|
||||
pass
|
||||
return
|
||||
|
||||
+11
-11
@@ -255,7 +255,7 @@ def file_open(path, mode="r", silent=False, vfs=True):
|
||||
logger.error("ERROR when opening file: %s, %s" % (path, mode))
|
||||
if not silent:
|
||||
logger.error(traceback.format_exc())
|
||||
platformtools.dialog_notification("Error Opening", path)
|
||||
platformtools.dialogNotification("Error Opening", path)
|
||||
return False
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ def rename(path, new_name, silent=False, strict=False, vfs=True):
|
||||
if not result and not strict:
|
||||
logger.error("ERROR RENAME file: %s. Copying and deleting" % path)
|
||||
if not silent:
|
||||
dialogo = platformtools.dialog_progress("Copying file", "")
|
||||
dialogo = platformtools.dialogProgress("Copying file", "")
|
||||
result = xbmcvfs.copy(path, dest)
|
||||
if not result:
|
||||
return False
|
||||
@@ -317,7 +317,7 @@ def rename(path, new_name, silent=False, strict=False, vfs=True):
|
||||
logger.error("ERROR when renaming the file: %s" % path)
|
||||
if not silent:
|
||||
logger.error(traceback.format_exc())
|
||||
platformtools.dialog_notification("Error renaming", path)
|
||||
platformtools.dialogNotification("Error renaming", path)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
@@ -342,7 +342,7 @@ def move(path, dest, silent=False, strict=False, vfs=True):
|
||||
if not result and not strict:
|
||||
logger.error("ERROR when MOVING the file: %s. Copying and deleting" % path)
|
||||
if not silent:
|
||||
dialogo = platformtools.dialog_progress("Copying file", "")
|
||||
dialogo = platformtools.dialogProgress("Copying file", "")
|
||||
result = xbmcvfs.copy(path, dest)
|
||||
if not result:
|
||||
return False
|
||||
@@ -362,7 +362,7 @@ def move(path, dest, silent=False, strict=False, vfs=True):
|
||||
# mixed In this case the file is copied and then the source file is deleted
|
||||
else:
|
||||
if not silent:
|
||||
dialogo = platformtools.dialog_progress("Copying file", "")
|
||||
dialogo = platformtools.dialogProgress("Copying file", "")
|
||||
return copy(path, dest) == True and remove(path) == True
|
||||
except:
|
||||
logger.error("ERROR when moving file: %s to %s" % (path, dest))
|
||||
@@ -390,14 +390,14 @@ def copy(path, dest, silent=False, vfs=True):
|
||||
path = encode(path)
|
||||
dest = encode(dest)
|
||||
if not silent:
|
||||
dialogo = platformtools.dialog_progress("Copying file", "")
|
||||
dialogo = platformtools.dialogProgress("Copying file", "")
|
||||
return bool(xbmcvfs.copy(path, dest))
|
||||
|
||||
fo = file_open(path, "rb")
|
||||
fd = file_open(dest, "wb")
|
||||
if fo and fd:
|
||||
if not silent:
|
||||
dialogo = platformtools.dialog_progress("Copying file", "")
|
||||
dialogo = platformtools.dialogProgress("Copying file", "")
|
||||
size = getsize(path)
|
||||
copiado = 0
|
||||
while True:
|
||||
@@ -559,7 +559,7 @@ def remove(path, silent=False, vfs=True):
|
||||
logger.error("ERROR deleting file: %s" % path)
|
||||
if not silent:
|
||||
logger.error(traceback.format_exc())
|
||||
platformtools.dialog_notification("ERROR deleting file", path)
|
||||
platformtools.dialogNotification("ERROR deleting file", path)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
@@ -599,7 +599,7 @@ def rmdirtree(path, silent=False, vfs=True):
|
||||
logger.error("ERROR deleting directory: %s" % path)
|
||||
if not silent:
|
||||
logger.error(traceback.format_exc())
|
||||
platformtools.dialog_notification("ERROR deleting directory", path)
|
||||
platformtools.dialogNotification("ERROR deleting directory", path)
|
||||
return False
|
||||
else:
|
||||
return not exists(path)
|
||||
@@ -627,7 +627,7 @@ def rmdir(path, silent=False, vfs=True):
|
||||
logger.error("ERROR deleting directory: %s" % path)
|
||||
if not silent:
|
||||
logger.error(traceback.format_exc())
|
||||
platformtools.dialog_notification("ERROR deleting directory", path)
|
||||
platformtools.dialogNotification("ERROR deleting directory", path)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
@@ -660,7 +660,7 @@ def mkdir(path, silent=False, vfs=True):
|
||||
logger.error("ERROR when creating directory: %s" % path)
|
||||
if not silent:
|
||||
logger.error(traceback.format_exc())
|
||||
platformtools.dialog_notification("ERROR when creating directory", path)
|
||||
platformtools.dialogNotification("ERROR when creating directory", path)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
+44
-44
@@ -47,10 +47,10 @@ class Filter(object):
|
||||
|
||||
def __get_data(self, item, global_filter_lang_id):
|
||||
|
||||
dict_filtered_shows = jsontools.get_node_from_file(item.channel, TAG_TVSHOW_FILTER)
|
||||
dict_filtered_shows = jsontools.getNodeFromFile(item.channel, TAG_TVSHOW_FILTER)
|
||||
tvshow = item.show.lower().strip()
|
||||
|
||||
global_filter_language = config.get_setting(global_filter_lang_id, item.channel)
|
||||
global_filter_language = config.getSetting(global_filter_lang_id, item.channel)
|
||||
|
||||
if tvshow in list(dict_filtered_shows.keys()):
|
||||
|
||||
@@ -86,7 +86,7 @@ def access():
|
||||
"""
|
||||
allow = False
|
||||
|
||||
if config.is_xbmc() or config.get_platform() == "mediaserver":
|
||||
if config.is_xbmc() or config.getXBMCPlatform() == "mediaserver":
|
||||
allow = True
|
||||
|
||||
return allow
|
||||
@@ -119,7 +119,7 @@ def context(item, list_language=None, list_quality=None, exist=False):
|
||||
_context = []
|
||||
|
||||
if access():
|
||||
dict_data = {"title": config.get_localized_string(60426), "action": "config_item", "channel": "filtertools"}
|
||||
dict_data = {"title": config.getLocalizedString(60426), "action": "config_item", "channel": "filtertools"}
|
||||
if list_language:
|
||||
dict_data["list_language"] = list_language
|
||||
if list_quality:
|
||||
@@ -138,10 +138,10 @@ def context(item, list_language=None, list_quality=None, exist=False):
|
||||
|
||||
if item.action == "play":
|
||||
if not exist:
|
||||
_context.append({"title": config.get_localized_string(60427) % item.language, "action": "save_from_context",
|
||||
_context.append({"title": config.getLocalizedString(60427) % item.language, "action": "save_from_context",
|
||||
"channel": "filtertools", "from_channel": item.channel})
|
||||
else:
|
||||
_context.append({"title": config.get_localized_string(60428) % item.language, "action": "delete_from_context",
|
||||
_context.append({"title": config.getLocalizedString(60428) % item.language, "action": "delete_from_context",
|
||||
"channel": "filtertools", "from_channel": item.channel})
|
||||
|
||||
return _context
|
||||
@@ -149,7 +149,7 @@ def context(item, list_language=None, list_quality=None, exist=False):
|
||||
|
||||
def show_option(itemlist, channel, list_language, list_quality):
|
||||
if access():
|
||||
itemlist.append(Item(channel=__channel__, title=config.get_localized_string(60429) % COLOR.get("parent_item", "auto"), action="load",
|
||||
itemlist.append(Item(channel=__channel__, title=config.getLocalizedString(60429) % COLOR.get("parent_item", "auto"), action="load",
|
||||
list_language=list_language, list_quality=list_quality, from_channel=channel))
|
||||
|
||||
return itemlist
|
||||
@@ -286,7 +286,7 @@ def get_links(list_item, item, list_language, list_quality=None, global_filter_l
|
||||
return list_item
|
||||
|
||||
|
||||
second_lang = config.get_setting('second_language')
|
||||
second_lang = config.getSetting('second_language')
|
||||
|
||||
logger.debug("total de items : %s" % len(list_item))
|
||||
|
||||
@@ -326,7 +326,7 @@ def get_links(list_item, item, list_language, list_quality=None, global_filter_l
|
||||
for i in list_item:
|
||||
list_item_all.append(i.tourl())
|
||||
|
||||
_context = [{"title": config.get_localized_string(60430) % _filter.language, "action": "delete_from_context", "channel": "filtertools", "to_channel": item.channel}]
|
||||
_context = [{"title": config.getLocalizedString(60430) % _filter.language, "action": "delete_from_context", "channel": "filtertools", "to_channel": item.channel}]
|
||||
|
||||
if _filter.quality_allowed:
|
||||
msg_quality_allowed = " y calidad %s" % _filter.quality_allowed
|
||||
@@ -339,7 +339,7 @@ def get_links(list_item, item, list_language, list_quality=None, global_filter_l
|
||||
|
||||
new_itemlist.append(Item(channel=__channel__, action="no_filter", list_item_all=list_item_all,
|
||||
show=item.show,
|
||||
title=config.get_localized_string(60432) % (_filter.language, msg_quality_allowed),
|
||||
title=config.getLocalizedString(60432) % (_filter.language, msg_quality_allowed),
|
||||
context=_context))
|
||||
|
||||
else:
|
||||
@@ -386,7 +386,7 @@ def mainlist(channel, list_language, list_quality):
|
||||
"""
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
dict_series = jsontools.get_node_from_file(channel, TAG_TVSHOW_FILTER)
|
||||
dict_series = jsontools.getNodeFromFile(channel, TAG_TVSHOW_FILTER)
|
||||
|
||||
idx = 0
|
||||
for tvshow in sorted(dict_series):
|
||||
@@ -404,16 +404,16 @@ def mainlist(channel, list_language, list_quality):
|
||||
|
||||
idx += 1
|
||||
name = dict_series.get(tvshow, {}).get(TAG_NAME, tvshow)
|
||||
activo = config.get_localized_string(60433)
|
||||
activo = config.getLocalizedString(60433)
|
||||
if dict_series[tvshow][TAG_ACTIVE]:
|
||||
activo = ""
|
||||
title = config.get_localized_string(60434) % (tag_color, name, activo)
|
||||
title = config.getLocalizedString(60434) % (tag_color, name, activo)
|
||||
|
||||
itemlist.append(Item(channel=__channel__, action="config_item", title=title, show=name,
|
||||
list_language=list_language, list_quality=list_quality, from_channel=channel))
|
||||
|
||||
if len(itemlist) == 0:
|
||||
itemlist.append(Item(channel=channel, action="mainlist", title=config.get_localized_string(60435)))
|
||||
itemlist.append(Item(channel=channel, action="mainlist", title=config.getLocalizedString(60435)))
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -429,7 +429,7 @@ def config_item(item):
|
||||
logger.debug("item %s" % item.tostring())
|
||||
|
||||
# WE GET THE JSON DATA
|
||||
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
|
||||
dict_series = jsontools.getNodeFromFile(item.from_channel, TAG_TVSHOW_FILTER)
|
||||
|
||||
tvshow = item.show.lower().strip()
|
||||
default_lang = ''
|
||||
@@ -443,7 +443,7 @@ def config_item(item):
|
||||
pass
|
||||
|
||||
if default_lang == '':
|
||||
platformtools.dialog_notification("FilterTools", "There are no defined languages")
|
||||
platformtools.dialogNotification("FilterTools", "There are no defined languages")
|
||||
return
|
||||
else:
|
||||
lang_selected = dict_series.get(tvshow, {}).get(TAG_LANGUAGE, default_lang)
|
||||
@@ -457,7 +457,7 @@ def config_item(item):
|
||||
if item.show.lower().strip() in dict_series:
|
||||
allow_option = True
|
||||
active = dict_series.get(item.show.lower().strip(), {}).get(TAG_ACTIVE, False)
|
||||
custom_button = {'label': config.get_localized_string(60437), 'function': 'delete', 'visible': True, 'close': True}
|
||||
custom_button = {'label': config.getLocalizedString(60437), 'function': 'delete', 'visible': True, 'close': True}
|
||||
|
||||
list_controls = []
|
||||
|
||||
@@ -465,7 +465,7 @@ def config_item(item):
|
||||
active_control = {
|
||||
"id": "active",
|
||||
"type": "bool",
|
||||
"label": config.get_localized_string(60438),
|
||||
"label": config.getLocalizedString(60438),
|
||||
"color": "",
|
||||
"default": active,
|
||||
"enabled": allow_option,
|
||||
@@ -476,7 +476,7 @@ def config_item(item):
|
||||
language_option = {
|
||||
"id": "language",
|
||||
"type": "list",
|
||||
"label": config.get_localized_string(60439),
|
||||
"label": config.getLocalizedString(60439),
|
||||
# "color": "0xFFee66CC",
|
||||
"default": item.list_language.index(lang_selected),
|
||||
"enabled": True,
|
||||
@@ -509,9 +509,9 @@ def config_item(item):
|
||||
# we concatenate list_controls with list_controls_quality
|
||||
list_controls.extend(list_controls_calidad)
|
||||
|
||||
title = config.get_localized_string(60441) % (COLOR.get("selected", "auto"), item.show)
|
||||
title = config.getLocalizedString(60441) % (COLOR.get("selected", "auto"), item.show)
|
||||
|
||||
platformtools.show_channel_settings(list_controls=list_controls, callback='save', item=item,
|
||||
platformtools.showChannelSettings(list_controls=list_controls, callback='save', item=item,
|
||||
caption=title, custom_button=custom_button)
|
||||
|
||||
|
||||
@@ -519,30 +519,30 @@ def delete(item, dict_values):
|
||||
logger.debug()
|
||||
|
||||
if item:
|
||||
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
|
||||
dict_series = jsontools.getNodeFromFile(item.from_channel, TAG_TVSHOW_FILTER)
|
||||
tvshow = item.show.strip().lower()
|
||||
|
||||
heading = config.get_localized_string(60442)
|
||||
line1 = config.get_localized_string(60443) % (COLOR.get("selected", "auto"), item.show.strip())
|
||||
heading = config.getLocalizedString(60442)
|
||||
line1 = config.getLocalizedString(60443) % (COLOR.get("selected", "auto"), item.show.strip())
|
||||
|
||||
if platformtools.dialog_yesno(heading, line1) == 1:
|
||||
if platformtools.dialogYesNo(heading, line1) == 1:
|
||||
lang_selected = dict_series.get(tvshow, {}).get(TAG_LANGUAGE, "")
|
||||
dict_series.pop(tvshow, None)
|
||||
|
||||
result, json_data = jsontools.update_node(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
|
||||
result, json_data = jsontools.updateNode(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
|
||||
|
||||
sound = False
|
||||
if result:
|
||||
message = config.get_localized_string(60444)
|
||||
message = config.getLocalizedString(60444)
|
||||
else:
|
||||
message = config.get_localized_string(60445)
|
||||
message = config.getLocalizedString(60445)
|
||||
sound = True
|
||||
|
||||
heading = "%s [%s]" % (item.show.strip(), lang_selected)
|
||||
platformtools.dialog_notification(heading, message, sound=sound)
|
||||
platformtools.dialogNotification(heading, message, sound=sound)
|
||||
|
||||
if item.action in ["findvideos", "play"]:
|
||||
platformtools.itemlist_refresh()
|
||||
platformtools.itemlistRefresh()
|
||||
|
||||
|
||||
def save(item, dict_data_saved):
|
||||
@@ -561,7 +561,7 @@ def save(item, dict_data_saved):
|
||||
|
||||
if item.from_channel == "videolibrary":
|
||||
item.from_channel = item.contentChannel
|
||||
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
|
||||
dict_series = jsontools.getNodeFromFile(item.from_channel, TAG_TVSHOW_FILTER)
|
||||
tvshow = item.show.strip().lower()
|
||||
|
||||
logger.debug("Data is updated")
|
||||
@@ -576,20 +576,20 @@ def save(item, dict_data_saved):
|
||||
TAG_LANGUAGE: lang_selected, TAG_QUALITY_ALLOWED: list_quality}
|
||||
dict_series[tvshow] = dict_filter
|
||||
|
||||
result, json_data = jsontools.update_node(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
|
||||
result, json_data = jsontools.updateNode(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
|
||||
|
||||
sound = False
|
||||
if result:
|
||||
message = config.get_localized_string(60446)
|
||||
message = config.getLocalizedString(60446)
|
||||
else:
|
||||
message = config.get_localized_string(70593)
|
||||
message = config.getLocalizedString(70593)
|
||||
sound = True
|
||||
|
||||
heading = "%s [%s]" % (item.show.strip(), lang_selected)
|
||||
platformtools.dialog_notification(heading, message, sound=sound)
|
||||
platformtools.dialogNotification(heading, message, sound=sound)
|
||||
|
||||
if item.from_action in ["findvideos", "play"]:
|
||||
platformtools.itemlist_refresh()
|
||||
platformtools.itemlistRefresh()
|
||||
|
||||
|
||||
def save_from_context(item):
|
||||
@@ -601,13 +601,13 @@ def save_from_context(item):
|
||||
"""
|
||||
logger.debug()
|
||||
|
||||
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
|
||||
dict_series = jsontools.getNodeFromFile(item.from_channel, TAG_TVSHOW_FILTER)
|
||||
tvshow = item.show.strip().lower()
|
||||
|
||||
dict_filter = {TAG_NAME: item.show, TAG_ACTIVE: True, TAG_LANGUAGE: item.language, TAG_QUALITY_ALLOWED: []}
|
||||
dict_series[tvshow] = dict_filter
|
||||
|
||||
result, json_data = jsontools.update_node(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
|
||||
result, json_data = jsontools.updateNode(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
|
||||
|
||||
sound = False
|
||||
if result:
|
||||
@@ -617,10 +617,10 @@ def save_from_context(item):
|
||||
sound = True
|
||||
|
||||
heading = "%s [%s]" % (item.show.strip(), item.language)
|
||||
platformtools.dialog_notification(heading, message, sound=sound)
|
||||
platformtools.dialogNotification(heading, message, sound=sound)
|
||||
|
||||
if item.from_action in ["findvideos", "play"]:
|
||||
platformtools.itemlist_refresh()
|
||||
platformtools.itemlistRefresh()
|
||||
|
||||
|
||||
def delete_from_context(item):
|
||||
@@ -636,13 +636,13 @@ def delete_from_context(item):
|
||||
if item.to_channel != "":
|
||||
item.from_channel = item.to_channel
|
||||
|
||||
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
|
||||
dict_series = jsontools.getNodeFromFile(item.from_channel, TAG_TVSHOW_FILTER)
|
||||
tvshow = item.show.strip().lower()
|
||||
|
||||
lang_selected = dict_series.get(tvshow, {}).get(TAG_LANGUAGE, "")
|
||||
dict_series.pop(tvshow, None)
|
||||
|
||||
result, json_data = jsontools.update_node(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
|
||||
result, json_data = jsontools.updateNode(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
|
||||
|
||||
sound = False
|
||||
if result:
|
||||
@@ -652,7 +652,7 @@ def delete_from_context(item):
|
||||
sound = True
|
||||
|
||||
heading = "%s [%s]" % (item.show.strip(), lang_selected)
|
||||
platformtools.dialog_notification(heading, message, sound=sound)
|
||||
platformtools.dialogNotification(heading, message, sound=sound)
|
||||
|
||||
if item.from_action in ["findvideos", "play", "no_filter"]: # 'no_filter' es el mismo caso que L#601
|
||||
platformtools.itemlist_refresh()
|
||||
platformtools.itemlistRefresh()
|
||||
|
||||
+9
-9
@@ -21,16 +21,16 @@ from core import scrapertools
|
||||
import urllib3
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
# Get the addon version
|
||||
__version = config.get_addon_version()
|
||||
__version = config.getAddonVersion()
|
||||
|
||||
cookies_lock = Lock()
|
||||
|
||||
cj = cookielib.MozillaCookieJar()
|
||||
cookies_file = os.path.join(config.get_data_path(), "cookies.dat")
|
||||
cookies_file = os.path.join(config.getDataPath(), "cookies.dat")
|
||||
|
||||
# Headers by default, if nothing is specified
|
||||
default_headers = dict()
|
||||
default_headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36" % config.get_setting("chrome_ua_version")
|
||||
default_headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36" % config.getSetting("chrome_ua_version")
|
||||
default_headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
|
||||
default_headers["Accept-Language"] = "it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3"
|
||||
default_headers["Accept-Charset"] = "UTF-8"
|
||||
@@ -52,7 +52,7 @@ directIP = {
|
||||
}
|
||||
|
||||
# Maximum wait time for downloadpage, if nothing is specified
|
||||
HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = config.get_setting('httptools_timeout', default=15)
|
||||
HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = config.getSetting('httptools_timeout', default=15)
|
||||
if HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT == 0: HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = None
|
||||
|
||||
# Random use of User-Agents, if nad is not specified
|
||||
@@ -67,7 +67,7 @@ HTTPTOOLS_DEFAULT_RANDOM_HEADERS = False
|
||||
# domainCF.extend(otherCF)
|
||||
|
||||
# CF_LIST = list()
|
||||
# CF_LIST_PATH = os.path.join(config.get_data_path(), "CF_Domains.txt")
|
||||
# CF_LIST_PATH = os.path.join(config.getDataPath(), "CF_Domains.txt")
|
||||
#
|
||||
# if os.path.exists(CF_LIST_PATH):
|
||||
# with open(CF_LIST_PATH, "rb") as CF_File:
|
||||
@@ -167,7 +167,7 @@ def random_useragent():
|
||||
|
||||
import random
|
||||
|
||||
UserAgentPath = os.path.join(config.get_runtime_path(), 'tools', 'UserAgent.csv')
|
||||
UserAgentPath = os.path.join(config.getRuntimePath(), 'tools', 'UserAgent.csv')
|
||||
if os.path.exists(UserAgentPath):
|
||||
UserAgentIem = random.choice(list(open(UserAgentPath))).strip()
|
||||
if UserAgentIem:
|
||||
@@ -203,7 +203,7 @@ def show_infobox(info_dict):
|
||||
|
||||
|
||||
width = 100
|
||||
version = '%s: %s' % (config.get_localized_string(20000), __version)
|
||||
version = '%s: %s' % (config.getLocalizedString(20000), __version)
|
||||
if config.is_xbmc():
|
||||
box = box_items_kodi
|
||||
else:
|
||||
@@ -292,7 +292,7 @@ def downloadpage(url, **opt):
|
||||
from lib import requests
|
||||
session = requests.session()
|
||||
|
||||
if config.get_setting('resolver_dns') and not opt.get('use_requests', False):
|
||||
if config.getSetting('resolver_dns') and not opt.get('use_requests', False):
|
||||
from core import resolverdns
|
||||
session.mount('https://', resolverdns.CipherSuiteAdapter(domain))
|
||||
|
||||
@@ -454,7 +454,7 @@ def downloadpage(url, **opt):
|
||||
|
||||
if not 'api.themoviedb' in url and not opt.get('alfa_s', False):
|
||||
show_infobox(info_dict)
|
||||
if not config.get_setting("debug"): logger.info('Page URL:',url)
|
||||
if not config.getSetting("debug"): logger.info('Page URL:',url)
|
||||
return type('HTTPResponse', (), response)
|
||||
|
||||
def fill_fields_pre(url, opt, proxy_data, file_name):
|
||||
|
||||
+4
-4
@@ -58,7 +58,7 @@ def to_utf8(dct):
|
||||
return dct
|
||||
|
||||
|
||||
def get_node_from_file(name_file, node, path=None):
|
||||
def getNodeFromFile(name_file, node, path=None):
|
||||
"""
|
||||
Gets the node of a JSON file
|
||||
|
||||
@@ -80,7 +80,7 @@ def get_node_from_file(name_file, node, path=None):
|
||||
name_file += "_data.json"
|
||||
|
||||
if not path:
|
||||
path = filetools.join(config.get_data_path(), "settings_channels")
|
||||
path = filetools.join(config.getDataPath(), "settings_channels")
|
||||
|
||||
fname = filetools.join(path, name_file)
|
||||
|
||||
@@ -126,7 +126,7 @@ def check_to_backup(data, fname, dict_data):
|
||||
logger.debug("The file is empty: %s" % fname)
|
||||
|
||||
|
||||
def update_node(dict_node, name_file, node, path=None, silent=False):
|
||||
def updateNode(dict_node, name_file, node, path=None, silent=False):
|
||||
"""
|
||||
update the json_data of a file with the last dictionary
|
||||
|
||||
@@ -152,7 +152,7 @@ def update_node(dict_node, name_file, node, path=None, silent=False):
|
||||
name_file += "_data.json"
|
||||
|
||||
if not path:
|
||||
path = filetools.join(config.get_data_path(), "settings_channels")
|
||||
path = filetools.join(config.getDataPath(), "settings_channels")
|
||||
|
||||
fname = filetools.join(path, name_file)
|
||||
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ class CipherSuiteAdapter(host_header_ssl.HostHeaderSSLAdapter):
|
||||
logger.info(e)
|
||||
# if 'SSLError' in str(e):
|
||||
# # disabilito
|
||||
# config.set_setting("resolver_dns", False)
|
||||
# config.setSetting("resolver_dns", False)
|
||||
# request.url = realUrl
|
||||
# ret = super(CipherSuiteAdapter, self).send(request, **kwargs)
|
||||
# else:
|
||||
|
||||
+30
-30
@@ -25,14 +25,14 @@ def find_and_set_infoLabels(item):
|
||||
scraper = None
|
||||
# logger.debug("item:\n" + item.tostring('\n'))
|
||||
|
||||
list_opciones_cuadro = [config.get_localized_string(60223), config.get_localized_string(60224)]
|
||||
list_opciones_cuadro = [config.getLocalizedString(60223), config.getLocalizedString(60224)]
|
||||
# If more scrapers are added, they must be declared here-> "modulo_scraper": "Text_in_box"
|
||||
scrapers_disponibles = {'tmdb': config.get_localized_string(60225), 'tvdb': config.get_localized_string(60226)}
|
||||
scrapers_disponibles = {'tmdb': config.getLocalizedString(60225), 'tvdb': config.getLocalizedString(60226)}
|
||||
|
||||
# Get the default Scraper of the configuration according to the content type
|
||||
if item.contentType == "movie":
|
||||
scraper_actual = 'tmdb'
|
||||
# scraper_actual = ['tmdb'][config.get_setting("scraper_movies", "videolibrary")]
|
||||
# scraper_actual = ['tmdb'][config.getSetting("scraper_movies", "videolibrary")]
|
||||
tipo_contenido = "movie"
|
||||
title = item.contentTitle
|
||||
# Complete list of options for this type of content
|
||||
@@ -40,7 +40,7 @@ def find_and_set_infoLabels(item):
|
||||
|
||||
else:
|
||||
scraper_actual = 'tmdb'
|
||||
# scraper_actual = ['tmdb', 'tvdb'][config.get_setting("scraper_tvshows", "videolibrary")]
|
||||
# scraper_actual = ['tmdb', 'tvdb'][config.getSetting("scraper_tvshows", "videolibrary")]
|
||||
tipo_contenido = "serie"
|
||||
title = item.contentSerieName
|
||||
# Complete list of options for this type of content
|
||||
@@ -68,14 +68,14 @@ def find_and_set_infoLabels(item):
|
||||
return True
|
||||
elif scraper_result:
|
||||
# Content found but no 'code'
|
||||
msg = config.get_localized_string(60227) % title
|
||||
msg = config.getLocalizedString(60227) % title
|
||||
else:
|
||||
# Content not found
|
||||
msg = config.get_localized_string(60228) % title
|
||||
msg = config.getLocalizedString(60228) % title
|
||||
|
||||
logger.debug(msg)
|
||||
# Show box with other options:
|
||||
item = platformtools.dialog_info(item, scraper_actual)
|
||||
item = platformtools.dialogInfo(item, scraper_actual)
|
||||
if item.exit:
|
||||
logger.debug("You have clicked 'cancel' in the window '%s'" % msg)
|
||||
return False
|
||||
@@ -91,19 +91,19 @@ def find_and_set_infoLabels(item):
|
||||
|
||||
# COLOR = ["0xFF65B3DA", "0xFFFFFFFF"]
|
||||
# # We create the list of infoLabel fields
|
||||
# controls = [("title", "text", config.get_localized_string(60230)),
|
||||
# ("originaltitle", "text", config.get_localized_string(60231)),
|
||||
# ("year", "text", config.get_localized_string(60232)),
|
||||
# ("identificadores", "label", config.get_localized_string(60233)),
|
||||
# ("tmdb_id", "text", config.get_localized_string(60234)),
|
||||
# ("url_tmdb", "text", config.get_localized_string(60235), "+!eq(-1,'')"),
|
||||
# ("tvdb_id", "text", config.get_localized_string(60236), "+eq(-7,'Serie')"),
|
||||
# ("url_tvdb", "text", config.get_localized_string(60237), "+!eq(-1,'')+eq(-8,'Serie')"),
|
||||
# ("imdb_id", "text", config.get_localized_string(60238)),
|
||||
# ("otro_id", "text", config.get_localized_string(60239), "+eq(-1,'')"),
|
||||
# ("urls", "label", config.get_localized_string(60240)),
|
||||
# ("fanart", "text", config.get_localized_string(60241)),
|
||||
# ("thumbnail", "text", config.get_localized_string(60242))]
|
||||
# controls = [("title", "text", config.getLocalizedString(60230)),
|
||||
# ("originaltitle", "text", config.getLocalizedString(60231)),
|
||||
# ("year", "text", config.getLocalizedString(60232)),
|
||||
# ("identificadores", "label", config.getLocalizedString(60233)),
|
||||
# ("tmdb_id", "text", config.getLocalizedString(60234)),
|
||||
# ("url_tmdb", "text", config.getLocalizedString(60235), "+!eq(-1,'')"),
|
||||
# ("tvdb_id", "text", config.getLocalizedString(60236), "+eq(-7,'Serie')"),
|
||||
# ("url_tvdb", "text", config.getLocalizedString(60237), "+!eq(-1,'')+eq(-8,'Serie')"),
|
||||
# ("imdb_id", "text", config.getLocalizedString(60238)),
|
||||
# ("otro_id", "text", config.getLocalizedString(60239), "+eq(-1,'')"),
|
||||
# ("urls", "label", config.getLocalizedString(60240)),
|
||||
# ("fanart", "text", config.getLocalizedString(60241)),
|
||||
# ("thumbnail", "text", config.getLocalizedString(60242))]
|
||||
|
||||
# if item.infoLabels["mediatype"] == "movie":
|
||||
# mediatype_default = 0
|
||||
@@ -112,12 +112,12 @@ def find_and_set_infoLabels(item):
|
||||
|
||||
# listado_controles = [{'id': "mediatype",
|
||||
# 'type': "list",
|
||||
# 'label': config.get_localized_string(60243),
|
||||
# 'label': config.getLocalizedString(60243),
|
||||
# 'color': COLOR[1],
|
||||
# 'default': mediatype_default,
|
||||
# 'enabled': True,
|
||||
# 'visible': True,
|
||||
# 'lvalues': [config.get_localized_string(60244), config.get_localized_string(70136)]
|
||||
# 'lvalues': [config.getLocalizedString(60244), config.getLocalizedString(70136)]
|
||||
# }]
|
||||
|
||||
# for i, c in enumerate(controls):
|
||||
@@ -154,7 +154,7 @@ def find_and_set_infoLabels(item):
|
||||
# 'visible': True})
|
||||
|
||||
# # logger.debug(dict_default)
|
||||
# if platformtools.show_channel_settings(list_controls=listado_controles, caption=config.get_localized_string(60246), item=item,
|
||||
# if platformtools.showChannelSettings(list_controls=listado_controles, caption=config.getLocalizedString(60246), item=item,
|
||||
# callback="core.scraper.callback_cuadro_completar",
|
||||
# custom_button={"visible": False}):
|
||||
# return True
|
||||
@@ -225,16 +225,16 @@ def get_nfo(item, search_groups=False):
|
||||
|
||||
return info_nfo
|
||||
else:
|
||||
try: return scraper.get_nfo(item)
|
||||
except:
|
||||
if item.contentType == "movie": scraper_actual = ['tmdb'][config.get_setting("scraper_movies", "videolibrary")]
|
||||
else: scraper_actual = ['tmdb', 'tvdb'][config.get_setting("scraper_tvshows", "videolibrary")]
|
||||
scraper = __import__('core.%s' % scraper_actual, fromlist=["core.%s" % scraper_actual])
|
||||
return scraper.get_nfo(item, search_groups)
|
||||
# try: return scraper.get_nfo(item)
|
||||
# except:
|
||||
# if item.contentType == "movie": scraper_actual = ['tmdb'][config.getSetting("scraper_movies", "videolibrary")]
|
||||
# else: scraper_actual = ['tmdb', 'tvdb'][config.getSetting("scraper_tvshows", "videolibrary")]
|
||||
scraper = __import__('core.tmdb', fromlist=["core.tmdb" ])
|
||||
return scraper.get_nfo(item, search_groups)
|
||||
|
||||
|
||||
def sort_episode_list(episodelist):
|
||||
scraper_actual = ['tmdb', 'tvdb'][config.get_setting("scraper_tvshows", "videolibrary")]
|
||||
scraper_actual = ['tmdb', 'tvdb'][config.getSetting("scraper_tvshows", "videolibrary")]
|
||||
|
||||
if scraper_actual == "tmdb":
|
||||
episodelist.sort(key=lambda e: (int(e.contentSeason), int(e.contentEpisodeNumber)))
|
||||
|
||||
@@ -59,11 +59,11 @@ def find_single_match(data, patron, index=0):
|
||||
|
||||
|
||||
# Parse string and extracts multiple matches using regular expressions
|
||||
def find_multiple_matches(text, pattern):
|
||||
def findMultipleMatches(text, pattern):
|
||||
return re.findall(pattern, text, re.DOTALL)
|
||||
|
||||
|
||||
def find_multiple_matches_groups(text, pattern):
|
||||
def findMultipleMatches_groups(text, pattern):
|
||||
r = re.compile(pattern)
|
||||
return [m.groupdict() for m in r.finditer(text)]
|
||||
|
||||
|
||||
+51
-51
@@ -223,7 +223,7 @@ def get_server_from_url(url):
|
||||
return None
|
||||
|
||||
|
||||
def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialogo=False, background_dialog=False):
|
||||
def resolve_videoUrls_for_playing(server, url, video_password="", muestra_dialogo=False, background_dialog=False):
|
||||
"""
|
||||
Function to get the real url of the video
|
||||
@param server: Server where the video is hosted
|
||||
@@ -244,7 +244,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
|
||||
|
||||
server = server.lower()
|
||||
|
||||
video_urls = []
|
||||
videoUrls = []
|
||||
video_exists = True
|
||||
error_messages = []
|
||||
opciones = []
|
||||
@@ -254,7 +254,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
|
||||
if isinstance(video_password, list):
|
||||
return video_password, len(video_password) > 0, "<br/>".join(error_messages)
|
||||
logger.info("Server: %s, url is good" % server)
|
||||
video_urls.append({'type':urlparse.urlparse(url)[2].split('.')[-1], 'url':url})
|
||||
videoUrls.append({'type':urlparse.urlparse(url)[2].split('.')[-1], 'url':url})
|
||||
|
||||
# Find out the video URL
|
||||
else:
|
||||
@@ -266,7 +266,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
|
||||
if server_parameters:
|
||||
# Show a progress dialog
|
||||
if muestra_dialogo:
|
||||
progreso = (platformtools.dialog_progress_bg if background_dialog else platformtools.dialog_progress)(config.get_localized_string(20000), config.get_localized_string(70180) % translate_server_name(server_parameters["name"]))
|
||||
progreso = (platformtools.dialogProgressBg if background_dialog else platformtools.dialogProgress)(config.getLocalizedString(20000), config.getLocalizedString(70180) % translate_server_name(server_parameters["name"]))
|
||||
|
||||
# Count the available options, to calculate the percentage
|
||||
|
||||
@@ -279,15 +279,15 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
|
||||
if server_parameters["free"] == True:
|
||||
opciones.append("free")
|
||||
opciones.extend(
|
||||
[premium for premium in server_parameters["premium"] if config.get_setting("premium", server=premium)])
|
||||
[premium for premium in server_parameters["premium"] if config.getSetting("premium", server=premium)])
|
||||
|
||||
priority = int(config.get_setting("resolve_priority"))
|
||||
priority = int(config.getSetting("resolve_priority"))
|
||||
opciones = sorted(opciones, key=lambda x: order[priority].index(x))
|
||||
|
||||
logger.info("Available options: %s | %s" % (len(opciones), opciones))
|
||||
else:
|
||||
logger.error("There is no connector for the server %s" % server)
|
||||
error_messages.append(config.get_localized_string(60004) % server)
|
||||
error_messages.append(config.getLocalizedString(60004) % server)
|
||||
muestra_dialogo = False
|
||||
|
||||
# Import the server
|
||||
@@ -336,60 +336,60 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
|
||||
|
||||
# Show progress
|
||||
if muestra_dialogo:
|
||||
progreso.update((old_div(100, len(opciones))) * opciones.index(opcion), config.get_localized_string(70180) % server_name)
|
||||
progreso.update((old_div(100, len(opciones))) * opciones.index(opcion), config.getLocalizedString(70180) % server_name)
|
||||
|
||||
# Free mode
|
||||
if opcion == "free":
|
||||
try:
|
||||
logger.info("Invoking a %s.get_video_url" % server)
|
||||
response = serverid.get_video_url(page_url=url, video_password=video_password)
|
||||
video_urls.extend(response)
|
||||
logger.info("Invoking a %s.get_videoUrl" % server)
|
||||
response = serverid.get_videoUrl(page_url=url, video_password=video_password)
|
||||
videoUrls.extend(response)
|
||||
except:
|
||||
logger.error("Error getting url in free mode")
|
||||
error_messages.append(config.get_localized_string(60014))
|
||||
error_messages.append(config.getLocalizedString(60014))
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
# Premium mode
|
||||
else:
|
||||
try:
|
||||
logger.info("Invoking a %s.get_video_url" % opcion)
|
||||
response = serverid.get_video_url(page_url=url, premium=True,
|
||||
user=config.get_setting("user", server=opcion),
|
||||
password=config.get_setting("password", server=opcion),
|
||||
logger.info("Invoking a %s.get_videoUrl" % opcion)
|
||||
response = serverid.get_videoUrl(page_url=url, premium=True,
|
||||
user=config.getSetting("user", server=opcion),
|
||||
password=config.getSetting("password", server=opcion),
|
||||
video_password=video_password)
|
||||
if response and response[0][1]:
|
||||
video_urls.extend(response)
|
||||
videoUrls.extend(response)
|
||||
elif response and response[0][0]:
|
||||
error_messages.append(response[0][0])
|
||||
else:
|
||||
error_messages.append(config.get_localized_string(60014))
|
||||
error_messages.append(config.getLocalizedString(60014))
|
||||
except:
|
||||
logger.error("Server errorr: %s" % opcion)
|
||||
error_messages.append(config.get_localized_string(60014))
|
||||
error_messages.append(config.getLocalizedString(60014))
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
# If we already have URLS, we stop searching
|
||||
if video_urls and config.get_setting("resolve_stop") == True:
|
||||
if videoUrls and config.getSetting("resolve_stop") == True:
|
||||
break
|
||||
|
||||
# We close progress
|
||||
if muestra_dialogo:
|
||||
progreso.update(100, config.get_localized_string(60008))
|
||||
progreso.update(100, config.getLocalizedString(60008))
|
||||
progreso.close()
|
||||
|
||||
# If there are no options available, we show the notice of premium accounts
|
||||
if video_exists and not opciones and server_parameters.get("premium"):
|
||||
listapremium = [get_server_parameters(premium)["name"] for premium in server_parameters["premium"]]
|
||||
error_messages.append(
|
||||
config.get_localized_string(60009) % (server, " o ".join(listapremium)))
|
||||
config.getLocalizedString(60009) % (server, " o ".join(listapremium)))
|
||||
|
||||
# If we do not have urls or error messages, we put a generic one
|
||||
elif not video_urls and not error_messages:
|
||||
error_messages.append(config.get_localized_string(60014))
|
||||
elif not videoUrls and not error_messages:
|
||||
error_messages.append(config.getLocalizedString(60014))
|
||||
|
||||
return video_urls, len(video_urls) > 0, "<br/>".join(error_messages)
|
||||
return videoUrls, len(videoUrls) > 0, "<br/>".join(error_messages)
|
||||
|
||||
|
||||
def get_server_name(serverid):
|
||||
@@ -444,11 +444,11 @@ def is_server_enabled(server):
|
||||
|
||||
server_parameters = get_server_parameters(server)
|
||||
if server_parameters["active"] == True:
|
||||
if not config.get_setting("hidepremium"):
|
||||
if not config.getSetting("hidepremium"):
|
||||
return True
|
||||
elif server_parameters["free"] == True:
|
||||
return True
|
||||
elif [premium for premium in server_parameters["premium"] if config.get_setting("premium", server=premium)]:
|
||||
elif [premium for premium in server_parameters["premium"] if config.getSetting("premium", server=premium)]:
|
||||
return True
|
||||
|
||||
return False
|
||||
@@ -473,12 +473,12 @@ def get_server_parameters(server):
|
||||
try:
|
||||
path = ''
|
||||
# Servers
|
||||
if filetools.isfile(filetools.join(config.get_runtime_path(), "servers", server + ".json")):
|
||||
path = filetools.join(config.get_runtime_path(), "servers", server + ".json")
|
||||
if filetools.isfile(filetools.join(config.getRuntimePath(), "servers", server + ".json")):
|
||||
path = filetools.join(config.getRuntimePath(), "servers", server + ".json")
|
||||
|
||||
# Debriders
|
||||
elif filetools.isfile(filetools.join(config.get_runtime_path(), "servers", "debriders", server + ".json")):
|
||||
path = filetools.join(config.get_runtime_path(), "servers", "debriders", server + ".json")
|
||||
elif filetools.isfile(filetools.join(config.getRuntimePath(), "servers", "debriders", server + ".json")):
|
||||
path = filetools.join(config.getRuntimePath(), "servers", "debriders", server + ".json")
|
||||
|
||||
# When the server is not well defined in the channel (there is no connector), it shows an error because there is no "path" and the channel has to be checked
|
||||
dict_server = jsontools.load(filetools.read(path))
|
||||
@@ -487,7 +487,7 @@ def get_server_parameters(server):
|
||||
|
||||
# Images: url and local files are allowed inside "resources / images"
|
||||
if dict_server.get("thumbnail") and "://" not in dict_server["thumbnail"]:
|
||||
dict_server["thumbnail"] = filetools.join(config.get_runtime_path(), "resources", "media",
|
||||
dict_server["thumbnail"] = filetools.join(config.getRuntimePath(), "resources", "media",
|
||||
"servers", dict_server["thumbnail"])
|
||||
for k in ['premium', 'id']:
|
||||
dict_server[k] = dict_server.get(k, list())
|
||||
@@ -507,7 +507,7 @@ def get_server_parameters(server):
|
||||
dict_servers_parameters[server] = dict_server
|
||||
|
||||
except:
|
||||
mensaje = config.get_localized_string(59986) % server
|
||||
mensaje = config.getLocalizedString(59986) % server
|
||||
import traceback
|
||||
logger.error(mensaje + traceback.format_exc())
|
||||
return {}
|
||||
@@ -539,7 +539,7 @@ def get_server_controls_settings(server_name):
|
||||
return list_controls, dict_settings
|
||||
|
||||
|
||||
def get_server_setting(name, server, default=None):
|
||||
def getServerSetting(name, server, default=None):
|
||||
"""
|
||||
Returns the configuration value of the requested parameter.
|
||||
|
||||
@@ -563,10 +563,10 @@ def get_server_setting(name, server, default=None):
|
||||
|
||||
"""
|
||||
# We create the folder if it does not exist
|
||||
if not filetools.exists(filetools.join(config.get_data_path(), "settings_servers")):
|
||||
filetools.mkdir(filetools.join(config.get_data_path(), "settings_servers"))
|
||||
if not filetools.exists(filetools.join(config.getDataPath(), "settings_servers")):
|
||||
filetools.mkdir(filetools.join(config.getDataPath(), "settings_servers"))
|
||||
|
||||
file_settings = filetools.join(config.get_data_path(), "settings_servers", server + "_data.json")
|
||||
file_settings = filetools.join(config.getDataPath(), "settings_servers", server + "_data.json")
|
||||
dict_settings = {}
|
||||
dict_file = {}
|
||||
if filetools.exists(file_settings):
|
||||
@@ -596,12 +596,12 @@ def get_server_setting(name, server, default=None):
|
||||
return dict_settings.get(name, default)
|
||||
|
||||
|
||||
def set_server_setting(name, value, server):
|
||||
def setServerSetting(name, value, server):
|
||||
# We create the folder if it does not exist
|
||||
if not filetools.exists(filetools.join(config.get_data_path(), "settings_servers")):
|
||||
filetools.mkdir(filetools.join(config.get_data_path(), "settings_servers"))
|
||||
if not filetools.exists(filetools.join(config.getDataPath(), "settings_servers")):
|
||||
filetools.mkdir(filetools.join(config.getDataPath(), "settings_servers"))
|
||||
|
||||
file_settings = filetools.join(config.get_data_path(), "settings_servers", server + "_data.json")
|
||||
file_settings = filetools.join(config.getDataPath(), "settings_servers", server + "_data.json")
|
||||
dict_settings = {}
|
||||
|
||||
dict_file = None
|
||||
@@ -639,7 +639,7 @@ def get_servers_list():
|
||||
"""
|
||||
global server_list
|
||||
if not server_list:
|
||||
for server in filetools.listdir(filetools.join(config.get_runtime_path(), "servers")):
|
||||
for server in filetools.listdir(filetools.join(config.getRuntimePath(), "servers")):
|
||||
if server.endswith(".json") and not server == "version.json":
|
||||
server_parameters = get_server_parameters(server)
|
||||
if server_parameters['active']:
|
||||
@@ -657,7 +657,7 @@ def get_debriders_list():
|
||||
@rtype: dict
|
||||
"""
|
||||
server_list = {}
|
||||
for server in filetools.listdir(filetools.join(config.get_runtime_path(), "servers", "debriders")):
|
||||
for server in filetools.listdir(filetools.join(config.getRuntimePath(), "servers", "debriders")):
|
||||
if server.endswith(".json"):
|
||||
server_parameters = get_server_parameters(server)
|
||||
if server_parameters["active"] == True:
|
||||
@@ -682,13 +682,13 @@ def sort_servers(servers_list):
|
||||
if not servers_list:
|
||||
return []
|
||||
|
||||
blacklisted_servers = config.get_setting("black_list", server='servers', default=[])
|
||||
favorite_servers = [s for s in config.get_setting('favorites_servers_list', server='servers', default=[]) if s not in blacklisted_servers]
|
||||
blacklisted_servers = config.getSetting("black_list", server='servers', default=[])
|
||||
favorite_servers = [s for s in config.getSetting('favorites_servers_list', server='servers', default=[]) if s not in blacklisted_servers]
|
||||
|
||||
sorted_list = []
|
||||
inverted = False
|
||||
|
||||
if config.get_setting('default_action') == 2:
|
||||
if config.getSetting('default_action') == 2:
|
||||
inverted = True
|
||||
|
||||
# Priorities when ordering itemlist:
|
||||
@@ -697,8 +697,8 @@ def sort_servers(servers_list):
|
||||
# 2: Qualities and Servers
|
||||
|
||||
priority = 0
|
||||
if config.get_setting('favorites_servers') and favorite_servers: priority = 1
|
||||
if config.get_setting('quality_priority'): priority = 2
|
||||
if config.getSetting('favorites_servers') and favorite_servers: priority = 1
|
||||
if config.getSetting('quality_priority'): priority = 2
|
||||
|
||||
for item in servers_list:
|
||||
element = dict()
|
||||
@@ -802,16 +802,16 @@ def check_video_link(item, timeout=3):
|
||||
|
||||
|
||||
def translate_server_name(name):
|
||||
if '@' in name: return config.get_localized_string(int(name.replace('@','')))
|
||||
if '@' in name: return config.getLocalizedString(int(name.replace('@','')))
|
||||
else: return name
|
||||
|
||||
|
||||
# def get_server_json(server_name):
|
||||
# # logger.info("server_name=" + server_name)
|
||||
# try:
|
||||
# server_path = filetools.join(config.get_runtime_path(), "servers", server_name + ".json")
|
||||
# server_path = filetools.join(config.getRuntimePath(), "servers", server_name + ".json")
|
||||
# if not filetools.exists(server_path):
|
||||
# server_path = filetools.join(config.get_runtime_path(), "servers", "debriders", server_name + ".json")
|
||||
# server_path = filetools.join(config.getRuntimePath(), "servers", "debriders", server_name + ".json")
|
||||
#
|
||||
# # logger.info("server_path=" + server_path)
|
||||
# server_json = jsontools.load(filetools.read(server_path))
|
||||
|
||||
+90
-91
@@ -174,7 +174,7 @@ class scrape:
|
||||
scrapingTime = time()
|
||||
if self.patronBlock:
|
||||
if self.debugBlock: regexDbg(item, self.patronBlock, self.headers, self.data)
|
||||
blocks = scrapertools.find_multiple_matches_groups(self.data, self.patronBlock)
|
||||
blocks = scrapertools.findMultipleMatches_groups(self.data, self.patronBlock)
|
||||
for bl in blocks:self._scrapeBlock(item, bl)
|
||||
|
||||
elif self.patron:
|
||||
@@ -226,10 +226,6 @@ class scrape:
|
||||
self.itemlist = newFunc()
|
||||
self.itemlist = [i for i in self.itemlist if i.action not in ['add_movie_to_library', 'add_serie_to_library']]
|
||||
|
||||
if not self.group and not self.args.get('groupExplode') and ((self.pagination and len(self.matches) <= self.pag * self.pagination) or not self.pagination): # next page with pagination
|
||||
if self.patronNext and not stackCheck('newest') and not stackCheck('get_channel_results'):
|
||||
nextPage(self.itemlist, item, self.function, data=self.data, patron=self.patronNext, patron_total_pages=self.patronTotalPages)
|
||||
|
||||
if self.numerationEnabled and not stackCheck('find_episodes'):
|
||||
from platformcode import autorenumber
|
||||
if self.function == 'episodes':
|
||||
@@ -251,9 +247,13 @@ class scrape:
|
||||
if self.tmdbEnabled and (
|
||||
self.action != 'play' and 'patronMenu' not in self.args and 'patronGenreMenu' not in self.args
|
||||
and not stackCheck(['add_tvshow', 'get_newest']) and (self.function not in ['episodes', 'mainlist']
|
||||
or (self.function in ['episodes'] and config.get_setting('episode_info')))):
|
||||
or (self.function in ['episodes'] and config.getSetting('episode_info')))):
|
||||
|
||||
tmdb.set_infoLabels_itemlist(self.itemlist, seekTmdb=True)
|
||||
|
||||
if not self.group and not self.args.get('groupExplode') and ((self.pagination and len(self.matches) <= self.pag * self.pagination) or not self.pagination): # next page with pagination
|
||||
if self.patronNext and not stackCheck('newest') and not stackCheck('get_channel_results'):
|
||||
nextPage(self.itemlist, item, self.function, data=self.data, patron=self.patronNext, patron_total_pages=self.patronTotalPages)
|
||||
|
||||
if not stackCheck(['find_episodes', 'add_tvshow']):
|
||||
if self.videlibraryEnabled and (item.infoLabels["title"] or item.fulltitle):
|
||||
@@ -274,7 +274,7 @@ class scrape:
|
||||
raise logger.ChannelScraperException
|
||||
|
||||
|
||||
if config.get_setting('trakt_sync'):
|
||||
if config.getSetting('trakt_sync'):
|
||||
from core import trakt_tools
|
||||
trakt_tools.trakt_check(self.itemlist)
|
||||
logger.debug(item.channel, 'scraping time:', time()-scrapingTime)
|
||||
@@ -292,7 +292,7 @@ class scrape:
|
||||
if self.debug:
|
||||
regexDbg(item, self.patron, self.headers, block)
|
||||
|
||||
matches = scrapertools.find_multiple_matches_groups(block, self.patron)
|
||||
matches = scrapertools.findMultipleMatches_groups(block, self.patron)
|
||||
logger.debug('MATCHES =', matches)
|
||||
|
||||
for match in matches:
|
||||
@@ -320,7 +320,7 @@ class scrape:
|
||||
self.itemParams._plot = cleantitle(self.itemParams._plot)
|
||||
self.itemParams._language = scrapeLang(self.itemParams, self.lang)
|
||||
|
||||
self.set_infolabels(item)
|
||||
self.setInfolabels(item)
|
||||
if self.sceneTitle: self.set_sceneTitle()
|
||||
|
||||
if not self.group or item.grouped:
|
||||
@@ -330,13 +330,13 @@ class scrape:
|
||||
if self.itemParams._season: self.itemParams.infoLabels['season'] = int(self.itemParams._season)
|
||||
if self.itemParams._episode: self.itemParams.infoLabels['episode'] = int(self.itemParams._episode)
|
||||
|
||||
it = self.set_item(item, match)
|
||||
it = self.setItem(item, match)
|
||||
if it: itemlist.append(it)
|
||||
|
||||
self.itemlist.extend(itemlist)
|
||||
self.matches.extend(matches)
|
||||
|
||||
def set_infolabels(self, item):
|
||||
def setInfolabels(self, item):
|
||||
if item.infoLabels["title"]:
|
||||
infolabels = item.infoLabels
|
||||
else:
|
||||
@@ -349,7 +349,7 @@ class scrape:
|
||||
if self.itemParams._plot:
|
||||
infolabels['plot'] = self.itemParams._plot
|
||||
if self.itemParams._duration:
|
||||
dur = scrapertools.find_multiple_matches(self.itemParams._duration, r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)')
|
||||
dur = scrapertools.findMultipleMatches(self.itemParams._duration, r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)')
|
||||
for h, m in dur:
|
||||
self.itemParams._duration = int(h) * 60 + int(m)
|
||||
if not dur:
|
||||
@@ -359,7 +359,7 @@ class scrape:
|
||||
except:
|
||||
self.itemParams._duration = ''
|
||||
if self.itemParams._genre:
|
||||
genres = scrapertools.find_multiple_matches(self.itemParams._genre, '[A-Za-z]+')
|
||||
genres = scrapertools.findMultipleMatches(self.itemParams._genre, '[A-Za-z]+')
|
||||
infolabels['genere'] = ", ".join(genres)
|
||||
if self.itemParams._rating:
|
||||
rating = scrapertools.decodeHtmlentities(self.itemParams._rating)
|
||||
@@ -397,7 +397,7 @@ class scrape:
|
||||
self.itemParams.infoLabels['episode'] = parsedTitle.get('episode')
|
||||
|
||||
elif parsedTitle.get('season') and type(parsedTitle.get('season')) == list:
|
||||
self.itemParams._extraInfo = '{}: {}-{}'.format(config.get_localized_string(30140), parsedTitle.get('season')[0], parsedTitle.get('season')[-1])
|
||||
self.itemParams._extraInfo = '{}: {}-{}'.format(config.getLocalizedString(30140), parsedTitle.get('season')[0], parsedTitle.get('season')[-1])
|
||||
elif parsedTitle.get('season'):
|
||||
self.itemParams._season = str(parsedTitle.get('season'))
|
||||
if parsedTitle.get('episode_title'):
|
||||
@@ -439,7 +439,7 @@ class scrape:
|
||||
logger.debug('invalid episode: ' + self.itemParams._episode)
|
||||
pass
|
||||
|
||||
def set_item(self, item, match):
|
||||
def setItem(self, item, match):
|
||||
AC = ''
|
||||
CT = ''
|
||||
if self.typeContentDict:
|
||||
@@ -485,11 +485,6 @@ class scrape:
|
||||
else:
|
||||
it.action=self.action
|
||||
|
||||
if it.action == 'findvideos':
|
||||
platformtools.window_type(it)
|
||||
# it.window = True if item.window_type == 0 or (config.get_setting("window_type") == 0) else False
|
||||
if it.window: it.folder = False
|
||||
|
||||
for lg in list(set(match.keys()).difference(self.known_keys)):
|
||||
it.__setattr__(lg, match[lg])
|
||||
|
||||
@@ -506,7 +501,7 @@ class scrape:
|
||||
|
||||
|
||||
def regexDbg(item, patron, headers, data=''):
|
||||
if config.dev_mode():
|
||||
if config.devMode():
|
||||
import json, webbrowser
|
||||
url = 'https://regex101.com'
|
||||
|
||||
@@ -608,11 +603,11 @@ def menu(func):
|
||||
single_search = False
|
||||
# listUrls = ['film', 'filmSub', 'tvshow', 'tvshowSub', 'anime', 'animeSub', 'search', 'top', 'topSub']
|
||||
listUrls = ['top', 'film', 'tvshow', 'anime', 'search', 'host']
|
||||
names = {'film':config.get_localized_string(30122),
|
||||
'tvshow':config.get_localized_string(30123),
|
||||
'anime':config.get_localized_string(30124),
|
||||
'doc':config.get_localized_string(30125),
|
||||
'music':config.get_localized_string(30139)}
|
||||
names = {'film':config.getLocalizedString(30122),
|
||||
'tvshow':config.getLocalizedString(30123),
|
||||
'anime':config.getLocalizedString(30124),
|
||||
'doc':config.getLocalizedString(30125),
|
||||
'music':config.getLocalizedString(30139)}
|
||||
listUrls_extra = []
|
||||
dictUrl = {}
|
||||
|
||||
@@ -665,7 +660,7 @@ def menu(func):
|
||||
args=var[2] if len(var) > 2 else '',
|
||||
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, channel, config.get_localized_string(70741) % title + '… {submenu bold}', 'search', host + url, contentType='movie' if name == 'film' else 'tvshow', style=not global_search)
|
||||
if 'search' not in args: menuItem(itemlist, channel, config.getLocalizedString(70741) % title + '… {submenu bold}', 'search', host + url, contentType='movie' if name == 'film' else 'tvshow', style=not global_search)
|
||||
|
||||
# Make EXTRA MENU (on bottom)
|
||||
for name, var in args.items():
|
||||
@@ -684,7 +679,7 @@ def menu(func):
|
||||
contentType= var[3] if len(var) > 3 else 'movie',)
|
||||
|
||||
if single_search:
|
||||
menuItem(itemlist, channel, config.get_localized_string(70741).replace(' %s', '… {bold}'), 'search', host + dictUrl['search'], style=not global_search)
|
||||
menuItem(itemlist, channel, config.getLocalizedString(70741).replace(' %s', '… {bold}'), 'search', host + dictUrl['search'], style=not global_search)
|
||||
|
||||
if not global_search:
|
||||
channel_config(item, itemlist)
|
||||
@@ -788,7 +783,7 @@ def match(item_url_string, **args):
|
||||
if type(patronBlocks) == str:
|
||||
patronBlocks = [patronBlocks]
|
||||
for p in patronBlocks:
|
||||
blocks += scrapertools.find_multiple_matches(data, p)
|
||||
blocks += scrapertools.findMultipleMatches(data, p)
|
||||
else:
|
||||
blocks = [data]
|
||||
|
||||
@@ -798,10 +793,10 @@ def match(item_url_string, **args):
|
||||
patron = [patron]
|
||||
for b in blocks:
|
||||
for p in patron:
|
||||
matches += scrapertools.find_multiple_matches(b, p)
|
||||
matches += scrapertools.findMultipleMatches(b, p)
|
||||
|
||||
# debug mode
|
||||
if config.dev_mode():
|
||||
if config.devMode():
|
||||
if debugBlock:
|
||||
match_dbg(data, patronBlock)
|
||||
if debug:
|
||||
@@ -884,7 +879,7 @@ def nextPage(itemlist, item, function_or_level=1, **kwargs):
|
||||
# create Item
|
||||
if next_page or page:
|
||||
itemlist.append(item.clone(action = inspect.stack()[function_or_level][3] if type(function_or_level) == int else function_or_level,
|
||||
title=typo(config.get_localized_string(90006), 'color kod bold'),
|
||||
title=typo(config.getLocalizedString(90006), 'color kod bold'),
|
||||
nextPage=True,
|
||||
page=page if page else item.page + 1 if item.page else 2,
|
||||
prevthumb = item.thumbnail,
|
||||
@@ -892,11 +887,12 @@ def nextPage(itemlist, item, function_or_level=1, **kwargs):
|
||||
thumbnail=thumb()))
|
||||
|
||||
|
||||
itemlist.append(item.clone(action='gotopage',
|
||||
itemlist.append(item.clone(from_cannel=item.channel,
|
||||
channel='shortcuts',
|
||||
action='gotopage',
|
||||
real_action = inspect.stack()[function_or_level][3] if type(function_or_level) == int else function_or_level,
|
||||
title=typo(config.get_localized_string(90007), 'color kod bold'),
|
||||
title=typo(config.getLocalizedString(90007), 'color kod bold'),
|
||||
nextPage=True,
|
||||
total_pages = total_pages,
|
||||
page=page if page else item.page + 1 if item.page else 2,
|
||||
prevthumb = item.thumbnail,
|
||||
thumbnail=thumb(),
|
||||
@@ -910,7 +906,7 @@ def pagination(itemlist, item, function_level=1):
|
||||
|
||||
if not item.page:
|
||||
item.page = 1
|
||||
perpage = config.get_setting('pagination', default=20)
|
||||
perpage = config.getSetting('pagination', default=20)
|
||||
action = function_level if type(function_level) == str else inspect.stack()[function_level][3]
|
||||
itlist = []
|
||||
for i, it in enumerate(itemlist):
|
||||
@@ -924,7 +920,7 @@ def pagination(itemlist, item, function_level=1):
|
||||
Item(channel=item.channel,
|
||||
contentType=item.contentType,
|
||||
action=action,
|
||||
title=typo(config.get_localized_string(90006), 'color kod bold'),
|
||||
title=typo(config.getLocalizedString(90006), 'color kod bold'),
|
||||
page=item.page + 1,
|
||||
total_pages=round(len(itemlist)/perpage),
|
||||
nextPage = True,
|
||||
@@ -933,18 +929,19 @@ def pagination(itemlist, item, function_level=1):
|
||||
thumbnail=thumb()))
|
||||
if len(itemlist) > perpage:
|
||||
itlist.append(
|
||||
Item(channel=item.channel,
|
||||
contentType=item.contentType,
|
||||
action='gotopage',
|
||||
real_action=action,
|
||||
title=typo(config.get_localized_string(90007), 'color kod bold'),
|
||||
page=item.page + 1,
|
||||
total_pages=round(len(itemlist)/perpage),
|
||||
nextPage = True,
|
||||
itemlist = True,
|
||||
prevthumb = item.thumbnail,
|
||||
thumbnail=thumb(),
|
||||
folder = False))
|
||||
Item(from_cannel=item.channel,
|
||||
channel='shortcuts',
|
||||
contentType=item.contentType,
|
||||
action='gotopage',
|
||||
real_action=action,
|
||||
title=typo(config.getLocalizedString(90007), 'color kod bold'),
|
||||
page=item.page + 1,
|
||||
total_pages=round(len(itemlist)/perpage),
|
||||
nextPage = True,
|
||||
itemlist = True,
|
||||
prevthumb = item.thumbnail,
|
||||
thumbnail=thumb(),
|
||||
folder = False))
|
||||
|
||||
return itlist
|
||||
|
||||
@@ -981,17 +978,18 @@ def season_pagination(itemlist, item, seasons=[], function_level=1):
|
||||
itlist.append(
|
||||
Item(channel=item.channel,
|
||||
action=action,
|
||||
title=typo(config.get_localized_string(90008), 'color kod bold'),
|
||||
title=typo(config.getLocalizedString(90008), 'color kod bold'),
|
||||
allSeasons = seasons,
|
||||
nextSeason = item.nextSeason + 1,
|
||||
itemlist = True,
|
||||
prevthumb = item.thumbnail,
|
||||
thumbnail=thumb()))
|
||||
itlist.append(
|
||||
Item(channel=item.channel,
|
||||
Item(from_cannel=item.channel,
|
||||
channel='shortcuts',
|
||||
action='gotoseason',
|
||||
real_action=action,
|
||||
title=typo(config.get_localized_string(90009), 'color kod bold'),
|
||||
title=typo(config.getLocalizedString(90009), 'color kod bold'),
|
||||
allSeasons = seasons,
|
||||
nextSeason = item.nextSeason + 1,
|
||||
itemlist = True,
|
||||
@@ -1021,14 +1019,14 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
||||
verifiedItemlist = []
|
||||
|
||||
def getItem(videoitem):
|
||||
if not videoitem.video_urls:
|
||||
if not videoitem.videoUrls:
|
||||
srv_param = servertools.get_server_parameters(videoitem.server.lower())
|
||||
if not srv_param: # do not exists or it's empty
|
||||
findS = servertools.get_server_from_url(videoitem.url)
|
||||
logger.debug(findS)
|
||||
if not findS:
|
||||
if item.channel == 'community':
|
||||
findS= (config.get_localized_string(30137), videoitem.url, 'directo')
|
||||
findS= (config.getLocalizedString(30137), videoitem.url, 'directo')
|
||||
else:
|
||||
videoitem.url = unshortenit.unshorten_only(videoitem.url)[0]
|
||||
findS = servertools.get_server_from_url(videoitem.url)
|
||||
@@ -1042,12 +1040,12 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
||||
else:
|
||||
videoitem.server = videoitem.server.lower()
|
||||
|
||||
if videoitem.video_urls or srv_param.get('active', False):
|
||||
if videoitem.videoUrls or srv_param.get('active', False):
|
||||
|
||||
vi = item.clone(server=videoitem.server,
|
||||
serverName=videoitem.serverName,
|
||||
url=videoitem.url,
|
||||
video_urls= videoitem.video_urlsn,
|
||||
videoUrls= videoitem.videoUrlsn,
|
||||
ch_name=channeltools.get_channel_parameters(item.channel)['title'],
|
||||
action = "play")
|
||||
|
||||
@@ -1069,7 +1067,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
||||
# videoitem.fulltitle = item.fulltitle
|
||||
# videoitem.show = item.show
|
||||
# videoitem.ch_name = channeltools.get_channel_parameters(item.channel)['title']
|
||||
# if not videoitem.video_urls: videoitem.thumbnail = item.thumbnail
|
||||
# if not videoitem.videoUrls: videoitem.thumbnail = item.thumbnail
|
||||
# videoitem.contentType = item.contentType
|
||||
# videoitem.infoLabels = item.infoLabels
|
||||
# videoitem.quality = quality
|
||||
@@ -1082,13 +1080,13 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
||||
|
||||
# non threaded for webpdb
|
||||
# dbg()
|
||||
thL = [getItem(videoitem) for videoitem in itemlist if videoitem.url or videoitem.video_urls]
|
||||
thL = [getItem(videoitem) for videoitem in itemlist if videoitem.url or videoitem.videoUrls]
|
||||
for it in thL:
|
||||
if it and not config.get_setting("black_list", server=it.server.lower()):
|
||||
if it and not config.getSetting("black_list", server=it.server.lower()):
|
||||
verifiedItemlist.append(it)
|
||||
|
||||
# with futures.ThreadPoolExecutor() as executor:
|
||||
# thL = [executor.submit(getItem, videoitem) for videoitem in itemlist if videoitem.url or videoitem.video_urls]
|
||||
# thL = [executor.submit(getItem, videoitem) for videoitem in itemlist if videoitem.url or videoitem.videoUrls]
|
||||
# for it in futures.as_completed(thL):
|
||||
# if it.result():
|
||||
# verifiedItemlist.append(it.result())
|
||||
@@ -1097,8 +1095,8 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
||||
addQualityTag(item, verifiedItemlist, data, patronTag)
|
||||
|
||||
# Check Links
|
||||
if not item.global_search and config.get_setting('checklinks') and CheckLinks and not config.get_setting('autoplay'):
|
||||
checklinks_number = config.get_setting('checklinks_number')
|
||||
if not item.global_search and config.getSetting('checklinks') and CheckLinks and not config.getSetting('autoplay'):
|
||||
checklinks_number = config.getSetting('checklinks_number')
|
||||
verifiedItemlist = servertools.check_list_links(verifiedItemlist, checklinks_number)
|
||||
|
||||
try:
|
||||
@@ -1145,7 +1143,7 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
|
||||
|
||||
if not typography: typography = 'color kod bold'
|
||||
|
||||
title = typo(config.get_localized_string(30161), typography)
|
||||
title = typo(config.getLocalizedString(30161), typography)
|
||||
contentSerieName=item.contentSerieName if item.contentSerieName else item.fulltitle if item.contentType != 'movie' else ''
|
||||
contentTitle=item.contentTitle if item.contentTitle else item.fulltitle if item.contentType == 'movie' else ''
|
||||
|
||||
@@ -1171,22 +1169,22 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
|
||||
|
||||
|
||||
def download(itemlist, item, typography='', function_level=1, function=''):
|
||||
if config.get_setting('downloadenabled'):
|
||||
if config.getSetting('downloadenabled'):
|
||||
|
||||
if not typography: typography = 'color kod bold'
|
||||
|
||||
if item.contentType == 'movie':
|
||||
from_action = 'findvideos'
|
||||
title = typo(config.get_localized_string(60354), typography)
|
||||
title = typo(config.getLocalizedString(60354), typography)
|
||||
elif item.contentType == 'episode':
|
||||
from_action = 'findvideos'
|
||||
title = typo(config.get_localized_string(60356), typography) + ' - ' + item.title
|
||||
title = typo(config.getLocalizedString(60356), typography) + ' - ' + item.title
|
||||
elif item.contentType in 'tvshow':
|
||||
if item.channel == 'community' and config.get_setting('show_seasons', item.channel):
|
||||
if item.channel == 'community' and config.getSetting('show_seasons', item.channel):
|
||||
from_action = 'season'
|
||||
else:
|
||||
from_action = 'episodes'
|
||||
title = typo(config.get_localized_string(60355), typography)
|
||||
title = typo(config.getLocalizedString(60355), typography)
|
||||
elif item.contentType in 'season':
|
||||
from_action = 'get_seasons'
|
||||
else: # content type does not support download
|
||||
@@ -1228,7 +1226,7 @@ def download(itemlist, item, typography='', function_level=1, function=''):
|
||||
itemlist.append(
|
||||
Item(channel='downloads',
|
||||
from_channel=item.channel,
|
||||
title=typo(config.get_localized_string(60357),typography),
|
||||
title=typo(config.getLocalizedString(60357),typography),
|
||||
fulltitle=item.fulltitle,
|
||||
show=item.fulltitle,
|
||||
contentType=item.contentType,
|
||||
@@ -1261,7 +1259,7 @@ def channel_config(item, itemlist):
|
||||
itemlist.append(
|
||||
Item(channel='setting',
|
||||
action="channel_config",
|
||||
title=typo(config.get_localized_string(60587), 'color kod bold'),
|
||||
title=typo(config.getLocalizedString(60587), 'color kod bold'),
|
||||
config=item.channel,
|
||||
folder=False,
|
||||
thumbnail=thumb('setting'))
|
||||
@@ -1373,8 +1371,8 @@ def thumb(data=None, mode=None):
|
||||
_year = ['anno', 'anni', 'year', 'years']
|
||||
_top = ['voto', 'voti', 'votato', 'votati', 'migliore', 'migliori', 'fortunato', 'classifica', 'classifiche', 'vote', 'voted', 'best', 'top', 'lucky', 'ranking', 'rating', 'charts']
|
||||
_popular = ['popolare', 'popolari', 'raccomandato', 'raccomandati', 'raccomandazione', 'raccomandazioni', 'momento', 'popular', 'recommended', 'recommendation', 'recommendations', 'moment']
|
||||
_all = ['tutto', 'tutta', 'tutti', 'tutte' 'all']
|
||||
_az = ['lettera', 'lettere', 'lista', 'liste', 'alfabetico', 'a-z', 'letter', 'letters', 'list', 'alphabetical']
|
||||
_all = ['tutto', 'tutta', 'tutti', 'tutte', 'all']
|
||||
_az = ['lettera', 'lettere', 'lista', 'liste', 'alfabetico', 'a-z', 'letter', 'letters', 'list', 'alphabetical', 'order', 'ordine']
|
||||
_news = ['novità', "novita'", 'aggiornamenti', 'nuovo', 'nuova', 'nuovi', 'nuove', 'ultimo', 'ultima', 'ultimi', 'ultime', 'notizia', 'notizie', 'new', 'newest', 'last', 'latest', 'news']
|
||||
_cinema = ['cinema', 'sala', 'theatre', 'theatres']
|
||||
_genre = ['genere', 'generi', 'categoria', 'categorie', 'genre', 'genres', 'category', 'categories']
|
||||
@@ -1385,9 +1383,9 @@ def thumb(data=None, mode=None):
|
||||
_info = ['informazione', 'informazioni', 'info', 'information', 'informations']
|
||||
_star = ['attore', 'attrice', 'attori', 'attrici', 'regista', 'registi', 'personaggio', 'personaggi', 'interprete', 'interpreti', 'star', 'stars', 'character', 'characters', 'performer', 'performers', 'staff', 'actor', 'actors', 'actress', 'actresses', 'director', 'directors']
|
||||
_winter = ['inverno', 'winter']
|
||||
_spring = ['primavera', 'spring'],
|
||||
_summer = ['estate', 'summer'],
|
||||
_autumn = ['autunno', 'autumn'],
|
||||
_spring = ['primavera', 'spring']
|
||||
_summer = ['estate', 'summer']
|
||||
_autumn = ['autunno', 'autumn']
|
||||
_teenager = ['ragazzo', 'ragazza', 'ragazzi', 'ragazze','teenager', 'teen']
|
||||
_learning = ['imparare', 'scuola', 'learn', 'learning', 'school']
|
||||
_animation = ['animazione', 'cartoni', 'animation', 'cartoon']
|
||||
@@ -1456,7 +1454,7 @@ def thumb(data=None, mode=None):
|
||||
'teenager':_teenager,
|
||||
'learning':_learning,
|
||||
'quality':_quality,
|
||||
'autoplay':[config.get_localized_string(60071)]
|
||||
'autoplay':[config.getLocalizedString(60071)]
|
||||
}
|
||||
|
||||
genre_dict = {'documentary':_documentary,
|
||||
@@ -1562,6 +1560,7 @@ def thumb(data=None, mode=None):
|
||||
thumb = thumb + suffix
|
||||
if not thumb:
|
||||
for t, titles in icon_dict.items():
|
||||
logger.debug(titles)
|
||||
if any(word in searched_title for word in titles):
|
||||
thumb = t
|
||||
|
||||
@@ -1590,10 +1589,10 @@ def get_thumb(thumb_name, view="thumb_"):
|
||||
from core import filetools
|
||||
if thumb_name.startswith('http'):
|
||||
return thumb_name
|
||||
elif config.get_setting('enable_custom_theme') and config.get_setting('custom_theme') and filetools.isfile(config.get_setting('custom_theme') + view + thumb_name):
|
||||
media_path = config.get_setting('custom_theme')
|
||||
elif config.getSetting('enable_custom_theme') and config.getSetting('custom_theme') and filetools.isfile(config.getSetting('custom_theme') + view + thumb_name):
|
||||
media_path = config.getSetting('custom_theme')
|
||||
else:
|
||||
icon_pack_name = config.get_setting('icon_set', default="default")
|
||||
icon_pack_name = config.getSetting('icon_set', default="default")
|
||||
media_path = filetools.join("https://raw.githubusercontent.com/kodiondemand/media/master/themes/new", icon_pack_name)
|
||||
return filetools.join(media_path, thumb_name)
|
||||
|
||||
@@ -1609,10 +1608,10 @@ def typo(string, typography=''):
|
||||
try: string = str(string)
|
||||
except: string = str(string.encode('utf8'))
|
||||
|
||||
if config.get_localized_string(30992) in string:
|
||||
if config.getLocalizedString(30992) in string:
|
||||
string = string + ' >'
|
||||
|
||||
if int(config.get_setting('view_mode_channel').split(',')[-1]) in [0, 50, 55]:
|
||||
if int(config.getSetting('view_mode_channel').split(',')[-1]) in [0, 50, 55]:
|
||||
VLT = True
|
||||
else:
|
||||
VLT = False
|
||||
@@ -1683,7 +1682,7 @@ def hdpass_get_servers(item, data=''):
|
||||
page = httptools.downloadpage(url, CF=False).data
|
||||
mir = scrapertools.find_single_match(page, patron_mir)
|
||||
|
||||
for mir_url, srv in scrapertools.find_multiple_matches(mir, patron_option):
|
||||
for mir_url, srv in scrapertools.findMultipleMatches(mir, patron_option):
|
||||
mir_url = scrapertools.decodeHtmlentities(mir_url)
|
||||
logger.debug(mir_url)
|
||||
it = hdpass_get_url(item.clone(action='play', quality=quality, url=mir_url))[0]
|
||||
@@ -1712,13 +1711,13 @@ def hdpass_get_servers(item, data=''):
|
||||
res = scrapertools.find_single_match(data, patron_res)
|
||||
|
||||
# non threaded for webpdb
|
||||
# for res_url, res_video in scrapertools.find_multiple_matches(res, patron_option):
|
||||
# for res_url, res_video in scrapertools.findMultipleMatches(res, patron_option):
|
||||
# res_url = scrapertools.decodeHtmlentities(res_url)
|
||||
# itemlist.extend(get_hosts(res_url, res_video))
|
||||
#
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
thL = []
|
||||
for res_url, res_video in scrapertools.find_multiple_matches(res, patron_option):
|
||||
for res_url, res_video in scrapertools.findMultipleMatches(res, patron_option):
|
||||
res_url = scrapertools.decodeHtmlentities(res_url)
|
||||
thL.append(executor.submit(get_hosts, res_url, res_video))
|
||||
for res in futures.as_completed(thL):
|
||||
@@ -1758,7 +1757,7 @@ def dooplay_get_links(item, host, paramList=[]):
|
||||
if not paramList:
|
||||
data = httptools.downloadpage(item.url).data.replace("'", '"')
|
||||
patron = r'<li id="player-option-[0-9]".*?data-type="([^"]+)" data-post="([^"]+)" data-nume="([^"]+)".*?<span class="title".*?>([^<>]+)</span>(?:<span class="server">([^<>]+))?'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
matches = scrapertools.findMultipleMatches(data, patron)
|
||||
else:
|
||||
matches = paramList
|
||||
ret = []
|
||||
@@ -1846,9 +1845,9 @@ def dooplay_menu(item, type):
|
||||
|
||||
########## JWPLAYER ##########
|
||||
|
||||
def get_jwplayer_mediaurl(data, srvName, onlyHttp=False, dataIsBlock=False):
|
||||
def get_jwplayer_mediaUrl(data, srvName, onlyHttp=False, dataIsBlock=False):
|
||||
from core import jsontools
|
||||
video_urls = []
|
||||
videoUrls = []
|
||||
block = scrapertools.find_single_match(data, r'sources"?\s*:\s*(.*?}?])') if not dataIsBlock else data
|
||||
if block:
|
||||
json = jsontools.load(block)
|
||||
@@ -1865,17 +1864,17 @@ def get_jwplayer_mediaurl(data, srvName, onlyHttp=False, dataIsBlock=False):
|
||||
sources.append((src, s.get('label')))
|
||||
else:
|
||||
if 'file:' in block:
|
||||
sources = scrapertools.find_multiple_matches(block, r'file:\s*"([^"]+)"(?:,label:\s*"([^"]+)")?')
|
||||
sources = scrapertools.findMultipleMatches(block, r'file:\s*"([^"]+)"(?:,label:\s*"([^"]+)")?')
|
||||
elif 'src:' in block:
|
||||
sources = scrapertools.find_multiple_matches(block, r'src:\s*"([^"]+)",\s*type:\s*"[^"]+"(?:,[^,]+,\s*label:\s*"([^"]+)")?')
|
||||
sources = scrapertools.findMultipleMatches(block, r'src:\s*"([^"]+)",\s*type:\s*"[^"]+"(?:,[^,]+,\s*label:\s*"([^"]+)")?')
|
||||
else:
|
||||
sources =[(block.replace('"',''), '')]
|
||||
for url, quality in sources:
|
||||
quality = 'auto' if not quality else quality
|
||||
if url.split('.')[-1] != 'mpd':
|
||||
video_urls.append({'type':url.split('.')[-1], 'res':quality, 'url':url if not onlyHttp else url.replace('https://', 'http://')})
|
||||
videoUrls.append({'type':url.split('.')[-1], 'res':quality, 'url':url if not onlyHttp else url.replace('https://', 'http://')})
|
||||
|
||||
return video_urls
|
||||
return videoUrls
|
||||
|
||||
|
||||
########## ITEMLIST DB FOR PAGINATION ##########
|
||||
|
||||
+13
-13
@@ -22,7 +22,7 @@ from core.item import InfoLabels
|
||||
from platformcode import config, logger, platformtools
|
||||
|
||||
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
|
||||
def_lang = info_language[config.get_setting("info_language", "videolibrary")]
|
||||
def_lang = info_language[config.getSetting("info_language", "videolibrary")]
|
||||
|
||||
host = 'https://api.themoviedb.org/3'
|
||||
api = 'a1ab8b8669da03637a4b98fa39c39228'
|
||||
@@ -82,7 +82,7 @@ def cache_response(fn):
|
||||
def check_expired(saved_date):
|
||||
valided = False
|
||||
|
||||
cache_expire = config.get_setting("tmdb_cache_expire", default=0)
|
||||
cache_expire = config.getSetting("tmdb_cache_expire", default=0)
|
||||
current_date = datetime.datetime.now()
|
||||
elapsed = current_date - saved_date
|
||||
|
||||
@@ -123,7 +123,7 @@ def cache_response(fn):
|
||||
try:
|
||||
|
||||
# cache is not active
|
||||
if not config.get_setting("tmdb_cache", default=False) or not kwargs.get('cache', True):
|
||||
if not config.getSetting("tmdb_cache", default=False) or not kwargs.get('cache', True):
|
||||
logger.debug('no cache')
|
||||
result = fn(*args)
|
||||
else:
|
||||
@@ -168,7 +168,7 @@ def set_infoLabels(source, seekTmdb=True, search_language=def_lang, forced=False
|
||||
@rtype: int, list
|
||||
"""
|
||||
|
||||
if not config.get_setting('tmdb_active') and not forced:
|
||||
if not config.getSetting('tmdb_active') and not forced:
|
||||
return
|
||||
|
||||
start_time = time.time()
|
||||
@@ -199,7 +199,7 @@ def set_infoLabels_itemlist(itemlist, seekTmdb=False, search_language=def_lang,
|
||||
@rtype: list
|
||||
"""
|
||||
|
||||
if not config.get_setting('tmdb_active') and not forced:
|
||||
if not config.getSetting('tmdb_active') and not forced:
|
||||
return
|
||||
|
||||
r_list = list()
|
||||
@@ -406,7 +406,7 @@ def set_infoLabels_item(item, seekTmdb=True, search_language=def_lang):
|
||||
otmdb = Tmdb(searched_text=searched_title, search_type=search_type, search_language=search_language,
|
||||
filtro=item.infoLabels.get('filtro', {}), year=item.infoLabels['year'])
|
||||
if otmdb is not None:
|
||||
if otmdb.get_id() and config.get_setting("tmdb_plus_info", default=False):
|
||||
if otmdb.get_id() and config.getSetting("tmdb_plus_info", default=False):
|
||||
# If the search has been successful and you are not looking for a list of items,
|
||||
# carry out another search to expand the information
|
||||
if search_type == 'multi':
|
||||
@@ -457,11 +457,11 @@ def find_and_set_infoLabels(item):
|
||||
|
||||
if item.contentType == "movie":
|
||||
search_type = "movie"
|
||||
content_type = config.get_localized_string(60247)
|
||||
content_type = config.getLocalizedString(60247)
|
||||
title = item.contentTitle
|
||||
else:
|
||||
search_type = "tv"
|
||||
content_type = config.get_localized_string(60298)
|
||||
content_type = config.getLocalizedString(60298)
|
||||
title = item.contentSerieName
|
||||
|
||||
# If the title includes the (year) we will remove it
|
||||
@@ -483,7 +483,7 @@ def find_and_set_infoLabels(item):
|
||||
# select tmdb_id at the first position
|
||||
if item.infoLabels['selected_tmdb_id']:
|
||||
results.insert(0, results.pop([r.get('id') for r in results].index(int(item.infoLabels['selected_tmdb_id']))))
|
||||
tmdb_result = platformtools.show_video_info(results, item=item, caption= content_type % title)
|
||||
tmdb_result = platformtools.showVideoInfo(results, item=item, caption= content_type % title)
|
||||
elif len(results) > 0:
|
||||
tmdb_result = results[0]
|
||||
|
||||
@@ -519,7 +519,7 @@ def get_nfo(item, search_groups=False):
|
||||
|
||||
if search_groups:
|
||||
from platformcode.autorenumber import RENUMBER, GROUP
|
||||
path = filetools.join(config.get_data_path(), "settings_channels", item.channel + "_data.json")
|
||||
path = filetools.join(config.getDataPath(), "settings_channels", item.channel + "_data.json")
|
||||
if filetools.exists(path):
|
||||
g = jsontools.load(filetools.read(path)).get(RENUMBER,{}).get(item.fulltitle.strip(),{}).get(GROUP,'')
|
||||
if g:
|
||||
@@ -577,7 +577,7 @@ def select_group(groups, item):
|
||||
selections.append([group.get('name',''), group.get('group_count',0), group.get('episode_count',0), group.get('description',''), item.thumbnail])
|
||||
ids.append(ID)
|
||||
if selections and ids:
|
||||
selected = platformtools.dialog_select_group(config.get_localized_string(70831), selections)
|
||||
selected = platformtools.dialogSelectGroup(config.getLocalizedString(70831), selections)
|
||||
if selected > -1:
|
||||
return ids[selected]
|
||||
return ''
|
||||
@@ -1040,7 +1040,7 @@ class Tmdb(object):
|
||||
self.result = ResultDictDefault(self.results[index_results])
|
||||
# self.result['mediatype'] = self.result['media_type']
|
||||
|
||||
if not config.get_setting('tmdb_plus_info'):
|
||||
if not config.getSetting('tmdb_plus_info'):
|
||||
self.result = self.get_mpaa(self.result)
|
||||
return len(self.results)
|
||||
|
||||
@@ -1369,7 +1369,7 @@ class Tmdb(object):
|
||||
|
||||
if "status_code" in self.season[seasonNumber]:
|
||||
# An error has occurred
|
||||
msg = config.get_localized_string(70496) + searching + config.get_localized_string(70497)
|
||||
msg = config.getLocalizedString(70496) + searching + config.getLocalizedString(70497)
|
||||
msg += "\nTmdb error: %s %s" % (
|
||||
self.season[seasonNumber]["status_code"], self.season[seasonNumber]["status_message"])
|
||||
logger.debug(msg)
|
||||
|
||||
+40
-40
@@ -15,12 +15,12 @@ else: from concurrent_py2 import futures
|
||||
host = 'https://api.trakt.tv'
|
||||
client_id = '502bd1660b833c1ae69828163c0848e84e9850061e5529f30930e7356cae73b1'
|
||||
client_secret = '1d30d5b24acf223a5e1ab6c61d08b69992d98ed5b0c7e26b052b5e6a592035a4'
|
||||
token_auth = config.get_setting("token_trakt", "trakt")
|
||||
token_auth = config.getSetting("token_trakt", "trakt")
|
||||
|
||||
|
||||
def auth_trakt():
|
||||
item = Item()
|
||||
folder = (config.get_platform() == 'plex')
|
||||
folder = (config.getXBMCPlatform() == 'plex')
|
||||
item.folder = folder
|
||||
# Autentificación de cuenta Trakt
|
||||
headers = {'Content-Type': 'application/json', 'trakt-api-key': client_id, 'trakt-api-version': '2'}
|
||||
@@ -39,11 +39,11 @@ def auth_trakt():
|
||||
|
||||
else:
|
||||
itemlist = []
|
||||
title = config.get_localized_string(60248) % item.verify_url
|
||||
title = config.getLocalizedString(60248) % item.verify_url
|
||||
itemlist.append(item.clone(title=title, action=''))
|
||||
title = config.get_localized_string(60249) % item.user_code
|
||||
title = config.getLocalizedString(60249) % item.user_code
|
||||
itemlist.append(item.clone(title=title, action=''))
|
||||
title = config.get_localized_string(60250)
|
||||
title = config.getLocalizedString(60250)
|
||||
itemlist.append(item.clone(title=title, action='token_trakt'))
|
||||
return itemlist
|
||||
except:
|
||||
@@ -57,7 +57,7 @@ def token_trakt(item):
|
||||
headers = {'Content-Type': 'application/json', 'trakt-api-key': client_id, 'trakt-api-version': '2'}
|
||||
try:
|
||||
if item.extra == 'renew':
|
||||
refresh = config.get_setting('refresh_token_trakt', 'trakt')
|
||||
refresh = config.getSetting('refresh_token_trakt', 'trakt')
|
||||
url = host + '/oauth/device/token'
|
||||
post = {'refresh_token': refresh, 'client_id': client_id, 'client_secret': client_secret,
|
||||
'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'grant_type': 'refresh_token'}
|
||||
@@ -71,17 +71,17 @@ def token_trakt(item):
|
||||
data = jsontools.load(data)
|
||||
else:
|
||||
import time
|
||||
dialog_auth = platformtools.dialog_progress(config.get_localized_string(60251),
|
||||
config.get_localized_string(60252) % item.verify_url + '\n' +
|
||||
config.get_localized_string(60253) % item.user_code + '\n' +
|
||||
config.get_localized_string(60254))
|
||||
dialog_auth = platformtools.dialogProgress(config.getLocalizedString(60251),
|
||||
config.getLocalizedString(60252) % item.verify_url + '\n' +
|
||||
config.getLocalizedString(60253) % item.user_code + '\n' +
|
||||
config.getLocalizedString(60254))
|
||||
|
||||
# Generalmente cada 5 segundos se intenta comprobar si el usuario ha introducido el código
|
||||
while True:
|
||||
time.sleep(item.intervalo)
|
||||
try:
|
||||
if dialog_auth.iscanceled():
|
||||
config.set_setting('trakt_sync', False)
|
||||
config.setSetting('trakt_sync', False)
|
||||
return
|
||||
|
||||
url = host + '/oauth/device/token'
|
||||
@@ -103,10 +103,10 @@ def token_trakt(item):
|
||||
token = data['access_token']
|
||||
refresh = data['refresh_token']
|
||||
|
||||
config.set_setting('token_trakt', token, 'trakt')
|
||||
config.set_setting('refresh_token_trakt', refresh, 'trakt')
|
||||
config.setSetting('token_trakt', token, 'trakt')
|
||||
config.setSetting('refresh_token_trakt', refresh, 'trakt')
|
||||
if not item.folder:
|
||||
platformtools.dialog_notification(config.get_localized_string(60255), config.get_localized_string(60256))
|
||||
platformtools.dialogNotification(config.getLocalizedString(60255), config.getLocalizedString(60256))
|
||||
if config.is_xbmc():
|
||||
import xbmc
|
||||
xbmc.executebuiltin('Container.Refresh')
|
||||
@@ -116,14 +116,14 @@ def token_trakt(item):
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
if not item.folder:
|
||||
return platformtools.dialog_notification(config.get_localized_string(60527), config.get_localized_string(60258))
|
||||
return platformtools.dialogNotification(config.getLocalizedString(60527), config.getLocalizedString(60258))
|
||||
token = ''
|
||||
|
||||
itemlist = []
|
||||
if token:
|
||||
itemlist.append(item.clone(title=config.get_localized_string(60256), action=''))
|
||||
itemlist.append(item.clone(title=config.getLocalizedString(60256), action=''))
|
||||
else:
|
||||
itemlist.append(item.clone(title=config.get_localized_string(60260), action=''))
|
||||
itemlist.append(item.clone(title=config.getLocalizedString(60260), action=''))
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -146,23 +146,23 @@ def get_trakt_watched(id_type, mediatype, update=False):
|
||||
id_list = []
|
||||
id_dict = dict()
|
||||
|
||||
token_auth = config.get_setting('token_trakt', 'trakt')
|
||||
token_auth = config.getSetting('token_trakt', 'trakt')
|
||||
|
||||
if token_auth:
|
||||
sync_path = os.path.join(config.get_data_path(), 'settings_channels', 'trakt')
|
||||
sync_path = os.path.join(config.getDataPath(), 'settings_channels', 'trakt')
|
||||
|
||||
if os.path.exists(sync_path) and not update:
|
||||
trakt_node = jsontools.get_node_from_file('trakt', 'TRAKT')
|
||||
trakt_node = jsontools.getNodeFromFile('trakt', 'TRAKT')
|
||||
if mediatype == 'shows':
|
||||
return trakt_node['shows']
|
||||
if mediatype == 'movies':
|
||||
return trakt_node['movies']
|
||||
|
||||
else:
|
||||
token_auth = config.get_setting('token_trakt', 'trakt')
|
||||
token_auth = config.getSetting('token_trakt', 'trakt')
|
||||
if token_auth:
|
||||
try:
|
||||
token_auth = config.get_setting('token_trakt', 'trakt')
|
||||
token_auth = config.getSetting('token_trakt', 'trakt')
|
||||
headers = [['Content-Type', 'application/json'], ['trakt-api-key', client_id],
|
||||
['trakt-api-version', '2']]
|
||||
if token_auth:
|
||||
@@ -232,24 +232,24 @@ def trakt_check(itemlist):
|
||||
|
||||
def get_sync_from_file():
|
||||
logger.debug()
|
||||
sync_path = os.path.join(config.get_data_path(), 'settings_channels', 'trakt_data.json')
|
||||
sync_path = os.path.join(config.getDataPath(), 'settings_channels', 'trakt_data.json')
|
||||
trakt_node = {}
|
||||
if os.path.exists(sync_path):
|
||||
trakt_node = jsontools.get_node_from_file('trakt', 'TRAKT')
|
||||
trakt_node = jsontools.getNodeFromFile('trakt', 'TRAKT')
|
||||
|
||||
trakt_node['movies'] = get_trakt_watched('tmdb', 'movies')
|
||||
trakt_node['shows'] = get_trakt_watched('tmdb', 'shows')
|
||||
jsontools.update_node(trakt_node, 'trakt', 'TRAKT')
|
||||
jsontools.updateNode(trakt_node, 'trakt', 'TRAKT')
|
||||
|
||||
|
||||
def update_trakt_data(mediatype, trakt_data):
|
||||
logger.debug()
|
||||
|
||||
sync_path = os.path.join(config.get_data_path(), 'settings_channels', 'trakt_data.json')
|
||||
sync_path = os.path.join(config.getDataPath(), 'settings_channels', 'trakt_data.json')
|
||||
if os.path.exists(sync_path):
|
||||
trakt_node = jsontools.get_node_from_file('trakt', 'TRAKT')
|
||||
trakt_node = jsontools.getNodeFromFile('trakt', 'TRAKT')
|
||||
trakt_node[mediatype] = trakt_data
|
||||
jsontools.update_node(trakt_node, 'trakt', 'TRAKT')
|
||||
jsontools.updateNode(trakt_node, 'trakt', 'TRAKT')
|
||||
|
||||
|
||||
def ask_install_script():
|
||||
@@ -257,12 +257,12 @@ def ask_install_script():
|
||||
|
||||
from platformcode import platformtools
|
||||
|
||||
respuesta = platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(70521))
|
||||
respuesta = platformtools.dialogYesNo(config.getLocalizedString(20000), config.getLocalizedString(70521))
|
||||
if respuesta:
|
||||
xbmc.executebuiltin('InstallAddon(script.trakt)')
|
||||
return
|
||||
else:
|
||||
config.set_setting('install_trakt', False)
|
||||
config.setSetting('install_trakt', False)
|
||||
return
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ def update_all():
|
||||
def context(item):
|
||||
Type = item.contentType.replace("tv", "") + "s"
|
||||
item.action = 'traktResults'
|
||||
title = config.get_localized_string(30122 if item.contentType == 'movie' else 30123)
|
||||
title = config.getLocalizedString(30122 if item.contentType == 'movie' else 30123)
|
||||
context = []
|
||||
commands = []
|
||||
condition = "'tmdb': " + item.infoLabels["tmdb_id"]
|
||||
@@ -296,10 +296,10 @@ def context(item):
|
||||
result = execute(item.clone(url="/sync/watched/" + Type))
|
||||
post = {Type: [{"ids": {"tmdb": item.infoLabels["tmdb_id"]}}]}
|
||||
if condition in str(result):
|
||||
context.append(config.get_localized_string(60016 if item.contentType == 'movie' else 60020))
|
||||
context.append(config.getLocalizedString(60016 if item.contentType == 'movie' else 60020))
|
||||
commands.append(item.clone(url="/sync/history/remove", post=post))
|
||||
else:
|
||||
context.append(config.get_localized_string(60017 if item.contentType == 'movie' else 60021))
|
||||
context.append(config.getLocalizedString(60017 if item.contentType == 'movie' else 60021))
|
||||
commands.append(item.clone(url="/sync/history", post=post))
|
||||
except:
|
||||
pass
|
||||
@@ -308,10 +308,10 @@ def context(item):
|
||||
result = execute(item.clone(url="/sync/watchlist/" + Type))
|
||||
post = {Type: [{"ids": {"tmdb": item.infoLabels["tmdb_id"]}}]}
|
||||
if condition in str(result):
|
||||
context.append(config.get_localized_string(70343) % title)
|
||||
context.append(config.getLocalizedString(70343) % title)
|
||||
commands.append(item.clone(url="/sync/watchlist/remove", post=post))
|
||||
else:
|
||||
context.append(config.get_localized_string(70344) % title)
|
||||
context.append(config.getLocalizedString(70344) % title)
|
||||
commands.append(item.clone(url="/sync/watchlist", post=post))
|
||||
except:
|
||||
pass
|
||||
@@ -320,10 +320,10 @@ def context(item):
|
||||
result = execute(item.clone(url="/sync/collection/" + Type))
|
||||
post = {Type: [{"ids": {"tmdb": item.infoLabels["tmdb_id"]}}]}
|
||||
if condition in str(result):
|
||||
context.append(config.get_localized_string(70345) % title)
|
||||
context.append(config.getLocalizedString(70345) % title)
|
||||
commands.append(item.clone(url="/sync/collection/remove", post=post))
|
||||
else:
|
||||
context.append(config.get_localized_string(70346) % title)
|
||||
context.append(config.getLocalizedString(70346) % title)
|
||||
commands.append(item.clone(url="/sync/collection", post=post))
|
||||
except:
|
||||
pass
|
||||
@@ -335,7 +335,7 @@ def context(item):
|
||||
execute(commands[index])
|
||||
|
||||
def execute(item):
|
||||
from platformcode.platformtools import dialog_notification
|
||||
from platformcode.platformtools import dialogNotification
|
||||
url = host + item.url
|
||||
|
||||
headers = [['Content-Type', 'application/json'], ['trakt-api-key', client_id], ['trakt-api-version', '2']]
|
||||
@@ -349,5 +349,5 @@ def execute(item):
|
||||
if not post:
|
||||
return data
|
||||
else:
|
||||
if 'not_found' in data: return dialog_notification('Trakt', config.get_localized_string(70347))
|
||||
else: return dialog_notification('Trakt', config.get_localized_string(70348))
|
||||
if 'not_found' in data: return dialogNotification('Trakt', config.getLocalizedString(70347))
|
||||
else: return dialogNotification('Trakt', config.getLocalizedString(70348))
|
||||
+17
-17
@@ -27,9 +27,9 @@ from platformcode import platformtools
|
||||
HOST = "https://api.thetvdb.com"
|
||||
HOST_IMAGE = "http://thetvdb.com/banners/"
|
||||
|
||||
TOKEN = config.get_setting("tvdb_token", default="")
|
||||
TOKEN = config.getSetting("tvdb_token", default="")
|
||||
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
|
||||
DEFAULT_LANG = info_language[config.get_setting("info_language", "videolibrary")]
|
||||
DEFAULT_LANG = info_language[config.getSetting("info_language", "videolibrary")]
|
||||
DEFAULT_HEADERS = {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json, application/vnd.thetvdb.v2.1.1',
|
||||
@@ -82,7 +82,7 @@ def find_and_set_infoLabels(item):
|
||||
|
||||
p_dialog = None
|
||||
if not item.contentSeason:
|
||||
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(60296), config.get_localized_string(60293))
|
||||
p_dialog = platformtools.dialogProgressBg(config.getLocalizedString(60296), config.getLocalizedString(60293))
|
||||
|
||||
global otvdb_global
|
||||
tvdb_result = None
|
||||
@@ -106,24 +106,24 @@ def find_and_set_infoLabels(item):
|
||||
otvdb_global = Tvdb(tvdb_id=item.infoLabels['tvdb_id'])
|
||||
|
||||
if not item.contentSeason:
|
||||
p_dialog.update(50, config.get_localized_string(60296) + '\n' + config.get_localized_string(60295))
|
||||
p_dialog.update(50, config.getLocalizedString(60296) + '\n' + config.getLocalizedString(60295))
|
||||
results, info_load = otvdb_global.get_list_results()
|
||||
logger.debug("results: %s" % results)
|
||||
|
||||
if not item.contentSeason:
|
||||
p_dialog.update(100, config.get_localized_string(60296) + '\n' + config.get_localized_string(60297) % len(results))
|
||||
p_dialog.update(100, config.getLocalizedString(60296) + '\n' + config.getLocalizedString(60297) % len(results))
|
||||
p_dialog.close()
|
||||
|
||||
if len(results) > 1:
|
||||
tvdb_result = platformtools.show_video_info(results, item=item, scraper=Tvdb, caption=config.get_localized_string(60298) % title)
|
||||
tvdb_result = platformtools.showVideoInfo(results, item=item, scraper=Tvdb, caption=config.getLocalizedString(60298) % title)
|
||||
# if not tvdb_result:
|
||||
# res = platformtools.dialog_info(item, 'tvdb')
|
||||
# res = platformtools.dialogInfo(item, 'tvdb')
|
||||
# if not res.exit: return find_and_set_infoLabels(res)
|
||||
elif len(results) > 0:
|
||||
tvdb_result = results[0]
|
||||
|
||||
# else:
|
||||
# res = platformtools.dialog_info(item, 'tvdb')
|
||||
# res = platformtools.dialogInfo(item, 'tvdb')
|
||||
# if not res.exit: return find_and_set_infoLabels(res)
|
||||
|
||||
# todo revisar
|
||||
@@ -355,18 +355,18 @@ class Tvdb(object):
|
||||
if kwargs.get('tvdb_id', ''):
|
||||
# Search by tvdb identifier
|
||||
self.__get_by_id(kwargs.get('tvdb_id', ''))
|
||||
if not self.list_results and config.get_setting("tvdb_retry_eng", "videolibrary"):
|
||||
if not self.list_results and config.getSetting("tvdb_retry_eng", "videolibrary"):
|
||||
from platformcode import platformtools
|
||||
platformtools.dialog_notification(config.get_localized_string(60299) % DEFAULT_LANG, config.get_localized_string(60302), sound=False)
|
||||
platformtools.dialogNotification(config.getLocalizedString(60299) % DEFAULT_LANG, config.getLocalizedString(60302), sound=False)
|
||||
self.__get_by_id(kwargs.get('tvdb_id', ''), "en")
|
||||
self.lang = "en"
|
||||
|
||||
elif self.search_name:
|
||||
# BUsqueda by text
|
||||
self.__search(kwargs.get('search', ''), kwargs.get('imdb_id', ''), kwargs.get('zap2it_id', ''))
|
||||
if not self.list_results and config.get_setting("tvdb_retry_eng", "videolibrary"):
|
||||
if not self.list_results and config.getSetting("tvdb_retry_eng", "videolibrary"):
|
||||
from platformcode import platformtools
|
||||
platformtools.dialog_notification(config.get_localized_string(60299) % DEFAULT_LANG, config.get_localized_string(60302))
|
||||
platformtools.dialogNotification(config.getLocalizedString(60299) % DEFAULT_LANG, config.getLocalizedString(60302))
|
||||
self.__search(kwargs.get('search', ''), kwargs.get('imdb_id', ''), kwargs.get('zap2it_id', ''), "en")
|
||||
self.lang = "en"
|
||||
|
||||
@@ -376,7 +376,7 @@ class Tvdb(object):
|
||||
buscando = kwargs.get('tvdb_id', '')
|
||||
else:
|
||||
buscando = kwargs.get('search', '')
|
||||
msg = config.get_localized_string(70266) % buscando
|
||||
msg = config.getLocalizedString(70266) % buscando
|
||||
logger.debug(msg)
|
||||
|
||||
@classmethod
|
||||
@@ -389,10 +389,10 @@ class Tvdb(object):
|
||||
from time import gmtime, strftime
|
||||
current_date = strftime("%Y-%m-%d", gmtime())
|
||||
|
||||
if config.get_setting("tvdb_token_date", "") != current_date:
|
||||
if config.getSetting("tvdb_token_date", "") != current_date:
|
||||
# if the token has been renewed we save the new date
|
||||
if cls.__refresh_token():
|
||||
config.set_setting("tvdb_token_date", current_date)
|
||||
config.setSetting("tvdb_token_date", current_date)
|
||||
|
||||
@staticmethod
|
||||
def __login():
|
||||
@@ -418,7 +418,7 @@ class Tvdb(object):
|
||||
token = dict_html["token"]
|
||||
DEFAULT_HEADERS["Authorization"] = "Bearer " + token
|
||||
|
||||
TOKEN = config.set_setting("tvdb_token", token)
|
||||
TOKEN = config.setSetting("tvdb_token", token)
|
||||
|
||||
@classmethod
|
||||
def __refresh_token(cls):
|
||||
@@ -449,7 +449,7 @@ class Tvdb(object):
|
||||
if "token" in dict_html:
|
||||
token = dict_html["token"]
|
||||
DEFAULT_HEADERS["Authorization"] = "Bearer " + token
|
||||
TOKEN = config.set_setting("tvdb_token", token)
|
||||
TOKEN = config.setSetting("tvdb_token", token)
|
||||
is_success = True
|
||||
else:
|
||||
cls.__login()
|
||||
|
||||
+46
-46
@@ -19,14 +19,14 @@ from platformcode import config, dbconverter, logger, platformtools
|
||||
from platformcode.autorenumber import RENUMBER
|
||||
from core import videolibrarydb
|
||||
|
||||
FOLDER_MOVIES = config.get_setting("folder_movies")
|
||||
FOLDER_TVSHOWS = config.get_setting("folder_tvshows")
|
||||
VIDEOLIBRARY_PATH = config.get_videolibrary_path()
|
||||
FOLDER_MOVIES = config.getSetting("folder_movies")
|
||||
FOLDER_TVSHOWS = config.getSetting("folder_tvshows")
|
||||
VIDEOLIBRARY_PATH = config.getVideolibraryPath()
|
||||
MOVIES_PATH = filetools.join(VIDEOLIBRARY_PATH, FOLDER_MOVIES)
|
||||
TVSHOWS_PATH = filetools.join(VIDEOLIBRARY_PATH, FOLDER_TVSHOWS)
|
||||
|
||||
if not FOLDER_MOVIES or not FOLDER_TVSHOWS or not VIDEOLIBRARY_PATH or not filetools.exists(MOVIES_PATH) or not filetools.exists(TVSHOWS_PATH):
|
||||
config.verify_directories_created()
|
||||
config.verifyDirectoriesCreated()
|
||||
|
||||
addon_name = "plugin://plugin.video.%s/" % config.PLUGIN_NAME
|
||||
|
||||
@@ -92,7 +92,7 @@ def save_movie(item, silent=False):
|
||||
return 0, 0, -1, path
|
||||
|
||||
# progress dialog
|
||||
if not silent: p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60062))
|
||||
if not silent: p_dialog = platformtools.dialogProgressBg(config.getLocalizedString(20000), config.getLocalizedString(60062))
|
||||
|
||||
base_name = set_base_name(item, _id)
|
||||
path = filetools.join(MOVIES_PATH, base_name)
|
||||
@@ -121,7 +121,7 @@ def save_movie(item, silent=False):
|
||||
|
||||
# get extra info from fanart tv
|
||||
# logger.dbg()
|
||||
extra_info = get_fanart_tv(item)
|
||||
extra_info = getFanart_tv(item)
|
||||
if not item.infoLabels.get('posters', []): item.infoLabels['posters'] = []
|
||||
item.infoLabels['posters'] += extra_info['poster']
|
||||
if not item.infoLabels.get('fanarts', []): item.infoLabels['fanarts'] = []
|
||||
@@ -204,7 +204,7 @@ def save_movie(item, silent=False):
|
||||
if not item.contentLanguage in movie_item.lang_list: movie_item.lang_list.append(item.contentLanguage)
|
||||
|
||||
if len(movie_item.lang_list) > 1:
|
||||
movie_item.prefered_lang = movie_item.lang_list[platformtools.dialog_select(config.get_localized_string(70246), movie_item.lang_list)]
|
||||
movie_item.prefered_lang = movie_item.lang_list[platformtools.dialogSelect(config.getLocalizedString(70246), movie_item.lang_list)]
|
||||
else:
|
||||
movie_item.prefered_lang = movie_item.lang_list[0]
|
||||
|
||||
@@ -216,7 +216,7 @@ def save_movie(item, silent=False):
|
||||
# create strm file if it does not exist
|
||||
if not strm_exists and not local_files:
|
||||
logger.debug("Creating .strm: " + strm_path)
|
||||
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=movie_item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=movie_item.videolibrary_id)
|
||||
item_strm = Item(channel='videolibrary', action='playFromLibrary', strm_path=movie_item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=movie_item.videolibrary_id)
|
||||
strm_exists = filetools.write(filetools.join(MOVIES_PATH, movie_item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
||||
|
||||
# checks if the content already exists
|
||||
@@ -260,11 +260,11 @@ def save_movie(item, silent=False):
|
||||
if not silent:
|
||||
p_dialog.update(100, item.contentTitle)
|
||||
p_dialog.close()
|
||||
if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not item.not_add:
|
||||
if config.is_xbmc() and config.getSetting("videolibrary_kodi") and not item.not_add:
|
||||
# Update Kodi Library
|
||||
from platformcode.dbconverter import add_video
|
||||
add_video(movie_item)
|
||||
# if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not silent and inserted:
|
||||
# if config.is_xbmc() and config.getSetting("videolibrary_kodi") and not silent and inserted:
|
||||
# from platformcode.xbmc_videolibrary import update
|
||||
# update(MOVIES_PATH)
|
||||
return inserted, overwritten, failed, path
|
||||
@@ -357,7 +357,7 @@ def save_tvshow(item, episodelist, silent=False):
|
||||
head_nfo = scraper.get_nfo(item)
|
||||
if not head_nfo: return 0, 0, -1, ''
|
||||
|
||||
extra_info = get_fanart_tv(item)
|
||||
extra_info = getFanart_tv(item)
|
||||
if not item.infoLabels.get('posters'):item.infoLabels['posters'] = []
|
||||
item.infoLabels['posters'] += extra_info['poster'].get('all',[])
|
||||
if not item.infoLabels.get('fanarts'): item.infoLabels['fanarts'] = []
|
||||
@@ -425,7 +425,7 @@ def save_tvshow(item, episodelist, silent=False):
|
||||
logger.debug()
|
||||
inserted, overwritten, failed = save_episodes(tvshow_item, episodelist, extra_info, item.host, local_files, silent=silent)
|
||||
videolibrarydb.close()
|
||||
if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not item.not_add:
|
||||
if config.is_xbmc() and config.getSetting("videolibrary_kodi") and not item.not_add:
|
||||
from platformcode.dbconverter import add_video
|
||||
add_video(tvshow_item)
|
||||
|
||||
@@ -528,11 +528,11 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
|
||||
# if not filetools.exists(filetools.join(TVSHOWS_PATH, strm_path)):
|
||||
if season_episode not in local_files.get('db',{}).keys():
|
||||
logger.debug("Creating .strm: " + episode_item.strm_path)
|
||||
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=episode_item.strm_path, contentType='episode', videolibrary_id=episode_item.videolibrary_id, contentSeason = episode_item.contentSeason, contentEpisodeNumber = episode_item.contentEpisodeNumber,)
|
||||
item_strm = Item(channel='videolibrary', action='playFromLibrary', strm_path=episode_item.strm_path, contentType='episode', videolibrary_id=episode_item.videolibrary_id, contentSeason = episode_item.contentSeason, contentEpisodeNumber = episode_item.contentEpisodeNumber,)
|
||||
filetools.write(filetools.join(TVSHOWS_PATH, episode_item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
||||
|
||||
# update db if episode added
|
||||
# if failed == 0 and config.get_setting('kod_scraper'):
|
||||
# if failed == 0 and config.getSetting('kod_scraper'):
|
||||
# add_video(episode_item)
|
||||
|
||||
return item, episode, season_episode, e.contentLanguage, inserted, overwritten, failed
|
||||
@@ -585,7 +585,7 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
|
||||
# Silent is to show no progress (for service)
|
||||
if not silent:
|
||||
# progress dialog
|
||||
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(60064) ,'')
|
||||
p_dialog = platformtools.dialogProgressBg(config.getLocalizedString(60064) ,'')
|
||||
|
||||
inserted = 0
|
||||
overwritten = 0
|
||||
@@ -650,14 +650,14 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
|
||||
seasons[s] = season_item
|
||||
|
||||
# Add to Kodi DB if Kod is set to add information
|
||||
# if config.get_setting('kod_scraper'):
|
||||
# if config.getSetting('kod_scraper'):
|
||||
# add_video(season_item)
|
||||
|
||||
|
||||
if not silent:
|
||||
# update tvshow info if forced
|
||||
if len(item.lang_list) > 1:
|
||||
item.prefered_lang = item.lang_list[platformtools.dialog_select(config.get_localized_string(70246), item.lang_list)]
|
||||
item.prefered_lang = item.lang_list[platformtools.dialogSelect(config.getLocalizedString(70246), item.lang_list)]
|
||||
else:
|
||||
item.prefered_lang = item.lang_list[0]
|
||||
|
||||
@@ -684,7 +684,7 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
|
||||
# return add_movie(item)
|
||||
# else:
|
||||
# videolibrarydb.close()
|
||||
# platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(70838) % item.contentTitle)
|
||||
# platformtools.dialogOk(config.getLocalizedString(30131), config.getLocalizedString(70838) % item.contentTitle)
|
||||
|
||||
|
||||
def add_to_videolibrary(item, channel):
|
||||
@@ -733,10 +733,10 @@ def add_movie(item):
|
||||
inserted, overwritten, failed, path = save_movie(new_item)
|
||||
|
||||
if failed == 0:
|
||||
platformtools.dialog_notification(config.get_localized_string(30131), config.get_localized_string(30135) % new_item.contentTitle) # 'has been added to the video library'
|
||||
platformtools.dialogNotification(config.getLocalizedString(30131), config.getLocalizedString(30135) % new_item.contentTitle) # 'has been added to the video library'
|
||||
else:
|
||||
filetools.rmdirtree(path)
|
||||
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60066) % new_item.contentTitle) # "ERROR, the movie has NOT been added to the video library")
|
||||
platformtools.dialogOk(config.getLocalizedString(30131), config.getLocalizedString(60066) % new_item.contentTitle) # "ERROR, the movie has NOT been added to the video library")
|
||||
movies = videolibrarydb['movie']
|
||||
_id = get_id(item)
|
||||
if _id in list(movies.keys()):
|
||||
@@ -782,7 +782,7 @@ def add_tvshow(item, channel=None, itemlist=[]):
|
||||
item.__dict__["channel"] = item.__dict__.pop("from_channel")
|
||||
|
||||
if not channel:
|
||||
channel = platformtools.channel_import(item.channel)
|
||||
channel = platformtools.channelImport(item.channel)
|
||||
|
||||
# To disambiguate titles, TMDB is caused to ask for the really desired title
|
||||
# The user can select the title among those offered on the first screen
|
||||
@@ -825,29 +825,29 @@ def add_tvshow(item, channel=None, itemlist=[]):
|
||||
|
||||
elif not inserted and not overwritten and not failed:
|
||||
filetools.rmdirtree(path)
|
||||
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60067) % item.contentTitle)
|
||||
platformtools.dialogOk(config.getLocalizedString(30131), config.getLocalizedString(60067) % item.contentTitle)
|
||||
logger.error("The string %s could not be added to the video library. Could not get any episode" % item.contentTitle)
|
||||
|
||||
elif failed == -1:
|
||||
filetools.rmdirtree(path)
|
||||
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60068) % item.contentTitle)
|
||||
platformtools.dialogOk(config.getLocalizedString(30131), config.getLocalizedString(60068) % item.contentTitle)
|
||||
logger.error("The string %s could not be added to the video library" % item.contentTitle)
|
||||
|
||||
elif failed == -2:
|
||||
filetools.rmdirtree(path)
|
||||
|
||||
elif failed > 0:
|
||||
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60069) % item.contentTitle)
|
||||
platformtools.dialogOk(config.getLocalizedString(30131), config.getLocalizedString(60069) % item.contentTitle)
|
||||
logger.error("Could not add %s episodes of series %s to the video library" % (failed, item.contentTitle))
|
||||
|
||||
else:
|
||||
platformtools.dialog_notification(config.get_localized_string(30131), config.get_localized_string(60070) % item.contentTitle)
|
||||
platformtools.dialogNotification(config.getLocalizedString(30131), config.getLocalizedString(60070) % item.contentTitle)
|
||||
logger.debug("%s episodes of series %s have been added to the video library" % (inserted, item.contentTitle))
|
||||
if config.is_xbmc():
|
||||
if config.get_setting("sync_trakt_new_tvshow", "videolibrary"):
|
||||
if config.getSetting("sync_trakt_new_tvshow", "videolibrary"):
|
||||
import xbmc
|
||||
from platformcode import xbmc_videolibrary
|
||||
if config.get_setting("sync_trakt_new_tvshow_wait", "videolibrary"):
|
||||
if config.getSetting("sync_trakt_new_tvshow_wait", "videolibrary"):
|
||||
# Check that you are not looking for content in the Kodi video library
|
||||
while xbmc.getCondVisibility('Library.IsScanningVideo()'):
|
||||
xbmc.sleep(1000)
|
||||
@@ -868,7 +868,7 @@ def get_id(item):
|
||||
return item.infoLabels.get('tmdb_id')
|
||||
|
||||
|
||||
def get_fanart_tv(item, set='', ret={}):
|
||||
def getFanart_tv(item, set='', ret={}):
|
||||
def set_dict(l):
|
||||
d = {}
|
||||
for k in l:
|
||||
@@ -906,7 +906,7 @@ def get_fanart_tv(item, set='', ret={}):
|
||||
ret[set + 'disc'] = [k.get('url') for k in res.get('moviedisc', [])]
|
||||
if item.infoLabels.get('setid'):
|
||||
it = item.clone(infoLabels = {'tmdb_id':item.infoLabels['setid']})
|
||||
get_fanart_tv(it, 'set', ret)
|
||||
getFanart_tv(it, 'set', ret)
|
||||
|
||||
return ret
|
||||
|
||||
@@ -958,9 +958,9 @@ def get_local_files(path, item):
|
||||
|
||||
|
||||
def select_local_path(item):
|
||||
if not item.local_episodes_path and config.get_setting('local_episodes'):
|
||||
if platformtools.dialog_yesno(config.get_localized_string(30131), config.get_localized_string(80044) % item.title):
|
||||
local_episodes_path = platformtools.dialog_browse(0, config.get_localized_string(80046))
|
||||
if not item.local_episodes_path and config.getSetting('local_episodes'):
|
||||
if platformtools.dialogYesNo(config.getLocalizedString(30131), config.getLocalizedString(80044) % item.title):
|
||||
local_episodes_path = platformtools.dialogBrowse(0, config.getLocalizedString(80046))
|
||||
if local_episodes_path:
|
||||
item.local_episodes_path = local_episodes_path
|
||||
return item
|
||||
@@ -969,7 +969,7 @@ def select_local_path(item):
|
||||
def update_renumber_options(item):
|
||||
from core import jsontools
|
||||
|
||||
filename = filetools.join(config.get_data_path(), "settings_channels", item.channel + '_data.json')
|
||||
filename = filetools.join(config.getDataPath(), "settings_channels", item.channel + '_data.json')
|
||||
if filetools.isfile(filename):
|
||||
json_file = jsontools.load(filetools.read(filename))
|
||||
json = json_file.get(RENUMBER,{}).get(item.fulltitle,{})
|
||||
@@ -982,7 +982,7 @@ def update_renumber_options(item):
|
||||
def add_renumber_options(item):
|
||||
from core import jsontools
|
||||
ret = None
|
||||
filename = filetools.join(config.get_data_path(), "settings_channels", item.channel + '_data.json')
|
||||
filename = filetools.join(config.getDataPath(), "settings_channels", item.channel + '_data.json')
|
||||
json_file = jsontools.load(filetools.read(filename))
|
||||
if item.renumber and not json_file.get(RENUMBER,{}).get(item.fulltitle):
|
||||
check_renumber_options(item)
|
||||
@@ -1046,12 +1046,12 @@ def set_base_name(item, _id):
|
||||
# set base_name for videolibrary
|
||||
logger.debug()
|
||||
if item.contentType == 'movie':
|
||||
if config.get_setting("original_title_folder", "videolibrary") and item.infoLabels['originaltitle']:
|
||||
if config.getSetting("original_title_folder", "videolibrary") and item.infoLabels['originaltitle']:
|
||||
base_name = item.infoLabels['originaltitle']
|
||||
else:
|
||||
base_name = item.contentTitle
|
||||
else:
|
||||
if config.get_setting("original_title_folder", "videolibrary") and item.infoLabels['originaltitle']:
|
||||
if config.getSetting("original_title_folder", "videolibrary") and item.infoLabels['originaltitle']:
|
||||
base_name = item.infoLabels['originaltitle']
|
||||
elif item.infoLabels['tvshowtitle']:
|
||||
base_name = item.infoLabels['tvshowtitle']
|
||||
@@ -1065,7 +1065,7 @@ def set_base_name(item, _id):
|
||||
else:
|
||||
base_name = filetools.validate_path(base_name.replace('/', '-'))
|
||||
|
||||
if config.get_setting("lowerize_title", "videolibrary"):
|
||||
if config.getSetting("lowerize_title", "videolibrary"):
|
||||
base_name = base_name.lower()
|
||||
|
||||
return '{} [{}]'.format(base_name, _id)
|
||||
@@ -1076,7 +1076,7 @@ def restore_videolibrary():
|
||||
tvshows = [x['item'] for x in dict(videolibrarydb['tvshow']).values()]
|
||||
total = len(movies) + len(tvshows)
|
||||
progress = 0
|
||||
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Ripristino videoteca in corso')
|
||||
dialog = platformtools.dialogProgress(config.getLocalizedString(20000), 'Ripristino videoteca in corso')
|
||||
try: os.mkdir(MOVIES_PATH)
|
||||
except: pass
|
||||
try: os.mkdir(TVSHOWS_PATH)
|
||||
@@ -1100,7 +1100,7 @@ def restore_videolibrary():
|
||||
filetools.write(filetools.join(MOVIES_PATH, item.nfo_path), item.head_nfo)
|
||||
|
||||
if not "{}.strm".format(base_name) in movie_files and not local:
|
||||
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=item.videolibrary_id)
|
||||
item_strm = Item(channel='videolibrary', action='playFromLibrary', strm_path=item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=item.videolibrary_id)
|
||||
filetools.write(filetools.join(MOVIES_PATH, item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
||||
|
||||
progress += 1
|
||||
@@ -1131,7 +1131,7 @@ def restore_videolibrary():
|
||||
local = True if 'local' in videolibrarydb['episode'][item.videolibrary_id][season_episode]['channels'] else False
|
||||
if not '{}.strm'.format(season_episode) in episode_files and not local:
|
||||
logger.debug("Creating .strm: " + strm_path)
|
||||
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=strm_path, contentType='episode', videolibrary_id=e.videolibrary_id, contentSeason = e.contentSeason, contentEpisodeNumber = e.contentEpisodeNumber,)
|
||||
item_strm = Item(channel='videolibrary', action='playFromLibrary', strm_path=strm_path, contentType='episode', videolibrary_id=e.videolibrary_id, contentSeason = e.contentSeason, contentEpisodeNumber = e.contentEpisodeNumber,)
|
||||
filetools.write(filetools.join(TVSHOWS_PATH, strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
||||
progress += 1
|
||||
dialog.update(int(progress / total * 100), item.title)
|
||||
@@ -1144,15 +1144,15 @@ def convert_videolibrary():
|
||||
from platformcode import xbmc_videolibrary
|
||||
from core import jsontools
|
||||
|
||||
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Conversione videoteca in corso')
|
||||
dialog = platformtools.dialogProgress(config.getLocalizedString(20000), 'Conversione videoteca in corso')
|
||||
path_to_delete = []
|
||||
film_lst = glob.glob(filetools.join(MOVIES_PATH, '*/*.json'))
|
||||
tvshow_lst = glob.glob((filetools.join(TVSHOWS_PATH, '*/tvshow.nfo')))
|
||||
total = len(film_lst) + len(tvshow_lst)
|
||||
progress = 0
|
||||
|
||||
tvPath = filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'))
|
||||
moviePath = filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_movies'))
|
||||
tvPath = filetools.join(config.getSetting('videolibrarypath'), config.getSetting('folder_tvshows'))
|
||||
moviePath = filetools.join(config.getSetting('videolibrarypath'), config.getSetting('folder_movies'))
|
||||
|
||||
# set local info only
|
||||
xbmc_videolibrary.execute_sql_kodi('update path set strScraper="metadata.local", strSettings="" where strPath = "{}{}"'.format(tvPath, '/' if '/' in tvPath else '\\'))
|
||||
@@ -1170,12 +1170,12 @@ def convert_videolibrary():
|
||||
|
||||
for tvshow in tvshow_lst:
|
||||
if not dialog:
|
||||
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Conversione videoteca in corso')
|
||||
dialog = platformtools.dialogProgress(config.getLocalizedString(20000), 'Conversione videoteca in corso')
|
||||
js = jsontools.load('\n'.join(filetools.read(tvshow).splitlines()[1:]))
|
||||
channels_dict = js.get('library_urls')
|
||||
if channels_dict:
|
||||
for ch, url in channels_dict.items():
|
||||
dir = filetools.listdir(xbmc.translatePath(filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'), js['path'])))
|
||||
dir = filetools.listdir(xbmc.translatePath(filetools.join(config.getSetting('videolibrarypath'), config.getSetting('folder_tvshows'), js['path'])))
|
||||
json_files = [f for f in dir if f.endswith('.json')]
|
||||
if json_files:
|
||||
path_to_delete.append(filetools.dirname(tvshow))
|
||||
@@ -1186,7 +1186,7 @@ def convert_videolibrary():
|
||||
it.url = channels_dict[ch]
|
||||
remove_host(it)
|
||||
tmdb.find_and_set_infoLabels(it)
|
||||
channel = platformtools.channel_import(ch)
|
||||
channel = platformtools.channelImport(ch)
|
||||
it.host = channel.host
|
||||
it.url = channel.host + it.url
|
||||
episodes = getattr(channel, 'episodes')(it)
|
||||
|
||||
+2
-2
@@ -53,13 +53,13 @@ class ziptools(object):
|
||||
try:
|
||||
if filetools.exists(outfilename) and overwrite_question:
|
||||
from platformcode import platformtools
|
||||
dyesno = platformtools.dialog_yesno("File already exists "," File %s to unzip already exists, do you want to overwrite it?" % filetools.basename(outfilename))
|
||||
dyesno = platformtools.dialogYesNo("File already exists "," File %s to unzip already exists, do you want to overwrite it?" % filetools.basename(outfilename))
|
||||
if not dyesno:
|
||||
break
|
||||
if backup:
|
||||
import time
|
||||
hora_folder = "Backup [%s]" % time.strftime("%d-%m_%H-%M", time.localtime())
|
||||
backup = filetools.join(config.get_data_path(), 'backups', hora_folder, folder_to_extract)
|
||||
backup = filetools.join(config.getDataPath(), 'backups', hora_folder, folder_to_extract)
|
||||
if not filetools.exists(backup):
|
||||
filetools.mkdir(backup)
|
||||
filetools.copy(outfilename, filetools.join(backup, filetools.basename(outfilename)))
|
||||
|
||||
Reference in New Issue
Block a user