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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user