ELementum Come Client di Default
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user