KoD 1.0
- completato il supporto ai torrent e aggiunto ilcorsaronero.xyz - aggiunto supporto agli episodi locali, ovvero poter inserire nella libreria di kodi un misto tra puntate di kod e file scaricati altrove - le viste ora si salvano di nuovo dal menu laterale, ma rimangono salvate per il tipo di contenuto visualizzato e non per il singolo menu - ripensato il menu rapido, che ora è più rapido, ridisegnate alcune finestre
This commit is contained in:
@@ -189,65 +189,7 @@ def get_all_settings_addon():
|
||||
|
||||
|
||||
def open_settings():
|
||||
settings_pre = get_all_settings_addon()
|
||||
__settings__.openSettings()
|
||||
settings_post = get_all_settings_addon()
|
||||
|
||||
# cb_validate_config (util para validar cambios realizados en el cuadro de dialogo)
|
||||
if settings_post.get('adult_aux_intro_password', None):
|
||||
# Hemos accedido a la seccion de Canales para adultos
|
||||
from platformcode import platformtools
|
||||
if 'adult_password' not in settings_pre:
|
||||
adult_password = set_setting('adult_password', '0000')
|
||||
else:
|
||||
adult_password = settings_pre['adult_password']
|
||||
|
||||
if settings_post['adult_aux_intro_password'] == adult_password:
|
||||
# La contraseña de acceso es correcta
|
||||
|
||||
# Cambio de contraseña
|
||||
if settings_post['adult_aux_new_password1']:
|
||||
if settings_post['adult_aux_new_password1'] == settings_post['adult_aux_new_password2']:
|
||||
set_setting('adult_password', settings_post['adult_aux_new_password1'])
|
||||
else:
|
||||
platformtools.dialog_ok(get_localized_string(60305),
|
||||
get_localized_string(60306),
|
||||
get_localized_string(60307))
|
||||
|
||||
else:
|
||||
platformtools.dialog_ok(get_localized_string(60305), get_localized_string(60309),
|
||||
get_localized_string(60310))
|
||||
|
||||
# Deshacer cambios
|
||||
set_setting("adult_mode", settings_pre.get("adult_mode", 0))
|
||||
set_setting("adult_request_password", settings_pre.get("adult_request_password", True))
|
||||
|
||||
# Borramos settings auxiliares
|
||||
set_setting('adult_aux_intro_password', '')
|
||||
set_setting('adult_aux_new_password1', '')
|
||||
set_setting('adult_aux_new_password2', '')
|
||||
|
||||
from specials import videolibrary
|
||||
from platformcode import xbmc_videolibrary
|
||||
if settings_pre.get('downloadpath', None) != settings_post.get('downloadpath', None):
|
||||
xbmc_videolibrary.update_sources(settings_post.get('downloadpath', None), settings_pre.get('downloadpath', None))
|
||||
|
||||
# si se ha cambiado la ruta de la videoteca llamamos a comprobar directorios para que lo cree y pregunte
|
||||
# automaticamente si configurar la videoteca
|
||||
if settings_pre.get("videolibrarypath", None) != settings_post.get("videolibrarypath", None) or \
|
||||
settings_pre.get("folder_movies", None) != settings_post.get("folder_movies", None) or \
|
||||
settings_pre.get("folder_tvshows", None) != settings_post.get("folder_tvshows", None):
|
||||
videolibrary.move_videolibrary(settings_pre.get("videolibrarypath", None), settings_post.get("videolibrarypath", None),
|
||||
settings_pre.get("folder_movies", None), settings_post.get("folder_movies", None),
|
||||
settings_pre.get("folder_tvshows", None), settings_post.get("folder_tvshows", None))
|
||||
|
||||
# si se ha puesto que se quiere autoconfigurar y se había creado el directorio de la videoteca
|
||||
if not settings_pre.get("videolibrary_kodi", None) and settings_post.get("videolibrary_kodi", None):
|
||||
xbmc_videolibrary.ask_set_content(silent=True)
|
||||
elif settings_pre.get("videolibrary_kodi", None) and not settings_post.get("videolibrary_kodi", None):
|
||||
strm_list = []
|
||||
strm_list.append(get_setting('videolibrarypath'))
|
||||
xbmc_videolibrary.clean(strm_list)
|
||||
|
||||
|
||||
def get_setting(name, channel="", server="", default=None):
|
||||
@@ -310,15 +252,11 @@ def get_setting(name, channel="", server="", default=None):
|
||||
return False
|
||||
else:
|
||||
# special case return as str
|
||||
if name in ["adult_password", "adult_aux_intro_password", "adult_aux_new_password1",
|
||||
"adult_aux_new_password2"]:
|
||||
return value
|
||||
else:
|
||||
try:
|
||||
value = int(value)
|
||||
except ValueError:
|
||||
pass
|
||||
return value
|
||||
try:
|
||||
value = int(value)
|
||||
except ValueError:
|
||||
pass
|
||||
return value
|
||||
|
||||
|
||||
def set_setting(name, value, channel="", server=""):
|
||||
@@ -397,9 +335,9 @@ def get_localized_category(categ):
|
||||
categories = {'movie': get_localized_string(30122), 'tvshow': get_localized_string(30123),
|
||||
'anime': get_localized_string(30124), 'documentary': get_localized_string(30125),
|
||||
'vos': get_localized_string(30136), 'sub-ita': get_localized_string(70566),
|
||||
'adult': get_localized_string(30126), 'direct': get_localized_string(30137),
|
||||
'torrent': get_localized_string(70015), 'live': get_localized_string(30138),
|
||||
'music': get_localized_string(30139) }
|
||||
'direct': get_localized_string(30137), 'torrent': get_localized_string(70015),
|
||||
'live': get_localized_string(30138), 'music': get_localized_string(30139)
|
||||
}
|
||||
return categories[categ] if categ in categories else categ
|
||||
|
||||
|
||||
|
||||
@@ -70,11 +70,11 @@ def init():
|
||||
verify_Kodi_video_DB()
|
||||
|
||||
#LIBTORRENT: se descarga el binario de Libtorrent cada vez que se actualiza Alfa
|
||||
try:
|
||||
threading.Thread(target=update_libtorrent).start() # Creamos un Thread independiente, hasta el fin de Kodi
|
||||
time.sleep(2) # Dejamos terminar la inicialización...
|
||||
except: # Si hay problemas de threading, nos vamos
|
||||
logger.error(traceback.format_exc())
|
||||
# try:
|
||||
# threading.Thread(target=update_libtorrent).start() # Creamos un Thread independiente, hasta el fin de Kodi
|
||||
# time.sleep(2) # Dejamos terminar la inicialización...
|
||||
# except: # Si hay problemas de threading, nos vamos
|
||||
# logger.error(traceback.format_exc())
|
||||
|
||||
# #QUASAR: Preguntamos si se hacen modificaciones a Quasar
|
||||
# if not filetools.exists(filetools.join(config.get_data_path(), "quasar.json")) \
|
||||
@@ -245,102 +245,102 @@ def update_external_addon(addon_name):
|
||||
return False
|
||||
|
||||
|
||||
def update_libtorrent():
|
||||
logger.info()
|
||||
# def update_libtorrent():
|
||||
# logger.info()
|
||||
|
||||
if not config.get_setting("mct_buffer", server="torrent", default=""):
|
||||
default = config.get_setting("torrent_client", server="torrent", default=0)
|
||||
config.set_setting("torrent_client", default, server="torrent")
|
||||
config.set_setting("mct_buffer", "50", server="torrent")
|
||||
if config.get_setting("mct_download_path", server="torrent", default=config.get_setting("downloadpath")):
|
||||
config.set_setting("mct_download_path", config.get_setting("downloadpath"), server="torrent")
|
||||
config.set_setting("mct_background_download", True, server="torrent")
|
||||
config.set_setting("mct_rar_unpack", True, server="torrent")
|
||||
config.set_setting("bt_buffer", "50", server="torrent")
|
||||
if config.get_setting("bt_download_path", server="torrent", default=config.get_setting("downloadpath")):
|
||||
config.set_setting("bt_download_path", config.get_setting("downloadpath"), server="torrent")
|
||||
config.set_setting("mct_download_limit", "", server="torrent")
|
||||
config.set_setting("magnet2torrent", False, server="torrent")
|
||||
# if not config.get_setting("mct_buffer", server="torrent", default=""):
|
||||
# default = config.get_setting("torrent_client", server="torrent", default=0)
|
||||
# config.set_setting("torrent_client", default, server="torrent")
|
||||
# config.set_setting("mct_buffer", "50", server="torrent")
|
||||
# if config.get_setting("mct_download_path", server="torrent", default=config.get_setting("downloadpath")):
|
||||
# config.set_setting("mct_download_path", config.get_setting("downloadpath"), server="torrent")
|
||||
# config.set_setting("mct_background_download", True, server="torrent")
|
||||
# config.set_setting("mct_rar_unpack", True, server="torrent")
|
||||
# config.set_setting("bt_buffer", "50", server="torrent")
|
||||
# if config.get_setting("bt_download_path", server="torrent", default=config.get_setting("downloadpath")):
|
||||
# config.set_setting("bt_download_path", config.get_setting("downloadpath"), server="torrent")
|
||||
# config.set_setting("mct_download_limit", "", server="torrent")
|
||||
# config.set_setting("magnet2torrent", False, server="torrent")
|
||||
|
||||
if not filetools.exists(filetools.join(config.get_runtime_path(), "custom_code.json")) or not \
|
||||
config.get_setting("unrar_path", server="torrent", default=""):
|
||||
# if not filetools.exists(filetools.join(config.get_runtime_path(), "custom_code.json")) or not \
|
||||
# config.get_setting("unrar_path", server="torrent", default=""):
|
||||
|
||||
path = filetools.join(config.get_runtime_path(), 'lib', 'rarfiles')
|
||||
creationflags = ''
|
||||
sufix = ''
|
||||
unrar = ''
|
||||
for device in filetools.listdir(path):
|
||||
if xbmc.getCondVisibility("system.platform.android") and 'android' not in device: continue
|
||||
if xbmc.getCondVisibility("system.platform.windows") and 'windows' not in device: continue
|
||||
if not xbmc.getCondVisibility("system.platform.windows") and not xbmc.getCondVisibility("system.platform.android") \
|
||||
and ('android' in device or 'windows' in device): continue
|
||||
if 'windows' in device:
|
||||
creationflags = 0x08000000
|
||||
sufix = '.exe'
|
||||
else:
|
||||
creationflags = ''
|
||||
sufix = ''
|
||||
unrar = filetools.join(path, device, 'unrar%s') % sufix
|
||||
if not filetools.exists(unrar): unrar = ''
|
||||
if unrar:
|
||||
if not xbmc.getCondVisibility("system.platform.windows"):
|
||||
try:
|
||||
if xbmc.getCondVisibility("system.platform.android"):
|
||||
# Para Android copiamos el binario a la partición del sistema
|
||||
unrar_org = unrar
|
||||
unrar = filetools.join(xbmc.translatePath('special://xbmc/'), 'files').replace('/cache/apk/assets', '')
|
||||
if not filetools.exists(unrar):
|
||||
filetools.mkdir(unrar)
|
||||
unrar = filetools.join(unrar, 'unrar')
|
||||
filetools.copy(unrar_org, unrar, silent=True)
|
||||
# path = filetools.join(config.get_runtime_path(), 'lib', 'rarfiles')
|
||||
# creationflags = ''
|
||||
# sufix = ''
|
||||
# unrar = ''
|
||||
# for device in filetools.listdir(path):
|
||||
# if xbmc.getCondVisibility("system.platform.android") and 'android' not in device: continue
|
||||
# if xbmc.getCondVisibility("system.platform.windows") and 'windows' not in device: continue
|
||||
# if not xbmc.getCondVisibility("system.platform.windows") and not xbmc.getCondVisibility("system.platform.android") \
|
||||
# and ('android' in device or 'windows' in device): continue
|
||||
# if 'windows' in device:
|
||||
# creationflags = 0x08000000
|
||||
# sufix = '.exe'
|
||||
# else:
|
||||
# creationflags = ''
|
||||
# sufix = ''
|
||||
# unrar = filetools.join(path, device, 'unrar%s') % sufix
|
||||
# if not filetools.exists(unrar): unrar = ''
|
||||
# if unrar:
|
||||
# if not xbmc.getCondVisibility("system.platform.windows"):
|
||||
# try:
|
||||
# if xbmc.getCondVisibility("system.platform.android"):
|
||||
# # Para Android copiamos el binario a la partición del sistema
|
||||
# unrar_org = unrar
|
||||
# unrar = filetools.join(xbmc.translatePath('special://xbmc/'), 'files').replace('/cache/apk/assets', '')
|
||||
# if not filetools.exists(unrar):
|
||||
# filetools.mkdir(unrar)
|
||||
# unrar = filetools.join(unrar, 'unrar')
|
||||
# filetools.copy(unrar_org, unrar, silent=True)
|
||||
|
||||
command = ['chmod', '777', '%s' % unrar]
|
||||
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output_cmd, error_cmd = p.communicate()
|
||||
command = ['ls', '-l', unrar]
|
||||
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output_cmd, error_cmd = p.communicate()
|
||||
xbmc.log('######## UnRAR file: %s' % str(output_cmd), xbmc.LOGNOTICE)
|
||||
except:
|
||||
xbmc.log('######## UnRAR ERROR in path: %s' % str(unrar), xbmc.LOGNOTICE)
|
||||
logger.error(traceback.format_exc(1))
|
||||
# command = ['chmod', '777', '%s' % unrar]
|
||||
# p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
# output_cmd, error_cmd = p.communicate()
|
||||
# command = ['ls', '-l', unrar]
|
||||
# p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
# output_cmd, error_cmd = p.communicate()
|
||||
# xbmc.log('######## UnRAR file: %s' % str(output_cmd), xbmc.LOGNOTICE)
|
||||
# except:
|
||||
# xbmc.log('######## UnRAR ERROR in path: %s' % str(unrar), xbmc.LOGNOTICE)
|
||||
# logger.error(traceback.format_exc(1))
|
||||
|
||||
try:
|
||||
if xbmc.getCondVisibility("system.platform.windows"):
|
||||
p = subprocess.Popen(unrar, stdout=subprocess.PIPE, stderr=subprocess.PIPE, creationflags=creationflags)
|
||||
else:
|
||||
p = subprocess.Popen(unrar, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output_cmd, error_cmd = p.communicate()
|
||||
if p.returncode != 0 or error_cmd:
|
||||
xbmc.log('######## UnRAR returncode in module %s: %s, %s in %s' % \
|
||||
(device, str(p.returncode), str(error_cmd), unrar), xbmc.LOGNOTICE)
|
||||
unrar = ''
|
||||
else:
|
||||
xbmc.log('######## UnRAR OK in %s: %s' % (device, unrar), xbmc.LOGNOTICE)
|
||||
break
|
||||
except:
|
||||
xbmc.log('######## UnRAR ERROR in module %s: %s' % (device, unrar), xbmc.LOGNOTICE)
|
||||
logger.error(traceback.format_exc(1))
|
||||
unrar = ''
|
||||
# try:
|
||||
# if xbmc.getCondVisibility("system.platform.windows"):
|
||||
# p = subprocess.Popen(unrar, stdout=subprocess.PIPE, stderr=subprocess.PIPE, creationflags=creationflags)
|
||||
# else:
|
||||
# p = subprocess.Popen(unrar, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
# output_cmd, error_cmd = p.communicate()
|
||||
# if p.returncode != 0 or error_cmd:
|
||||
# xbmc.log('######## UnRAR returncode in module %s: %s, %s in %s' % \
|
||||
# (device, str(p.returncode), str(error_cmd), unrar), xbmc.LOGNOTICE)
|
||||
# unrar = ''
|
||||
# else:
|
||||
# xbmc.log('######## UnRAR OK in %s: %s' % (device, unrar), xbmc.LOGNOTICE)
|
||||
# break
|
||||
# except:
|
||||
# xbmc.log('######## UnRAR ERROR in module %s: %s' % (device, unrar), xbmc.LOGNOTICE)
|
||||
# logger.error(traceback.format_exc(1))
|
||||
# unrar = ''
|
||||
|
||||
if unrar: config.set_setting("unrar_path", unrar, server="torrent")
|
||||
# if unrar: config.set_setting("unrar_path", unrar, server="torrent")
|
||||
|
||||
if filetools.exists(filetools.join(config.get_runtime_path(), "custom_code.json")) and \
|
||||
config.get_setting("libtorrent_path", server="torrent", default="") :
|
||||
return
|
||||
# if filetools.exists(filetools.join(config.get_runtime_path(), "custom_code.json")) and \
|
||||
# config.get_setting("libtorrent_path", server="torrent", default="") :
|
||||
# return
|
||||
|
||||
|
||||
try:
|
||||
from lib.python_libtorrent.python_libtorrent import get_libtorrent
|
||||
except Exception as e:
|
||||
logger.error(traceback.format_exc(1))
|
||||
if not PY3:
|
||||
e = unicode(str(e), "utf8", errors="replace").encode("utf8")
|
||||
config.set_setting("libtorrent_path", "", server="torrent")
|
||||
if not config.get_setting("libtorrent_error", server="torrent", default=''):
|
||||
config.set_setting("libtorrent_error", str(e), server="torrent")
|
||||
# try:
|
||||
# from lib.python_libtorrent.python_libtorrent import get_libtorrent
|
||||
# except Exception as e:
|
||||
# logger.error(traceback.format_exc(1))
|
||||
# if not PY3:
|
||||
# e = unicode(str(e), "utf8", errors="replace").encode("utf8")
|
||||
# config.set_setting("libtorrent_path", "", server="torrent")
|
||||
# if not config.get_setting("libtorrent_error", server="torrent", default=''):
|
||||
# config.set_setting("libtorrent_error", str(e), server="torrent")
|
||||
|
||||
return
|
||||
# return
|
||||
|
||||
|
||||
def verify_Kodi_video_DB():
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# ------------------------------------------------------------
|
||||
|
||||
from __future__ import division
|
||||
# from builtins import str
|
||||
from past.utils import old_div
|
||||
import sys
|
||||
|
||||
@@ -31,8 +30,8 @@ from platformcode import logger, config, platformtools
|
||||
|
||||
def get_environment():
|
||||
"""
|
||||
Devuelve las variables de entorno del OS, de Kodi y de Alfa más habituales,
|
||||
necesarias para el diagnóstico de fallos
|
||||
Returns the most common OS, Kodi and Alpha environment variables,
|
||||
necessary for fault diagnosis
|
||||
"""
|
||||
|
||||
try:
|
||||
@@ -56,9 +55,9 @@ def get_environment():
|
||||
try:
|
||||
for label_a in subprocess.check_output('getprop').split('\n'):
|
||||
if 'build.version.release' in label_a:
|
||||
environment['os_release'] = str(scrapertools.find_single_match(label_a, ':\s*\[(.*?)\]$'))
|
||||
environment['os_release'] = str(scrapertools.find_single_match(label_a, r':\s*\[(.*?)\]$'))
|
||||
if 'product.model' in label_a:
|
||||
environment['prod_model'] = str(scrapertools.find_single_match(label_a, ':\s*\[(.*?)\]$'))
|
||||
environment['prod_model'] = str(scrapertools.find_single_match(label_a, r':\s*\[(.*?)\]$'))
|
||||
except:
|
||||
try:
|
||||
for label_a in filetools.read(os.environ['ANDROID_ROOT'] + '/build.prop').split():
|
||||
@@ -196,87 +195,87 @@ def get_environment():
|
||||
except:
|
||||
environment['videolab_free'] = '?'
|
||||
|
||||
environment['torrent_list'] = []
|
||||
environment['torrentcli_option'] = ''
|
||||
environment['torrent_error'] = ''
|
||||
environment['torrentcli_rar'] = config.get_setting("mct_rar_unpack", server="torrent", default=True)
|
||||
environment['torrentcli_backgr'] = config.get_setting("mct_background_download", server="torrent", default=True)
|
||||
environment['torrentcli_lib_path'] = config.get_setting("libtorrent_path", server="torrent", default="")
|
||||
if environment['torrentcli_lib_path']:
|
||||
lib_path = 'Activo'
|
||||
else:
|
||||
lib_path = 'Inactivo'
|
||||
environment['torrentcli_unrar'] = config.get_setting("unrar_path", server="torrent", default="")
|
||||
if environment['torrentcli_unrar']:
|
||||
if xbmc.getCondVisibility("system.platform.Android"):
|
||||
unrar = 'Android'
|
||||
else:
|
||||
unrar, bin = filetools.split(environment['torrentcli_unrar'])
|
||||
unrar = unrar.replace('\\', '/')
|
||||
if not unrar.endswith('/'):
|
||||
unrar = unrar + '/'
|
||||
unrar = scrapertools.find_single_match(unrar, '\/([^\/]+)\/$').capitalize()
|
||||
else:
|
||||
unrar = 'Inactivo'
|
||||
torrent_id = config.get_setting("torrent_client", server="torrent", default=0)
|
||||
environment['torrentcli_option'] = str(torrent_id)
|
||||
torrent_options = platformtools.torrent_client_installed()
|
||||
if lib_path == 'Activo':
|
||||
torrent_options = ['MCT'] + torrent_options
|
||||
torrent_options = ['BT'] + torrent_options
|
||||
environment['torrent_list'].append({'Torrent_opt': str(torrent_id), 'Libtorrent': lib_path, \
|
||||
'RAR_Auto': str(environment['torrentcli_rar']), \
|
||||
'RAR_backgr': str(environment['torrentcli_backgr']), \
|
||||
'UnRAR': unrar})
|
||||
environment['torrent_error'] = config.get_setting("libtorrent_error", server="torrent", default="")
|
||||
if environment['torrent_error']:
|
||||
environment['torrent_list'].append({'Libtorrent_error': environment['torrent_error']})
|
||||
# environment['torrent_list'] = []
|
||||
# environment['torrentcli_option'] = ''
|
||||
# environment['torrent_error'] = ''
|
||||
# environment['torrentcli_rar'] = config.get_setting("mct_rar_unpack", server="torrent", default=True)
|
||||
# environment['torrentcli_backgr'] = config.get_setting("mct_background_download", server="torrent", default=True)
|
||||
# environment['torrentcli_lib_path'] = config.get_setting("libtorrent_path", server="torrent", default="")
|
||||
# if environment['torrentcli_lib_path']:
|
||||
# lib_path = 'Activo'
|
||||
# else:
|
||||
# lib_path = 'Inactivo'
|
||||
# environment['torrentcli_unrar'] = config.get_setting("unrar_path", server="torrent", default="")
|
||||
# if environment['torrentcli_unrar']:
|
||||
# if xbmc.getCondVisibility("system.platform.Android"):
|
||||
# unrar = 'Android'
|
||||
# else:
|
||||
# unrar, bin = filetools.split(environment['torrentcli_unrar'])
|
||||
# unrar = unrar.replace('\\', '/')
|
||||
# if not unrar.endswith('/'):
|
||||
# unrar = unrar + '/'
|
||||
# unrar = scrapertools.find_single_match(unrar, '\/([^\/]+)\/$').capitalize()
|
||||
# else:
|
||||
# unrar = 'Inactivo'
|
||||
# torrent_id = config.get_setting("torrent_client", server="torrent", default=0)
|
||||
# environment['torrentcli_option'] = str(torrent_id)
|
||||
# torrent_options = platformtools.torrent_client_installed()
|
||||
# if lib_path == 'Activo':
|
||||
# torrent_options = ['MCT'] + torrent_options
|
||||
# torrent_options = ['BT'] + torrent_options
|
||||
# environment['torrent_list'].append({'Torrent_opt': str(torrent_id), 'Libtorrent': lib_path, \
|
||||
# 'RAR_Auto': str(environment['torrentcli_rar']), \
|
||||
# 'RAR_backgr': str(environment['torrentcli_backgr']), \
|
||||
# 'UnRAR': unrar})
|
||||
# environment['torrent_error'] = config.get_setting("libtorrent_error", server="torrent", default="")
|
||||
# if environment['torrent_error']:
|
||||
# environment['torrent_list'].append({'Libtorrent_error': environment['torrent_error']})
|
||||
|
||||
for torrent_option in torrent_options:
|
||||
cliente = dict()
|
||||
cliente['D_load_Path'] = ''
|
||||
cliente['Libre'] = '?'
|
||||
cliente['Plug_in'] = torrent_option.replace('Plugin externo: ', '')
|
||||
if cliente['Plug_in'] == 'BT':
|
||||
cliente['D_load_Path'] = str(config.get_setting("bt_download_path", server="torrent", default=''))
|
||||
if not cliente['D_load_Path']: continue
|
||||
cliente['Buffer'] = str(config.get_setting("bt_buffer", server="torrent", default=50))
|
||||
elif cliente['Plug_in'] == 'MCT':
|
||||
cliente['D_load_Path'] = str(config.get_setting("mct_download_path", server="torrent", default=''))
|
||||
if not cliente['D_load_Path']: continue
|
||||
cliente['Buffer'] = str(config.get_setting("mct_buffer", server="torrent", default=50))
|
||||
elif xbmc.getCondVisibility('System.HasAddon("plugin.video.%s")' % cliente['Plug_in']):
|
||||
__settings__ = xbmcaddon.Addon(id="plugin.video.%s" % cliente['Plug_in'])
|
||||
cliente['Plug_in'] = cliente['Plug_in'].capitalize()
|
||||
if cliente['Plug_in'] == 'Torrenter':
|
||||
cliente['D_load_Path'] = str(xbmc.translatePath(__settings__.getSetting('storage')))
|
||||
if not cliente['D_load_Path']:
|
||||
cliente['D_load_Path'] = str(filetools.join(xbmc.translatePath("special://home/"), \
|
||||
"cache", "xbmcup", "plugin.video.torrenter",
|
||||
"Torrenter"))
|
||||
cliente['Buffer'] = str(__settings__.getSetting('pre_buffer_bytes'))
|
||||
else:
|
||||
cliente['D_load_Path'] = str(xbmc.translatePath(__settings__.getSetting('download_path')))
|
||||
cliente['Buffer'] = str(__settings__.getSetting('buffer_size'))
|
||||
if __settings__.getSetting('download_storage') == '1' and __settings__.getSetting('memory_size'):
|
||||
cliente['Memoria'] = str(__settings__.getSetting('memory_size'))
|
||||
# for torrent_option in torrent_options:
|
||||
# cliente = dict()
|
||||
# cliente['D_load_Path'] = ''
|
||||
# cliente['Libre'] = '?'
|
||||
# cliente['Plug_in'] = torrent_option.replace('Plugin externo: ', '')
|
||||
# if cliente['Plug_in'] == 'BT':
|
||||
# cliente['D_load_Path'] = str(config.get_setting("bt_download_path", server="torrent", default=''))
|
||||
# if not cliente['D_load_Path']: continue
|
||||
# cliente['Buffer'] = str(config.get_setting("bt_buffer", server="torrent", default=50))
|
||||
# elif cliente['Plug_in'] == 'MCT':
|
||||
# cliente['D_load_Path'] = str(config.get_setting("mct_download_path", server="torrent", default=''))
|
||||
# if not cliente['D_load_Path']: continue
|
||||
# cliente['Buffer'] = str(config.get_setting("mct_buffer", server="torrent", default=50))
|
||||
# elif xbmc.getCondVisibility('System.HasAddon("plugin.video.%s")' % cliente['Plug_in']):
|
||||
# __settings__ = xbmcaddon.Addon(id="plugin.video.%s" % cliente['Plug_in'])
|
||||
# cliente['Plug_in'] = cliente['Plug_in'].capitalize()
|
||||
# if cliente['Plug_in'] == 'Torrenter':
|
||||
# cliente['D_load_Path'] = str(xbmc.translatePath(__settings__.getSetting('storage')))
|
||||
# if not cliente['D_load_Path']:
|
||||
# cliente['D_load_Path'] = str(filetools.join(xbmc.translatePath("special://home/"), \
|
||||
# "cache", "xbmcup", "plugin.video.torrenter",
|
||||
# "Torrenter"))
|
||||
# cliente['Buffer'] = str(__settings__.getSetting('pre_buffer_bytes'))
|
||||
# else:
|
||||
# cliente['D_load_Path'] = str(xbmc.translatePath(__settings__.getSetting('download_path')))
|
||||
# cliente['Buffer'] = str(__settings__.getSetting('buffer_size'))
|
||||
# if __settings__.getSetting('download_storage') == '1' and __settings__.getSetting('memory_size'):
|
||||
# cliente['Memoria'] = str(__settings__.getSetting('memory_size'))
|
||||
|
||||
if cliente['D_load_Path']:
|
||||
try:
|
||||
if environment['os_name'].lower() == 'windows':
|
||||
free_bytes = ctypes.c_ulonglong(0)
|
||||
ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(cliente['D_load_Path']),
|
||||
None, None, ctypes.pointer(free_bytes))
|
||||
cliente['Libre'] = str(round(float(free_bytes.value) / \
|
||||
(1024 ** 3), 3)).replace('.', ',')
|
||||
else:
|
||||
disk_space = os.statvfs(cliente['D_load_Path'])
|
||||
if not disk_space.f_frsize: disk_space.f_frsize = disk_space.f_frsize.f_bsize
|
||||
cliente['Libre'] = str(round((float(disk_space.f_bavail) / \
|
||||
(1024 ** 3)) * float(disk_space.f_frsize), 3)).replace('.', ',')
|
||||
except:
|
||||
pass
|
||||
environment['torrent_list'].append(cliente)
|
||||
# if cliente['D_load_Path']:
|
||||
# try:
|
||||
# if environment['os_name'].lower() == 'windows':
|
||||
# free_bytes = ctypes.c_ulonglong(0)
|
||||
# ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(cliente['D_load_Path']),
|
||||
# None, None, ctypes.pointer(free_bytes))
|
||||
# cliente['Libre'] = str(round(float(free_bytes.value) / \
|
||||
# (1024 ** 3), 3)).replace('.', ',')
|
||||
# else:
|
||||
# disk_space = os.statvfs(cliente['D_load_Path'])
|
||||
# if not disk_space.f_frsize: disk_space.f_frsize = disk_space.f_frsize.f_bsize
|
||||
# cliente['Libre'] = str(round((float(disk_space.f_bavail) / \
|
||||
# (1024 ** 3)) * float(disk_space.f_frsize), 3)).replace('.', ',')
|
||||
# except:
|
||||
# pass
|
||||
# environment['torrent_list'].append(cliente)
|
||||
|
||||
environment['proxy_active'] = ''
|
||||
try:
|
||||
@@ -359,16 +358,16 @@ def get_environment():
|
||||
|
||||
|
||||
def list_env(environment={}):
|
||||
sep = '-----------------------------------------------------------'
|
||||
if not environment:
|
||||
environment = get_environment()
|
||||
|
||||
if environment['debug'] == 'False':
|
||||
logger.log_enable(True)
|
||||
|
||||
logger.info('----------------------------------------------')
|
||||
logger.info('Variables de entorno Alfa: ' + environment['addon_version'] +
|
||||
' Debug: ' + environment['debug'])
|
||||
logger.info("----------------------------------------------")
|
||||
logger.info(sep)
|
||||
logger.info('KoD environment variables: ' + environment['addon_version'] + ' Debug: ' + environment['debug'])
|
||||
logger.info(sep)
|
||||
|
||||
logger.info(environment['os_name'] + ' ' + environment['prod_model'] + ' ' +
|
||||
environment['os_release'] + ' ' + environment['machine'] + ' ' +
|
||||
@@ -381,45 +380,45 @@ def list_env(environment={}):
|
||||
logger.info('CPU: ' + environment['cpu_usage'])
|
||||
|
||||
if environment['mem_total'] or environment['mem_free']:
|
||||
logger.info('Memoria: Total: ' + environment['mem_total'] + ' MB / Disp.: ' +
|
||||
environment['mem_free'] + ' MB / Buffers: ' +
|
||||
str(int(environment['kodi_buffer']) * 3) + ' MB / Buffermode: ' +
|
||||
environment['kodi_bmode'] + ' / Readfactor: ' +
|
||||
logger.info('Memory: Total: ' + environment['mem_total'] + ' MB | Disp.: ' +
|
||||
environment['mem_free'] + ' MB | Buffers: ' +
|
||||
str(int(environment['kodi_buffer']) * 3) + ' MB | Buffermode: ' +
|
||||
environment['kodi_bmode'] + ' | Readfactor: ' +
|
||||
environment['kodi_rfactor'])
|
||||
|
||||
logger.info('Userdata: ' + environment['userdata_path'] + ' - Libre: ' +
|
||||
logger.info('Userdata: ' + environment['userdata_path'] + ' - Free: ' +
|
||||
environment['userdata_free'].replace('.', ',') + ' GB')
|
||||
|
||||
logger.info('Videoteca: Series/Epis: ' + environment['videolab_series'] + '/' +
|
||||
logger.info('Videolibrary: Series/Episodes: ' + environment['videolab_series'] + '/' +
|
||||
environment['videolab_episodios'] + ' - Pelis: ' +
|
||||
environment['videolab_pelis'] + ' - Upd: ' +
|
||||
environment['videolab_update'] + ' - Path: ' +
|
||||
environment['videolab_path'] + ' - Libre: ' +
|
||||
environment['videolab_path'] + ' - Free: ' +
|
||||
environment['videolab_free'].replace('.', ',') + ' GB')
|
||||
|
||||
if environment['torrent_list']:
|
||||
for x, cliente in enumerate(environment['torrent_list']):
|
||||
if x == 0:
|
||||
cliente_alt = cliente.copy()
|
||||
del cliente_alt['Torrent_opt']
|
||||
logger.info('Torrent: Opt: %s, %s' % (str(cliente['Torrent_opt']), \
|
||||
str(cliente_alt).replace('{', '').replace('}', '') \
|
||||
.replace("'", '').replace('_', ' ')))
|
||||
elif x == 1 and environment['torrent_error']:
|
||||
logger.info('- ' + str(cliente).replace('{', '').replace('}', '') \
|
||||
.replace("'", '').replace('_', ' '))
|
||||
else:
|
||||
cliente_alt = cliente.copy()
|
||||
del cliente_alt['Plug_in']
|
||||
cliente_alt['Libre'] = cliente_alt['Libre'].replace('.', ',') + ' GB'
|
||||
logger.info('- %s: %s' % (str(cliente['Plug_in']), str(cliente_alt) \
|
||||
.replace('{', '').replace('}', '').replace("'", '') \
|
||||
.replace('\\\\', '\\')))
|
||||
# if environment['torrent_list']:
|
||||
# for x, cliente in enumerate(environment['torrent_list']):
|
||||
# if x == 0:
|
||||
# cliente_alt = cliente.copy()
|
||||
# del cliente_alt['Torrent_opt']
|
||||
# logger.info('Torrent: Opt: %s, %s' % (str(cliente['Torrent_opt']), \
|
||||
# str(cliente_alt).replace('{', '').replace('}', '') \
|
||||
# .replace("'", '').replace('_', ' ')))
|
||||
# elif x == 1 and environment['torrent_error']:
|
||||
# logger.info('- ' + str(cliente).replace('{', '').replace('}', '') \
|
||||
# .replace("'", '').replace('_', ' '))
|
||||
# else:
|
||||
# cliente_alt = cliente.copy()
|
||||
# del cliente_alt['Plug_in']
|
||||
# cliente_alt['Libre'] = cliente_alt['Libre'].replace('.', ',') + ' GB'
|
||||
# logger.info('- %s: %s' % (str(cliente['Plug_in']), str(cliente_alt) \
|
||||
# .replace('{', '').replace('}', '').replace("'", '') \
|
||||
# .replace('\\\\', '\\')))
|
||||
|
||||
logger.info('Proxy: ' + environment['proxy_active'])
|
||||
# logger.info('Proxy: ' + environment['proxy_active'])
|
||||
|
||||
logger.info('TAMAÑO del LOG: ' + environment['log_size'].replace('.', ',') + ' MB')
|
||||
logger.info("----------------------------------------------")
|
||||
logger.info('LOG Size: ' + environment['log_size'].replace('.', ',') + ' MB')
|
||||
logger.info(sep)
|
||||
|
||||
if environment['debug'] == 'False':
|
||||
logger.log_enable(False)
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from builtins import map
|
||||
#from builtins import str
|
||||
import sys
|
||||
import sys, xbmc, xbmcaddon, xbmcgui, base64, json
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
from threading import Timer
|
||||
|
||||
import xbmc
|
||||
import xbmcaddon
|
||||
import xbmcgui
|
||||
|
||||
from channelselector import get_thumb
|
||||
from platformcode import config, logger
|
||||
import channelselector
|
||||
|
||||
|
||||
class KeyListener(xbmcgui.WindowXMLDialog):
|
||||
@@ -66,23 +62,11 @@ def set_key():
|
||||
from platformcode import platformtools
|
||||
import xbmc
|
||||
file_xml = "special://profile/keymaps/kod.xml"
|
||||
data = '<keymap><global><keyboard><key id="%s">' % new_key + 'runplugin(plugin://' \
|
||||
'plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAia2V5bWFwIiwNCiAgICAib3BlbiI6IHRydWUNCn0=)</key></keyboard></global></keymap>'
|
||||
data = '<keymap><global><keyboard><key id="%s">' % new_key + 'runplugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAia2V5bWFwIiwNCiAgICAib3BlbiI6IHRydWUNCn0=)</key></keyboard></global></keymap>'
|
||||
filetools.write(xbmc.translatePath(file_xml), data)
|
||||
platformtools.dialog_notification(config.get_localized_string(70700),config.get_localized_string(70702))
|
||||
|
||||
config.set_setting("shortcut_key", new_key)
|
||||
# file_idioma = filetools.join(config.get_runtime_path(), 'resources', 'language', 'Spanish', 'strings.xml')
|
||||
# data = filetools.read(file_idioma)
|
||||
# value_xml = scrapertools.find_single_match(data, '<string id="31100">([^<]+)<')
|
||||
# if "tecla" in value_xml:
|
||||
# data = data.replace(value_xml, 'Cambiar tecla/botón para abrir la ventana (Guardada: %s)' % new_key)
|
||||
# elif "key" in value_xml:
|
||||
# data = data.replace(value_xml, 'Change key/button to open the window (Saved: %s)' % new_key)
|
||||
# else:
|
||||
# data = data.replace(value_xml,
|
||||
# 'Cambiamento di chiave/pulsante per aprire la finestra (Salvato: %s)' % new_key)
|
||||
# filetools.write(file_idioma, data)
|
||||
|
||||
return
|
||||
|
||||
@@ -98,16 +82,6 @@ def delete_key():
|
||||
config.set_setting("shortcut_key", '')
|
||||
|
||||
|
||||
MAIN_MENU = {
|
||||
"news": {"label": config.get_localized_string(30130), "icon": get_thumb("news.png"), "order": 0},
|
||||
"channels": {"label": config.get_localized_string(30118), "icon": get_thumb("channels.png"), "order": 1},
|
||||
"search": {"label": config.get_localized_string(70082), "icon": get_thumb("search.png"), "order": 2},
|
||||
"favorites": {"label": config.get_localized_string(30102), "icon": get_thumb("favorites.png"), "order": 3},
|
||||
"videolibrary": {"label": config.get_localized_string(30131), "icon": get_thumb("videolibrary.png"), "order": 4},
|
||||
"downloads": {"label": config.get_localized_string(60332), "icon": get_thumb("downloads.png"), "order": 5},
|
||||
"settings": {"label": config.get_localized_string(60333), "icon": get_thumb("setting_0.png"), "order": 6}
|
||||
}
|
||||
|
||||
|
||||
class Main(xbmcgui.WindowXMLDialog):
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -118,61 +92,71 @@ class Main(xbmcgui.WindowXMLDialog):
|
||||
if config.get_platform(True)['num_version'] < 18:
|
||||
self.setCoordinateResolution(2)
|
||||
|
||||
for menuentry in list(MAIN_MENU.keys()):
|
||||
item = xbmcgui.ListItem(MAIN_MENU[menuentry]["label"])
|
||||
item.setProperty("thumb", str(MAIN_MENU[menuentry]["icon"]))
|
||||
item.setProperty("identifier", str(menuentry))
|
||||
item.setProperty("order", str(MAIN_MENU[menuentry]["order"]))
|
||||
self.items.append(item)
|
||||
for menuentry in menu:
|
||||
if not menuentry.channel: menuentry.channel = prevchannel
|
||||
item = xbmcgui.ListItem(menuentry.title)
|
||||
if not submenu and menuentry.channel in ['news', 'channelselector', 'search', 'videolibrary']:
|
||||
item.setProperty('sub', 'Controls/spinUp-Focus.png')
|
||||
if menuentry.title != 'Redirect':
|
||||
for key, value in json.loads(menuentry.tojson()).items():
|
||||
item.setProperty(key, str(value))
|
||||
item.setProperty('run', menuentry.tojson())
|
||||
self.items.append(item)
|
||||
|
||||
self.items.sort(key=lambda it: it.getProperty("order"))
|
||||
self.getControl(32500).addItems(self.items)
|
||||
self.setFocusId(32500)
|
||||
|
||||
def onClick(self, control_id):
|
||||
if control_id == 32500:
|
||||
identifier = self.getControl(32500).getSelectedItem().getProperty("identifier")
|
||||
if identifier == "news":
|
||||
xbmc.executebuiltin('Dialog.Close(all,true)')
|
||||
xbmc.executebuiltin(
|
||||
'ActivateWindow(10025, "plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJuZXdzIg0KfQ==")')
|
||||
elif identifier == "channels":
|
||||
xbmc.executebuiltin('Dialog.Close(all,true)')
|
||||
xbmc.executebuiltin(
|
||||
'ActivateWindow(10025, "plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAiZ2V0Y2hhbm5lbHR5cGVzIiwgDQogICAgImNoYW5uZWwiOiAiY2hhbm5lbHNlbGVjdG9yIg0KfQ==")')
|
||||
elif identifier == "search":
|
||||
xbmc.executebuiltin('Dialog.Close(all,true)')
|
||||
xbmc.executebuiltin(
|
||||
'ActivateWindow(10025, "plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJzZWFyY2giDQp9")')
|
||||
elif identifier == "favorites":
|
||||
xbmc.executebuiltin('Dialog.Close(all,true)')
|
||||
xbmc.executebuiltin(
|
||||
'ActivateWindow(10025, "plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJmYXZvcml0ZXMiDQp9")')
|
||||
elif identifier == "videolibrary":
|
||||
xbmc.executebuiltin('Dialog.Close(all,true)')
|
||||
xbmc.executebuiltin(
|
||||
'ActivateWindow(10025, "plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJ2aWRlb2xpYnJhcnkiDQp9")')
|
||||
elif identifier == "downloads":
|
||||
xbmc.executebuiltin('Dialog.Close(all,true)')
|
||||
xbmc.executebuiltin(
|
||||
'ActivateWindow(10025, "plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJkb3dubG9hZHMiDQp9")')
|
||||
elif identifier == "settings":
|
||||
xbmc.executebuiltin('Dialog.Close(all,true)')
|
||||
xbmc.executebuiltin(
|
||||
'ActivateWindow(10025, "plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJzZXR0aW5nIg0KfQ==")')
|
||||
action = self.getControl(32500).getSelectedItem().getProperty('run')
|
||||
self.close()
|
||||
xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.kod/?' + base64.b64encode(action) + '")')
|
||||
|
||||
|
||||
|
||||
def onAction(self, action):
|
||||
# exit
|
||||
if action.getId() in [xbmcgui.ACTION_PREVIOUS_MENU, xbmcgui.ACTION_NAV_BACK]:
|
||||
# main.close()
|
||||
xbmc.executebuiltin('Dialog.Close(all,true)')
|
||||
self.close()
|
||||
if submenu: open_shortcut_menu()
|
||||
|
||||
if action.getId() == xbmcgui.ACTION_CONTEXT_MENU:
|
||||
config.open_settings()
|
||||
|
||||
focus = self.getFocusId()
|
||||
|
||||
def open_shortcut_menu():
|
||||
if action == 3:
|
||||
if focus == 61:
|
||||
self.setFocusId(32500)
|
||||
elif submenu:
|
||||
self.close()
|
||||
open_shortcut_menu()
|
||||
elif self.getControl(32500).getSelectedItem().getProperty('channel') in ['news', 'channelselector', 'search', 'videolibrary']:
|
||||
channel_name = self.getControl(32500).getSelectedItem().getProperty('channel')
|
||||
if channel_name == 'channelselector':
|
||||
import channelselector
|
||||
self.close()
|
||||
open_shortcut_menu(channelselector.getchanneltypes(), channel_name)
|
||||
else:
|
||||
from core.item import Item
|
||||
channel = __import__('specials.%s' % channel_name, fromlist=["specials.%s" % channel_name])
|
||||
self.close()
|
||||
open_shortcut_menu(channel.mainlist(Item()), channel_name)
|
||||
|
||||
|
||||
|
||||
def open_shortcut_menu(newmenu='', channel=''):
|
||||
xbmc.executebuiltin('Dialog.Close(all,true)')
|
||||
global menu
|
||||
global submenu
|
||||
global prevchannel
|
||||
prevchannel = channel
|
||||
if newmenu:
|
||||
menu = newmenu
|
||||
submenu = True
|
||||
else:
|
||||
menu = channelselector.getmainlist()
|
||||
submenu = False
|
||||
XML = 'ShortCutMenu.xml'
|
||||
if config.get_setting('icon_set') == 'dark':
|
||||
XML = 'Dark' + XML
|
||||
|
||||
@@ -10,13 +10,12 @@ import sys
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
if PY3:
|
||||
import urllib.error as urllib2 # Es muy lento en PY2. En PY3 es nativo
|
||||
else:
|
||||
import urllib2 # Usamos el nativo de PY2 que es más rápido
|
||||
# if PY3:
|
||||
# import urllib.error as urllib2 # Es muy lento en PY2. En PY3 es nativo
|
||||
# else:
|
||||
# import urllib2 # Usamos el nativo de PY2 que es más rápido
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
@@ -163,17 +162,6 @@ def run(item=None):
|
||||
config.get_localized_string(70740) % short)
|
||||
# Action in certain channel specified in "action" and "channel" parameters
|
||||
else:
|
||||
# Entry point for a channel is the "mainlist" action, so here we check parental control
|
||||
if item.action == "mainlist":
|
||||
from core import channeltools
|
||||
#updater.checkforupdates() beta version checking for update, still disabled
|
||||
|
||||
# Parental control
|
||||
# If it is an adult channel, and user has configured pin, asks for it
|
||||
if channeltools.is_adult(item.channel) and config.get_setting("adult_request_password"):
|
||||
tecleado = platformtools.dialog_input("", config.get_localized_string(60334), True)
|
||||
if tecleado is None or tecleado != config.get_setting("adult_password"):
|
||||
return
|
||||
# # Actualiza el canal individual
|
||||
# if (item.action == "mainlist" and item.channel != "channelselector" and
|
||||
# config.get_setting("check_for_channel_updates") == True):
|
||||
@@ -183,16 +171,10 @@ def run(item=None):
|
||||
# Checks if channel exists
|
||||
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")):
|
||||
CHANNELS = 'channels'
|
||||
elif os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', 'porn', item.channel + ".py")):
|
||||
CHANNELS = 'channels.porn'
|
||||
else:
|
||||
CHANNELS = 'specials'
|
||||
|
||||
if CHANNELS != 'channels.porn':
|
||||
channel_file = os.path.join(config.get_runtime_path(), CHANNELS, item.channel + ".py")
|
||||
else:
|
||||
channel_file = os.path.join(config.get_runtime_path(), 'channels', 'porn',
|
||||
item.channel + ".py")
|
||||
channel_file = os.path.join(config.get_runtime_path(), CHANNELS, item.channel + ".py")
|
||||
|
||||
logger.info("channel_file= " + channel_file + ' - ' + CHANNELS + ' - ' + item.channel)
|
||||
|
||||
@@ -329,21 +311,21 @@ def run(item=None):
|
||||
|
||||
platformtools.render_items(itemlist, item)
|
||||
|
||||
except urllib2.URLError as e:
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
# Grab inner and third party errors
|
||||
if hasattr(e, 'reason'):
|
||||
logger.error("Reason for the error, code: %s | Reason: %s" % (str(e.reason[0]), str(e.reason[1])))
|
||||
texto = config.get_localized_string(30050) # "No se puede conectar con el sitio web"
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), texto)
|
||||
|
||||
# Grab server response errors
|
||||
elif hasattr(e, 'code'):
|
||||
logger.error("HTTP error code: %d" % e.code)
|
||||
# "El sitio web no funciona correctamente (error http %d)"
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(30051) % e.code)
|
||||
# except urllib2.URLError as e:
|
||||
# import traceback
|
||||
# logger.error(traceback.format_exc())
|
||||
#
|
||||
# # Grab inner and third party errors
|
||||
# if hasattr(e, 'reason'):
|
||||
# logger.error("Reason for the error, code: %s | Reason: %s" % (str(e.reason[0]), str(e.reason[1])))
|
||||
# texto = config.get_localized_string(30050) # "No se puede conectar con el sitio web"
|
||||
# platformtools.dialog_ok(config.get_localized_string(20000), texto)
|
||||
#
|
||||
# # Grab server response errors
|
||||
# elif hasattr(e, 'code'):
|
||||
# logger.error("HTTP error code: %d" % e.code)
|
||||
# # "El sitio web no funciona correctamente (error http %d)"
|
||||
# platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(30051) % e.code)
|
||||
except WebErrorException as e:
|
||||
import traceback
|
||||
from core import scrapertools
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -283,8 +283,8 @@ def getShaStr(str):
|
||||
|
||||
|
||||
|
||||
def updateFromZip(message='Installazione in corso...'):
|
||||
dp = platformtools.dialog_progress_bg('Kodi on Demand', message)
|
||||
def updateFromZip(message=config.get_localized_string(80050)):
|
||||
dp = platformtools.dialog_progress_bg(config.get_localized_string(20000), message)
|
||||
dp.update(0)
|
||||
|
||||
remotefilename = 'https://github.com/' + user + "/" + repo + "/archive/" + branch + ".zip"
|
||||
@@ -304,8 +304,7 @@ def updateFromZip(message='Installazione in corso...'):
|
||||
urllib.urlretrieve(remotefilename, localfilename,
|
||||
lambda nb, bs, fs, url=remotefilename: _pbhook(nb, bs, fs, url, dp))
|
||||
except Exception as e:
|
||||
platformtools.dialog_ok('Kodi on Demand', 'Non riesco a scaricare il file d\'installazione da github, questo è probabilmente dovuto ad una mancanza di connessione (o qualcosa impedisce di raggiungere github).\n'
|
||||
'Controlla bene e quando hai risolto riapri KoD.')
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(80031))
|
||||
logger.info('Non sono riuscito a scaricare il file zip')
|
||||
logger.info(e)
|
||||
dp.close()
|
||||
@@ -318,6 +317,8 @@ def updateFromZip(message='Installazione in corso...'):
|
||||
if os.path.isfile(localfilename):
|
||||
logger.info('il file esiste')
|
||||
|
||||
dp.update(80, config.get_localized_string(20000), config.get_localized_string(80032))
|
||||
|
||||
import zipfile
|
||||
try:
|
||||
hash = fixZipGetHash(localfilename)
|
||||
@@ -329,7 +330,7 @@ def updateFromZip(message='Installazione in corso...'):
|
||||
for member in zip.infolist():
|
||||
zip.extract(member, destpathname)
|
||||
cur_size += member.file_size
|
||||
dp.update(int(80 + cur_size * 19 / size))
|
||||
dp.update(int(80 + cur_size * 15 / size))
|
||||
|
||||
except Exception as e:
|
||||
logger.info('Non sono riuscito ad estrarre il file zip')
|
||||
@@ -341,7 +342,7 @@ def updateFromZip(message='Installazione in corso...'):
|
||||
|
||||
return False
|
||||
|
||||
dp.update(99)
|
||||
dp.update(95)
|
||||
|
||||
# puliamo tutto
|
||||
global addonDir
|
||||
@@ -356,8 +357,9 @@ def updateFromZip(message='Installazione in corso...'):
|
||||
remove(localfilename)
|
||||
|
||||
dp.update(100)
|
||||
xbmc.sleep(1000)
|
||||
dp.close()
|
||||
if message != 'Installazione in corso...':
|
||||
if message != config.get_localized_string(80050):
|
||||
xbmc.executebuiltin("UpdateLocalAddons")
|
||||
refreshLang()
|
||||
|
||||
@@ -448,9 +450,9 @@ def fOpen(file, mode = 'r'):
|
||||
|
||||
def _pbhook(numblocks, blocksize, filesize, url, dp):
|
||||
try:
|
||||
percent = min((numblocks*blocksize*90)/filesize, 100)
|
||||
percent = min((numblocks*blocksize*80)/filesize, 80)
|
||||
dp.update(int(percent))
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
percent = 90
|
||||
percent = 80
|
||||
dp.update(percent)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -226,14 +226,12 @@ class InfoWindow(xbmcgui.WindowXMLDialog):
|
||||
self.getControl(100014).setLabel(config.get_localized_string(60384))
|
||||
self.getControl(100015).setLabel(self.result.get("temporada_nombre", "N/A"))
|
||||
self.getControl(100016).setLabel(config.get_localized_string(60385))
|
||||
self.getControl(100017).setLabel(self.result.get("season", "N/A") + " de " +
|
||||
self.result.get("seasons", "N/A"))
|
||||
self.getControl(100017).setLabel(self.result.get("season", "N/A") + " de " + self.result.get("seasons", "N/A"))
|
||||
if self.result.get("episode"):
|
||||
self.getControl(100014).setLabel(config.get_localized_string(60377))
|
||||
self.getControl(100015).setLabel(self.result.get("episode_title", "N/A"))
|
||||
self.getControl(100018).setLabel(config.get_localized_string(60386))
|
||||
self.getControl(100019).setLabel(self.result.get("episode", "N/A") + " de " +
|
||||
self.result.get("episodes", "N/A"))
|
||||
self.getControl(100019).setLabel(self.result.get("episode", "N/A") + " de " + self.result.get("episodes", "N/A"))
|
||||
self.getControl(100020).setLabel(config.get_localized_string(60387))
|
||||
self.getControl(100021).setLabel(self.result.get("date", "N/A"))
|
||||
|
||||
@@ -287,10 +285,10 @@ class InfoWindow(xbmcgui.WindowXMLDialog):
|
||||
logger.info("action=" + repr(action.getId()))
|
||||
action = action.getId()
|
||||
|
||||
# Obtenemos el foco
|
||||
# Find Focus
|
||||
focus = self.getFocusId()
|
||||
|
||||
# Accion 1: Flecha izquierda
|
||||
# Left
|
||||
if action == 1:
|
||||
|
||||
if focus == ID_BUTTON_OK:
|
||||
@@ -298,26 +296,26 @@ class InfoWindow(xbmcgui.WindowXMLDialog):
|
||||
|
||||
elif focus == ID_BUTTON_CANCEL:
|
||||
if self.indexList + 1 != len(self.listData):
|
||||
# vamos al botón Siguiente
|
||||
# Next
|
||||
self.setFocus(self.getControl(ID_BUTTON_NEXT))
|
||||
elif self.indexList > 0:
|
||||
# vamos al botón Anterior ya que Siguiente no está activo (estamos al final de la lista)
|
||||
# Previous
|
||||
self.setFocus(self.getControl(ID_BUTTON_PREVIOUS))
|
||||
|
||||
elif focus == ID_BUTTON_NEXT:
|
||||
if self.indexList > 0:
|
||||
# vamos al botón Anterior
|
||||
# Next
|
||||
self.setFocus(self.getControl(ID_BUTTON_PREVIOUS))
|
||||
|
||||
# Accion 2: Flecha derecha
|
||||
# Right
|
||||
elif action == 2:
|
||||
|
||||
if focus == ID_BUTTON_PREVIOUS:
|
||||
if self.indexList + 1 != len(self.listData):
|
||||
# vamos al botón Siguiente
|
||||
# Next
|
||||
self.setFocus(self.getControl(ID_BUTTON_NEXT))
|
||||
else:
|
||||
# vamos al botón Cancelar ya que Siguiente no está activo (estamos al final de la lista)
|
||||
# Cancel
|
||||
self.setFocus(self.getControl(ID_BUTTON_CANCEL))
|
||||
|
||||
elif focus == ID_BUTTON_NEXT:
|
||||
@@ -326,6 +324,13 @@ class InfoWindow(xbmcgui.WindowXMLDialog):
|
||||
elif focus == ID_BUTTON_CANCEL:
|
||||
self.setFocus(self.getControl(ID_BUTTON_OK))
|
||||
|
||||
# Up
|
||||
elif action == 3:
|
||||
self.setFocus(self.getControl(ID_BUTTON_CLOSE))
|
||||
|
||||
# Down
|
||||
elif action == 4:
|
||||
self.setFocus(self.getControl(ID_BUTTON_OK))
|
||||
# Pulsa ESC o Atrás, simula click en boton cancelar
|
||||
if action in [10, 92]:
|
||||
self.onClick(ID_BUTTON_CANCEL)
|
||||
|
||||
@@ -13,6 +13,7 @@ import os
|
||||
import threading
|
||||
import time
|
||||
import re
|
||||
import math
|
||||
|
||||
import xbmc
|
||||
from core import filetools
|
||||
@@ -503,7 +504,7 @@ def update(folder_content=config.get_setting("folder_tvshows"), folder=""):
|
||||
#update_path = filetools.join(videolibrarypath, folder_content, folder) + "/" # Problemas de encode en "folder"
|
||||
update_path = filetools.join(videolibrarypath, folder_content, ' ').rstrip()
|
||||
|
||||
if not scrapertools.find_single_match(update_path, '(^\w+:\/\/)'):
|
||||
if videolibrarypath.startswith("special:") or not scrapertools.find_single_match(update_path, '(^\w+:\/\/)'):
|
||||
payload["params"] = {"directory": update_path}
|
||||
|
||||
while xbmc.getCondVisibility('Library.IsScanningVideo()'):
|
||||
@@ -511,8 +512,6 @@ def update(folder_content=config.get_setting("folder_tvshows"), folder=""):
|
||||
|
||||
data = get_data(payload)
|
||||
|
||||
#xbmc.executebuiltin('XBMC.ReloadSkin()')
|
||||
|
||||
|
||||
def search_library_path():
|
||||
sql = 'SELECT strPath FROM path WHERE strPath LIKE "special://%/plugin.video.kod/library/" AND idParentPath ISNULL'
|
||||
@@ -896,127 +895,76 @@ def clean(path_list=[]):
|
||||
progress = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80025))
|
||||
progress.update(0)
|
||||
|
||||
for path in path_list:
|
||||
|
||||
idParentPath = 0
|
||||
sql_path = ''
|
||||
sql_movies_path = ''
|
||||
sql_tvshows_path = ''
|
||||
sql_episodes_path = ''
|
||||
|
||||
path, sep = sql_format(path)
|
||||
movies_folder = config.get_setting("folder_movies")
|
||||
tvshows_folder = config.get_setting("folder_tvshows")
|
||||
|
||||
# delete episode/movie (downloads.py move_to_libray)
|
||||
if path.endswith(".strm"):
|
||||
if movies_folder in path:
|
||||
sql_movies_path = path
|
||||
else:
|
||||
sql_episodes_path = path
|
||||
# delete movie
|
||||
elif movies_folder in path:
|
||||
if not path.endswith(sep): path += sep
|
||||
|
||||
sql_movies_path = path + '%'
|
||||
# delete tvshow
|
||||
elif tvshows_folder in path:
|
||||
if not path.endswith(sep): path += sep
|
||||
|
||||
sql_tvshows_path = path + '%'
|
||||
|
||||
sql_episodes_path = sql_tvshows_path
|
||||
# delete video library
|
||||
else:
|
||||
if not path.endswith(sep): path += sep
|
||||
|
||||
sql_path = path
|
||||
|
||||
sql_movies_path = sql_path + movies_folder
|
||||
if not sql_movies_path.endswith(sep): sql_movies_path += sep
|
||||
sql_movies_path += '%'
|
||||
|
||||
sql_tvshows_path = sql_path + tvshows_folder
|
||||
if not sql_tvshows_path.endswith(sep): sql_tvshows_path += sep
|
||||
sql_tvshows_path += '%'
|
||||
|
||||
sql_episodes_path = sql_tvshows_path
|
||||
|
||||
if sql_path:
|
||||
# search video library path in the DB
|
||||
# if the path list is empty, clean the entire video library
|
||||
if not path_list:
|
||||
if not config.get_setting("videolibrary_kodi"):
|
||||
sql_path, sep = sql_format(config.get_setting("videolibrarypath"))
|
||||
if not sql_path.endswith(sep): sql_path += sep
|
||||
sql = 'SELECT idPath FROM path where strPath LIKE "%s"' % sql_path
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
# delete video library path
|
||||
if records:
|
||||
idPath = records[0][0]
|
||||
idParentPath = idPath
|
||||
if not config.get_setting("videolibrary_kodi"):
|
||||
sql = 'DELETE from path WHERE idPath=%s' % idPath
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
|
||||
if sql_movies_path:
|
||||
# search movies in the DB
|
||||
sql = 'SELECT idMovie FROM movie where c22 LIKE "%s"' % sql_movies_path
|
||||
idPath = records[0][0]
|
||||
sql = 'DELETE from path WHERE idPath=%s' % idPath
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
# delete movies
|
||||
if records:
|
||||
for record in records:
|
||||
idMovie = record[0]
|
||||
sql = 'DELETE from movie WHERE idMovie=%s' % idMovie
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
|
||||
if sql_movies_path:
|
||||
# search movies path and folders in the DB
|
||||
sql = 'SELECT idPath, idParentPath FROM path where strPath LIKE "%s"' % sql_movies_path
|
||||
sql = 'DELETE from path WHERE idParentPath=%s' % idPath
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
# delete movies path and folders
|
||||
if records:
|
||||
for record in records:
|
||||
if record[1] == idParentPath and config.get_setting("videolibrary_kodi"):
|
||||
continue
|
||||
idPath = record[0]
|
||||
sql = 'DELETE from path WHERE idPath=%s' % idPath
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
|
||||
if sql_tvshows_path:
|
||||
# search TV shows in the DB
|
||||
sql = 'SELECT idShow FROM tvshow_view where strPath LIKE "%s"' % sql_tvshows_path
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
# delete TV shows
|
||||
if records:
|
||||
for record in records:
|
||||
idShow = record[0]
|
||||
sql = 'DELETE from tvshow WHERE idShow=%s' % idShow
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
from core import videolibrarytools
|
||||
for path, folders, files in filetools.walk(videolibrarytools.MOVIES_PATH):
|
||||
for folder in folders:
|
||||
path_list.append(filetools.join(config.get_setting("videolibrarypath"), videolibrarytools.FOLDER_MOVIES, folder))
|
||||
|
||||
if sql_episodes_path:
|
||||
# search episodes in the DB
|
||||
sql = 'SELECT idEpisode FROM episode where c18 LIKE "%s"' % sql_episodes_path
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
# delete episodes
|
||||
if records:
|
||||
for record in records:
|
||||
idEpisode = record[0]
|
||||
sql = 'DELETE from episode WHERE idEpisode=%s' % idEpisode
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
for path, folders, files in filetools.walk(videolibrarytools.TVSHOWS_PATH):
|
||||
for folder in folders:
|
||||
tvshow_nfo = filetools.join(path, folder, "tvshow.nfo")
|
||||
if filetools.exists(tvshow_nfo):
|
||||
path_list.append(filetools.join(config.get_setting("videolibrarypath"), videolibrarytools.FOLDER_TVSHOWS, folder))
|
||||
|
||||
if sql_tvshows_path:
|
||||
# search TV shows path and folders in the DB
|
||||
sql = 'SELECT idPath, idParentPath FROM path where strPath LIKE "%s"' % sql_tvshows_path
|
||||
if path_list: t = float(100) / len(path_list)
|
||||
for i, path in enumerate(path_list):
|
||||
progress.update(int(math.ceil((i + 1) * t)))
|
||||
|
||||
if not path:
|
||||
continue
|
||||
|
||||
sql_path, sep = sql_format(path)
|
||||
if filetools.isdir(path) and not sql_path.endswith(sep): sql_path += sep
|
||||
|
||||
if filetools.isdir(path):
|
||||
# search movie in the DB
|
||||
sql = 'SELECT idMovie FROM movie where c22 LIKE "%s"' % (sql_path + '%')
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
# delete tvshows path and folders
|
||||
# delete movie
|
||||
if records:
|
||||
for record in records:
|
||||
if record[1] == idParentPath and config.get_setting("videolibrary_kodi"):
|
||||
continue
|
||||
idPath = record[0]
|
||||
sql = 'DELETE from path WHERE idPath=%s' % idPath
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.RemoveMovie", "id": 1, "params": {"movieid": records[0][0]}}
|
||||
data = get_data(payload)
|
||||
continue
|
||||
# search TV show in the DB
|
||||
sql = 'SELECT idShow FROM tvshow_view where strPath LIKE "%s"' % sql_path
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
# delete TV show
|
||||
if records:
|
||||
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.RemoveTVShow", "id": 1, "params": {"tvshowid": records[0][0]}}
|
||||
data = get_data(payload)
|
||||
elif config.get_setting("folder_movies") in sql_path:
|
||||
# search movie in the DB
|
||||
sql = 'SELECT idMovie FROM movie where c22 LIKE "%s"' % sql_path
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
# delete movie
|
||||
if records:
|
||||
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.RemoveMovie", "id": 1, "params": {"movieid": records[0][0]}}
|
||||
data = get_data(payload)
|
||||
else:
|
||||
# search episode in the DB
|
||||
sql = 'SELECT idEpisode FROM episode where c18 LIKE "%s"' % sql_path
|
||||
nun_records, records = execute_sql_kodi(sql)
|
||||
# delete episode
|
||||
if records:
|
||||
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.RemoveEpisode", "id": 1, "params": {"episodeid": records[0][0]}}
|
||||
data = get_data(payload)
|
||||
|
||||
progress.update(100)
|
||||
xbmc.sleep(1000)
|
||||
progress.close()
|
||||
xbmc.executebuiltin('XBMC.ReloadSkin()')
|
||||
|
||||
|
||||
def execute_sql_kodi(sql):
|
||||
@@ -1120,7 +1068,6 @@ def check_sources(new_movies_path='', new_tvshows_path=''):
|
||||
return False, False
|
||||
|
||||
|
||||
|
||||
def update_sources(new='', old=''):
|
||||
logger.info()
|
||||
if new == old: return
|
||||
@@ -1212,6 +1159,8 @@ def ask_set_content(silent=False):
|
||||
if set_content("movie", True, custom) and set_content("tvshow", True, custom):
|
||||
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(70104))
|
||||
config.set_setting("videolibrary_kodi", True)
|
||||
from specials import videolibrary
|
||||
videolibrary.update_videolibrary()
|
||||
update()
|
||||
else:
|
||||
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80024))
|
||||
|
||||
Reference in New Issue
Block a user