Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -36,9 +36,7 @@ def get_channel_parameters(channel_name):
|
|||||||
# logger.debug(channel_parameters)
|
# logger.debug(channel_parameters)
|
||||||
if channel_parameters:
|
if channel_parameters:
|
||||||
# cambios de nombres y valores por defecto
|
# cambios de nombres y valores por defecto
|
||||||
channel_parameters["title"] = channel_parameters.pop("name") + (
|
channel_parameters["title"] = channel_parameters.pop("name") + (' [DEPRECATED]' if 'deprecated' in channel_parameters and channel_parameters['deprecated'] else '')
|
||||||
' [DEPRECATED]' if channel_parameters.has_key('deprecated') and channel_parameters[
|
|
||||||
'deprecated'] else '')
|
|
||||||
channel_parameters["channel"] = channel_parameters.pop("id")
|
channel_parameters["channel"] = channel_parameters.pop("id")
|
||||||
|
|
||||||
# si no existe el key se declaran valor por defecto para que no de fallos en las funciones que lo llaman
|
# si no existe el key se declaran valor por defecto para que no de fallos en las funciones que lo llaman
|
||||||
@@ -194,8 +192,8 @@ def get_default_settings(channel_name):
|
|||||||
channel_language = channel_json['language']
|
channel_language = channel_json['language']
|
||||||
channel_controls = channel_json['settings']
|
channel_controls = channel_json['settings']
|
||||||
categories = channel_json['categories']
|
categories = channel_json['categories']
|
||||||
not_active = channel_json['not_active'] if channel_json.has_key('not_active') else []
|
not_active = channel_json['not_active'] if 'not_active' in channel_json else []
|
||||||
default_off = channel_json['default_off'] if channel_json.has_key('default_off') else []
|
default_off = channel_json['default_off'] if 'default_off' in channel_json else []
|
||||||
|
|
||||||
# Apply default configurations if they do not exist
|
# Apply default configurations if they do not exist
|
||||||
for control in default_controls:
|
for control in default_controls:
|
||||||
|
|||||||
+38
-39
@@ -133,13 +133,13 @@ def read(path, linea_inicio=0, total_lineas=None, whence=0, silent=False, vfs=Tr
|
|||||||
try:
|
try:
|
||||||
linea_inicio = int(linea_inicio)
|
linea_inicio = int(linea_inicio)
|
||||||
except:
|
except:
|
||||||
logger.error('Read: ERROR de linea_inicio: %s' % str(linea_inicio))
|
logger.error('Read: Start_line ERROR: %s' % str(linea_inicio))
|
||||||
linea_inicio = 0
|
linea_inicio = 0
|
||||||
if total_lineas != None and not isinstance(total_lineas, int):
|
if total_lineas != None and not isinstance(total_lineas, int):
|
||||||
try:
|
try:
|
||||||
total_lineas = int(total_lineas)
|
total_lineas = int(total_lineas)
|
||||||
except:
|
except:
|
||||||
logger.error('Read: ERROR de total_lineas: %s' % str(total_lineas))
|
logger.error('Read: ERROR of total_lineas: %s' % str(total_lineas))
|
||||||
total_lineas = None
|
total_lineas = None
|
||||||
if xbmc_vfs and vfs:
|
if xbmc_vfs and vfs:
|
||||||
if not exists(path): return False
|
if not exists(path): return False
|
||||||
@@ -151,7 +151,7 @@ def read(path, linea_inicio=0, total_lineas=None, whence=0, silent=False, vfs=Tr
|
|||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
f.seek(linea_inicio, whence)
|
f.seek(linea_inicio, whence)
|
||||||
logger.debug('POSICIÓN de comienzo de lectura, tell(): %s' % f.seek(0, 1))
|
logger.debug('POSITION of beginning of reading,, tell(): %s' % f.seek(0, 1))
|
||||||
if total_lineas == None:
|
if total_lineas == None:
|
||||||
total_lineas = 0
|
total_lineas = 0
|
||||||
data = f.read(total_lineas)
|
data = f.read(total_lineas)
|
||||||
@@ -169,7 +169,7 @@ def read(path, linea_inicio=0, total_lineas=None, whence=0, silent=False, vfs=Tr
|
|||||||
f.close()
|
f.close()
|
||||||
except:
|
except:
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error("ERROR al leer el archivo: %s" % path)
|
logger.error("ERROR reading file: %s" % path)
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -226,20 +226,20 @@ def file_open(path, mode="r", silent=False, vfs=True):
|
|||||||
if xbmc_vfs and vfs:
|
if xbmc_vfs and vfs:
|
||||||
if 'r' in mode and '+' in mode:
|
if 'r' in mode and '+' in mode:
|
||||||
mode = mode.replace('r', 'w').replace('+', '')
|
mode = mode.replace('r', 'w').replace('+', '')
|
||||||
logger.debug('Open MODE cambiado a: %s' % mode)
|
logger.debug('Open MODE changed to: %s' % mode)
|
||||||
if 'a' in mode:
|
if 'a' in mode:
|
||||||
mode = mode.replace('a', 'w').replace('+', '')
|
mode = mode.replace('a', 'w').replace('+', '')
|
||||||
logger.debug('Open MODE cambiado a: %s' % mode)
|
logger.debug('Open MODE changed to: %s' % mode)
|
||||||
return xbmcvfs.File(path, mode)
|
return xbmcvfs.File(path, mode)
|
||||||
elif path.lower().startswith("smb://"):
|
elif path.lower().startswith("smb://"):
|
||||||
return samba.smb_open(path, mode)
|
return samba.smb_open(path, mode)
|
||||||
else:
|
else:
|
||||||
return open(path, mode)
|
return open(path, mode)
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al abrir el archivo: %s, %s" % (path, mode))
|
logger.error("ERROR when opening file: %s, %s" % (path, mode))
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
platformtools.dialog_notification("Error al abrir", path)
|
platformtools.dialog_notification("Error Opening", path)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ def file_stat(path, silent=False, vfs=True):
|
|||||||
return xbmcvfs.Stat(path)
|
return xbmcvfs.Stat(path)
|
||||||
raise
|
raise
|
||||||
except:
|
except:
|
||||||
logger.error("File_Stat no soportado: %s" % path)
|
logger.error("File_Stat not supported: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return False
|
return False
|
||||||
@@ -283,9 +283,9 @@ def rename(path, new_name, silent=False, strict=False, vfs=True):
|
|||||||
dest = encode(join(dirname(path_end), new_name))
|
dest = encode(join(dirname(path_end), new_name))
|
||||||
result = xbmcvfs.rename(path, dest)
|
result = xbmcvfs.rename(path, dest)
|
||||||
if not result and not strict:
|
if not result and not strict:
|
||||||
logger.error("ERROR al RENOMBRAR el archivo: %s. Copiando y borrando" % path)
|
logger.error("ERROR RENAME file: %s. Copying and deleting" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
dialogo = platformtools.dialog_progress("Copiando archivo", "")
|
dialogo = platformtools.dialog_progress("Copying file", "")
|
||||||
result = xbmcvfs.copy(path, dest)
|
result = xbmcvfs.copy(path, dest)
|
||||||
if not result:
|
if not result:
|
||||||
return False
|
return False
|
||||||
@@ -298,10 +298,10 @@ def rename(path, new_name, silent=False, strict=False, vfs=True):
|
|||||||
new_name = encode(new_name, False)
|
new_name = encode(new_name, False)
|
||||||
os.rename(path, os.path.join(os.path.dirname(path), new_name))
|
os.rename(path, os.path.join(os.path.dirname(path), new_name))
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al renombrar el archivo: %s" % path)
|
logger.error("ERROR when renaming the file: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
platformtools.dialog_notification("Error al renombrar", path)
|
platformtools.dialog_notification("Error renaming", path)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
@@ -324,9 +324,9 @@ def move(path, dest, silent=False, strict=False, vfs=True):
|
|||||||
dest = encode(dest)
|
dest = encode(dest)
|
||||||
result = xbmcvfs.rename(path, dest)
|
result = xbmcvfs.rename(path, dest)
|
||||||
if not result and not strict:
|
if not result and not strict:
|
||||||
logger.error("ERROR al MOVER el archivo: %s. Copiando y borrando" % path)
|
logger.error("ERROR when MOVING the file: %s. Copying and deleting" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
dialogo = platformtools.dialog_progress("Copiando archivo", "")
|
dialogo = platformtools.dialog_progress("Copying file", "")
|
||||||
result = xbmcvfs.copy(path, dest)
|
result = xbmcvfs.copy(path, dest)
|
||||||
if not result:
|
if not result:
|
||||||
return False
|
return False
|
||||||
@@ -349,7 +349,7 @@ def move(path, dest, silent=False, strict=False, vfs=True):
|
|||||||
dialogo = platformtools.dialog_progress("Copiando archivo", "")
|
dialogo = platformtools.dialog_progress("Copiando archivo", "")
|
||||||
return copy(path, dest) == True and remove(path) == True
|
return copy(path, dest) == True and remove(path) == True
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al mover el archivo: %s a %s" % (path, dest))
|
logger.error("ERROR when moving file: %s to %s" % (path, dest))
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return False
|
return False
|
||||||
@@ -376,7 +376,7 @@ def copy(path, dest, silent=False, vfs=True):
|
|||||||
if not silent:
|
if not silent:
|
||||||
dialogo = platformtools.dialog_progress("Copiando archivo", "")
|
dialogo = platformtools.dialog_progress("Copiando archivo", "")
|
||||||
return bool(xbmcvfs.copy(path, dest))
|
return bool(xbmcvfs.copy(path, dest))
|
||||||
|
|
||||||
fo = file_open(path, "rb")
|
fo = file_open(path, "rb")
|
||||||
fd = file_open(dest, "wb")
|
fd = file_open(dest, "wb")
|
||||||
if fo and fd:
|
if fo and fd:
|
||||||
@@ -398,7 +398,7 @@ def copy(path, dest, silent=False, vfs=True):
|
|||||||
if not silent:
|
if not silent:
|
||||||
dialogo.close()
|
dialogo.close()
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al copiar el archivo: %s" % path)
|
logger.error("ERROR when copying the file: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return False
|
return False
|
||||||
@@ -420,13 +420,13 @@ def exists(path, silent=False, vfs=True):
|
|||||||
result = bool(xbmcvfs.exists(path))
|
result = bool(xbmcvfs.exists(path))
|
||||||
if not result and not path.endswith('/') and not path.endswith('\\'):
|
if not result and not path.endswith('/') and not path.endswith('\\'):
|
||||||
result = bool(xbmcvfs.exists(join(path, ' ').rstrip()))
|
result = bool(xbmcvfs.exists(join(path, ' ').rstrip()))
|
||||||
return result
|
return result
|
||||||
elif path.lower().startswith("smb://"):
|
elif path.lower().startswith("smb://"):
|
||||||
return samba.exists(path)
|
return samba.exists(path)
|
||||||
else:
|
else:
|
||||||
return os.path.exists(path)
|
return os.path.exists(path)
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al comprobar la ruta: %s" % path)
|
logger.error("ERROR when checking the path: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return False
|
return False
|
||||||
@@ -458,7 +458,7 @@ def isfile(path, silent=False, vfs=True):
|
|||||||
else:
|
else:
|
||||||
return os.path.isfile(path)
|
return os.path.isfile(path)
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al comprobar el archivo: %s" % path)
|
logger.error("ERROR when checking file: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return False
|
return False
|
||||||
@@ -490,7 +490,7 @@ def isdir(path, silent=False, vfs=True):
|
|||||||
else:
|
else:
|
||||||
return os.path.isdir(path)
|
return os.path.isdir(path)
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al comprobar el directorio: %s" % path)
|
logger.error("ERROR when checking the directory: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return False
|
return False
|
||||||
@@ -517,7 +517,7 @@ def getsize(path, silent=False, vfs=True):
|
|||||||
else:
|
else:
|
||||||
return os.path.getsize(path)
|
return os.path.getsize(path)
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al obtener el tamaño: %s" % path)
|
logger.error("ERROR when getting the size: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return long(0)
|
return long(0)
|
||||||
@@ -540,10 +540,10 @@ def remove(path, silent=False, vfs=True):
|
|||||||
else:
|
else:
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al eliminar el archivo: %s" % path)
|
logger.error("ERROR deleting file: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
platformtools.dialog_notification("Error al eliminar el archivo", path)
|
platformtools.dialog_notification("ERROR deleting file", path)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
@@ -580,10 +580,10 @@ def rmdirtree(path, silent=False, vfs=True):
|
|||||||
import shutil
|
import shutil
|
||||||
shutil.rmtree(path, ignore_errors=True)
|
shutil.rmtree(path, ignore_errors=True)
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al eliminar el directorio: %s" % path)
|
logger.error("ERROR deleting directory: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
platformtools.dialog_notification("Error al eliminar el directorio", path)
|
platformtools.dialog_notification("ERROR deleting directory", path)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return not exists(path)
|
return not exists(path)
|
||||||
@@ -608,10 +608,10 @@ def rmdir(path, silent=False, vfs=True):
|
|||||||
else:
|
else:
|
||||||
os.rmdir(path)
|
os.rmdir(path)
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al eliminar el directorio: %s" % path)
|
logger.error("ERROR deleting directory: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
platformtools.dialog_notification("Error al eliminar el directorio", path)
|
platformtools.dialog_notification("ERROR deleting directory", path)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
@@ -641,10 +641,10 @@ def mkdir(path, silent=False, vfs=True):
|
|||||||
else:
|
else:
|
||||||
os.mkdir(path)
|
os.mkdir(path)
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al crear el directorio: %s" % path)
|
logger.error("ERROR when creating directory: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
platformtools.dialog_notification("Error al crear el directorio", path)
|
platformtools.dialog_notification("ERROR when creating directory", path)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
@@ -724,7 +724,7 @@ def listdir(path, silent=False, vfs=True):
|
|||||||
else:
|
else:
|
||||||
return decode(os.listdir(path))
|
return decode(os.listdir(path))
|
||||||
except:
|
except:
|
||||||
logger.error("ERROR al leer el directorio: %s" % path)
|
logger.error("ERROR when reading the directory: %s" % path)
|
||||||
if not silent:
|
if not silent:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return False
|
return False
|
||||||
@@ -740,14 +740,13 @@ def join(*paths):
|
|||||||
list_path = []
|
list_path = []
|
||||||
if paths[0].startswith("/"):
|
if paths[0].startswith("/"):
|
||||||
list_path.append("")
|
list_path.append("")
|
||||||
|
|
||||||
for path in paths:
|
for path in paths:
|
||||||
if path:
|
if path:
|
||||||
if xbmc_vfs:
|
if xbmc_vfs and type(path) != str:
|
||||||
path = encode(path)
|
path = encode(path)
|
||||||
list_path += path.replace("\\", "/").strip("/").split("/")
|
list_path += path.replace("\\", "/").strip("/").split("/")
|
||||||
|
|
||||||
if scrapertools.find_single_match(paths[0], '(^\w+:\/\/)'):
|
if scrapertools.find_single_match(paths[0], r'(^\w+:\/\/)'):
|
||||||
return str("/".join(list_path))
|
return str("/".join(list_path))
|
||||||
else:
|
else:
|
||||||
return str(os.sep.join(list_path))
|
return str(os.sep.join(list_path))
|
||||||
@@ -812,8 +811,8 @@ def remove_tags(title):
|
|||||||
return title_without_tags
|
return title_without_tags
|
||||||
else:
|
else:
|
||||||
return title
|
return title
|
||||||
|
|
||||||
|
|
||||||
def remove_smb_credential(path):
|
def remove_smb_credential(path):
|
||||||
"""
|
"""
|
||||||
devuelve el path sin contraseña/usuario para paths de SMB
|
devuelve el path sin contraseña/usuario para paths de SMB
|
||||||
@@ -823,10 +822,10 @@ def remove_smb_credential(path):
|
|||||||
@rtype: str
|
@rtype: str
|
||||||
"""
|
"""
|
||||||
logger.info()
|
logger.info()
|
||||||
|
|
||||||
if not scrapertools.find_single_match(path, '(^\w+:\/\/)'):
|
if not scrapertools.find_single_match(path, '(^\w+:\/\/)'):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
protocol = scrapertools.find_single_match(path, '(^\w+:\/\/)')
|
protocol = scrapertools.find_single_match(path, '(^\w+:\/\/)')
|
||||||
path_without_credentials = scrapertools.find_single_match(path, '^\w+:\/\/(?:[^;\n]+;)?(?:[^:@\n]+[:|@])?(?:[^@\n]+@)?(.*?$)')
|
path_without_credentials = scrapertools.find_single_match(path, '^\w+:\/\/(?:[^;\n]+;)?(?:[^:@\n]+[:|@])?(?:[^@\n]+@)?(.*?$)')
|
||||||
|
|
||||||
|
|||||||
+20
-20
@@ -10,26 +10,26 @@ from platformcode import logger
|
|||||||
try:
|
try:
|
||||||
import json
|
import json
|
||||||
except:
|
except:
|
||||||
logger.info("json incluido en el interprete **NO** disponible")
|
logger.info("json included in the interpreter **NOT** available")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
except:
|
except:
|
||||||
logger.info("simplejson incluido en el interprete **NO** disponible")
|
logger.info("simplejson included in the interpreter **NOT** available")
|
||||||
try:
|
try:
|
||||||
from lib import simplejson as json
|
from lib import simplejson as json
|
||||||
except:
|
except:
|
||||||
logger.info("simplejson en el directorio lib **NO** disponible")
|
logger.info("simplejson in lib directory **NOT** available")
|
||||||
logger.error("No se ha encontrado un parser de JSON valido")
|
logger.error("A valid JSON parser was not found")
|
||||||
json = None
|
json = None
|
||||||
else:
|
else:
|
||||||
logger.info("Usando simplejson en el directorio lib")
|
logger.info("Using simplejson in the lib directory")
|
||||||
else:
|
else:
|
||||||
logger.info("Usando simplejson incluido en el interprete")
|
logger.info("Using simplejson included in the interpreter")
|
||||||
# ~ else:
|
# ~ else:
|
||||||
# ~ logger.info("Usando json incluido en el interprete")
|
# ~ logger.info("Usando json incluido en el interprete")
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
PY3 = False
|
PY3 = False
|
||||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ def load(*args, **kwargs):
|
|||||||
try:
|
try:
|
||||||
value = json.loads(*args, **kwargs)
|
value = json.loads(*args, **kwargs)
|
||||||
except:
|
except:
|
||||||
logger.error("**NO** se ha podido cargar el JSON")
|
logger.error("**NOT** able to load the JSON")
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
value = {}
|
value = {}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ def dump(*args, **kwargs):
|
|||||||
try:
|
try:
|
||||||
value = json.dumps(*args, **kwargs)
|
value = json.dumps(*args, **kwargs)
|
||||||
except:
|
except:
|
||||||
logger.error("**NO** se ha podido guardar el JSON")
|
logger.error("JSON could **NOT** be saved")
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
value = ""
|
value = ""
|
||||||
return value
|
return value
|
||||||
@@ -112,7 +112,7 @@ def get_node_from_file(name_file, node, path=None):
|
|||||||
if node in dict_data:
|
if node in dict_data:
|
||||||
dict_node = dict_data[node]
|
dict_node = dict_data[node]
|
||||||
|
|
||||||
# logger.debug("dict_node: %s" % dict_node)
|
#logger.debug("dict_node: %s" % dict_node)
|
||||||
|
|
||||||
return dict_node
|
return dict_node
|
||||||
|
|
||||||
@@ -132,18 +132,18 @@ def check_to_backup(data, fname, dict_data):
|
|||||||
logger.info()
|
logger.info()
|
||||||
|
|
||||||
if not dict_data:
|
if not dict_data:
|
||||||
logger.error("Error al cargar el json del fichero %s" % fname)
|
logger.error("Error loading json from file %s" % fname)
|
||||||
|
|
||||||
if data != "":
|
if data != "":
|
||||||
# se crea un nuevo fichero
|
# se crea un nuevo fichero
|
||||||
from core import filetools
|
from core import filetools
|
||||||
title = filetools.write("%s.bk" % fname, data)
|
title = filetools.write("%s.bk" % fname, data)
|
||||||
if title != "":
|
if title != "":
|
||||||
logger.error("Ha habido un error al guardar el fichero: %s.bk" % fname)
|
logger.error("There was an error saving the file: %s.bk" % fname)
|
||||||
else:
|
else:
|
||||||
logger.debug("Se ha guardado una copia con el nombre: %s.bk" % fname)
|
logger.debug("A copy with the name has been saved: %s.bk" % fname)
|
||||||
else:
|
else:
|
||||||
logger.debug("Está vacío el fichero: %s" % fname)
|
logger.debug("The file is empty: %s" % fname)
|
||||||
|
|
||||||
|
|
||||||
def update_node(dict_node, name_file, node, path=None):
|
def update_node(dict_node, name_file, node, path=None):
|
||||||
@@ -183,18 +183,18 @@ def update_node(dict_node, name_file, node, path=None):
|
|||||||
# es un dict
|
# es un dict
|
||||||
if dict_data:
|
if dict_data:
|
||||||
if node in dict_data:
|
if node in dict_data:
|
||||||
logger.debug(" existe el key %s" % node)
|
logger.debug(" the key exists %s" % node)
|
||||||
dict_data[node] = dict_node
|
dict_data[node] = dict_node
|
||||||
else:
|
else:
|
||||||
logger.debug(" NO existe el key %s" % node)
|
logger.debug(" The key does NOT exist %s" % node)
|
||||||
new_dict = {node: dict_node}
|
new_dict = {node: dict_node}
|
||||||
dict_data.update(new_dict)
|
dict_data.update(new_dict)
|
||||||
else:
|
else:
|
||||||
logger.debug(" NO es un dict")
|
logger.debug(" It is NOT a dict")
|
||||||
dict_data = {node: dict_node}
|
dict_data = {node: dict_node}
|
||||||
json_data = dump(dict_data)
|
json_data = dump(dict_data)
|
||||||
result = filetools.write(fname, json_data)
|
result = filetools.write(fname, json_data)
|
||||||
except:
|
except:
|
||||||
logger.error("No se ha podido actualizar %s" % fname)
|
logger.error("Could not update %s" % fname)
|
||||||
|
|
||||||
return result, json_data
|
return result, json_data
|
||||||
|
|||||||
+2
-2
@@ -759,7 +759,7 @@ def typo(string, typography=''):
|
|||||||
if '{}' in string:
|
if '{}' in string:
|
||||||
string = '{' + re.sub(r'\s\{\}','',string) + '}'
|
string = '{' + re.sub(r'\s\{\}','',string) + '}'
|
||||||
if 'submenu' in string:
|
if 'submenu' in string:
|
||||||
string = u"\u2022\u2022 ".encode('utf-8') + re.sub(r'\ssubmenu','',string)
|
string = "•• " + re.sub(r'\ssubmenu','',string)
|
||||||
if 'color' in string:
|
if 'color' in string:
|
||||||
color = scrapertools.find_single_match(string, 'color ([a-z]+)')
|
color = scrapertools.find_single_match(string, 'color ([a-z]+)')
|
||||||
if color == 'kod' or '': color = kod_color
|
if color == 'kod' or '': color = kod_color
|
||||||
@@ -773,7 +773,7 @@ def typo(string, typography=''):
|
|||||||
if '--' in string:
|
if '--' in string:
|
||||||
string = ' - ' + re.sub(r'\s--','',string)
|
string = ' - ' + re.sub(r'\s--','',string)
|
||||||
if 'bullet' in string:
|
if 'bullet' in string:
|
||||||
string = '[B]' + u"\u2022".encode('utf-8') + '[/B] ' + re.sub(r'\sbullet','',string)
|
string = '[B]•[/B] ' + re.sub(r'\sbullet','',string)
|
||||||
|
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -465,9 +465,8 @@ def set_infoLabels_item(item, seekTmdb=True, idioma_busqueda=def_lang, lock=None
|
|||||||
# Busqueda de pelicula por titulo...
|
# Busqueda de pelicula por titulo...
|
||||||
if item.infoLabels['year'] or item.infoLabels['filtro']:
|
if item.infoLabels['year'] or item.infoLabels['filtro']:
|
||||||
# ...y año o filtro
|
# ...y año o filtro
|
||||||
if item.contentTitle:
|
searched_title = item.contentTitle if item.contentTitle else item.fulltitle
|
||||||
titulo_buscado = item.contentTitle
|
otmdb = Tmdb(texto_buscado=searched_title, tipo=tipo_busqueda, idioma_busqueda=idioma_busqueda,
|
||||||
otmdb = Tmdb(texto_buscado=titulo_buscado, tipo=tipo_busqueda, idioma_busqueda=idioma_busqueda,
|
|
||||||
filtro=item.infoLabels.get('filtro', {}), year=item.infoLabels['year'])
|
filtro=item.infoLabels.get('filtro', {}), year=item.infoLabels['year'])
|
||||||
if otmdb is not None:
|
if otmdb is not None:
|
||||||
if otmdb.get_id() and config.get_setting("tmdb_plus_info", default=False):
|
if otmdb.get_id() and config.get_setting("tmdb_plus_info", default=False):
|
||||||
|
|||||||
+4
-1
@@ -11,7 +11,10 @@ import re
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import urllib
|
import urllib
|
||||||
import urlparse
|
try:
|
||||||
|
import urlparse
|
||||||
|
except:
|
||||||
|
import urllib.parse as urlparse
|
||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ def start():
|
|||||||
# se ha problemi di DNS avvia ma lascia entrare
|
# se ha problemi di DNS avvia ma lascia entrare
|
||||||
# se tutto ok: entra nell'addon
|
# se tutto ok: entra nell'addon
|
||||||
|
|
||||||
from specials.checkhost import test_conn
|
# from specials.checkhost import test_conn
|
||||||
import threading
|
# import threading
|
||||||
threading.Thread(target=test_conn,
|
# threading.Thread(target=test_conn,
|
||||||
args=(True, not config.get_setting('resolver_dns'), True, [], [], True)).start()
|
# args=(True, not config.get_setting('resolver_dns'), True, [], [], True)).start()
|
||||||
|
|
||||||
def run(item=None):
|
def run(item=None):
|
||||||
logger.info()
|
logger.info()
|
||||||
@@ -100,7 +100,7 @@ def run(item=None):
|
|||||||
|
|
||||||
# If item has no action, stops here
|
# If item has no action, stops here
|
||||||
if item.action == "":
|
if item.action == "":
|
||||||
logger.info("Item sin accion")
|
logger.info("Item without action")
|
||||||
return
|
return
|
||||||
|
|
||||||
# Action for main menu in channelselector
|
# Action for main menu in channelselector
|
||||||
@@ -332,21 +332,20 @@ def run(item=None):
|
|||||||
|
|
||||||
# Grab inner and third party errors
|
# Grab inner and third party errors
|
||||||
if hasattr(e, 'reason'):
|
if hasattr(e, 'reason'):
|
||||||
logger.error("Razon del error, codigo: %s | Razon: %s" % (str(e.reason[0]), str(e.reason[1])))
|
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"
|
texto = config.get_localized_string(30050) # "No se puede conectar con el sitio web"
|
||||||
platformtools.dialog_ok(config.get_localized_string(20000), texto)
|
platformtools.dialog_ok(config.get_localized_string(20000), texto)
|
||||||
|
|
||||||
# Grab server response errors
|
# Grab server response errors
|
||||||
elif hasattr(e, 'code'):
|
elif hasattr(e, 'code'):
|
||||||
logger.error("Codigo de error HTTP : %d" % e.code)
|
logger.error("HTTP error code: %d" % e.code)
|
||||||
# "El sitio web no funciona correctamente (error http %d)"
|
# "El sitio web no funciona correctamente (error http %d)"
|
||||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(30051) % e.code)
|
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(30051) % e.code)
|
||||||
except WebErrorException as e:
|
except WebErrorException as e:
|
||||||
import traceback
|
import traceback
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\",
|
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + '([^.]+)\.py"'
|
||||||
"\\\\") + '([^.]+)\.py"'
|
|
||||||
canal = scrapertools.find_single_match(traceback.format_exc(), patron)
|
canal = scrapertools.find_single_match(traceback.format_exc(), patron)
|
||||||
|
|
||||||
platformtools.dialog_ok(
|
platformtools.dialog_ok(
|
||||||
@@ -426,7 +425,7 @@ def reorder_itemlist(itemlist):
|
|||||||
new_list.extend(mod_list)
|
new_list.extend(mod_list)
|
||||||
new_list.extend(not_mod_list)
|
new_list.extend(not_mod_list)
|
||||||
|
|
||||||
logger.info("Titulos modificados:%i | No modificados:%i" % (modified, not_modified))
|
logger.info("Modified Titles:%i |Unmodified:%i" % (modified, not_modified))
|
||||||
|
|
||||||
if len(new_list) == 0:
|
if len(new_list) == 0:
|
||||||
new_list = itemlist
|
new_list = itemlist
|
||||||
|
|||||||
Reference in New Issue
Block a user