diff --git a/lib/python_libtorrent/python_libtorrent/__init__.py b/lib/python_libtorrent/python_libtorrent/__init__.py index d916ebd7..a0a8485e 100644 --- a/lib/python_libtorrent/python_libtorrent/__init__.py +++ b/lib/python_libtorrent/python_libtorrent/__init__.py @@ -32,38 +32,27 @@ from .functions import * import xbmc, xbmcaddon import sys import os -import traceback ### Alfa +import traceback - -#__settings__ = xbmcaddon.Addon(id='script.module.libtorrent') ### Alfa -#__version__ = __settings__.getAddonInfo('version') ### Alfa -#__plugin__ = __settings__.getAddonInfo('name') + " v." + __version__ ### Alfa -#__settings__ = xbmcaddon.Addon(id='plugin.video.kod') ### Alfa -__version__ = '1.1.17' ### Alfa -__plugin__ = "python-libtorrent v.1.1.7" ### Alfa -#__language__ = __settings__.getLocalizedString ### Alfa +__version__ = '1.1.17' +__plugin__ = "python-libtorrent v.1.1.7" __root__ = os.path.dirname(os.path.dirname(__file__)) libtorrent=None platform = get_platform() -#set_dirname=__settings__.getSetting('dirname') ### Alfa -#set_dirname=os.path.join(__settings__.getAddonInfo('Path'),'lib', 'python_libtorrent') ### Alfa -set_dirname=__root__ ### Alfa +set_dirname=__root__ if getSettingAsBool('custom_dirname') and set_dirname: log('set_dirname:' +str(set_dirname)) dirname=set_dirname else: - #dirname = os.path.join(xbmc.translatePath('special://temp'), 'xbmcup', 'script.module.libtorrent', - # 'python_libtorrent') - dirname=set_dirname ### Alfa + dirname=set_dirname log('dirname: ' +str(dirname)) -#versions = ['0.16.19', '1.0.6', '1.0.7', '1.0.8', '1.0.9', '1.0.11', '1.1.0', '1.1.1', '1.1.6', '1.1.7', '1.2.2', '1.2.3'] ### Alfa -versions = ['0.16.19', '1.0.6', '1.0.7', '1.0.8', '1.0.9', '1.0.11', '1.1.0', '1.1.1', '1.1.6', '1.1.7', '1.2.2'] ### Alfa +#versions = ['0.16.19', '1.0.6', '1.0.7', '1.0.8', '1.0.9', '1.0.11', '1.1.0', '1.1.1', '1.1.6', '1.1.7', '1.2.2', '1.2.3'] +versions = ['0.16.19', '1.0.6', '1.0.7', '1.0.8', '1.0.9', '1.0.11', '1.1.0', '1.1.1', '1.1.6', '1.1.7', '1.2.2'] default_path = versions[-1] -#set_version = int(__settings__.getSetting('set_version')) ### Alfa -set_version = 0 ### Alfa +set_version = 0 if getSettingAsBool('custom_version'): log('set_version:' +str(set_version)+' '+versions[set_version]) platform['version'] = versions[set_version] @@ -101,12 +90,8 @@ if not lm.check_exist(): xbmc.sleep(2000) -#if __settings__.getSetting('plugin_name')!=__plugin__: ### Alfa -# __settings__.setSetting('plugin_name', __plugin__) ### Alfa -# lm.update() ### Alfa - log('platform: ' + str(platform)) -if platform['system'] not in ['windows', 'windows_x64']: ### Alfa +if platform['system'] not in ['windows', 'windows_x64']: log('os: '+str(os.uname())) log_text = 'ucs4' if sys.maxunicode > 65536 else 'ucs2' log_text += ' x64' if sys.maxsize > 2147483647 else ' x86' @@ -118,18 +103,18 @@ try: description = '' libtorrent = '' from platformcode import config - + if platform['system'] in ['linux_x86', 'windows', 'windows_x64', 'linux_armv6', 'linux_armv7', 'linux_x86_64', 'linux_mipsel_ucs2', 'linux_mipsel_ucs4', - 'linux_aarch64_ucs2', 'linux_aarch64_ucs4']: ### Alfa + 'linux_aarch64_ucs2', 'linux_aarch64_ucs4']: import libtorrent - + elif PY3 and platform['system'] not in ['android_armv7', 'android_x86']: - import libtorrent ### Alfa - + import libtorrent + elif platform['system'] in ['darwin', 'ios_arm']: import imp - + path_list = [dest_path] log('path_list = ' + str(path_list)) fp, pathname, description = imp.find_module('libtorrent', path_list) @@ -140,12 +125,12 @@ try: libtorrent = imp.load_module('libtorrent', fp, pathname, description) finally: if fp: fp.close() - + elif platform['system'] in ['android_armv7', 'android_x86']: try: import imp from ctypes import CDLL - + dest_path=lm.android_workaround(os.path.join(xbmc.translatePath('special://xbmc/'), 'files').replace('/cache/apk/assets', '')) dll_path=os.path.join(dest_path, 'liblibtorrent.so') log('CDLL path = ' + dll_path) @@ -164,8 +149,8 @@ try: except Exception as e: if not PY3: e = unicode(str(e), "utf8", errors="replace").encode("utf8") - config.set_setting("libtorrent_path", "", server="torrent") ### Alfa - config.set_setting("libtorrent_error", str(e), server="torrent") ### Alfa + config.set_setting("libtorrent_path", "", server="torrent") + config.set_setting("libtorrent_error", str(e), server="torrent") log(traceback.format_exc(1)) log('fp = ' + str(fp)) log('pathname = ' + str(pathname)) @@ -174,7 +159,7 @@ try: if fp: fp.close() # If no permission in dest_path we need to go deeper on root! - try: ### Alfa START + try: sys_path = '/data/app/' fp = '' pathname = sys_path @@ -186,7 +171,7 @@ try: dialog = xbmcgui.Dialog() dialog.notification('KoD: '+ config.get_localizad_string(70766), config.get_localizad_string(70767), time=15000) config.set_setting("libtorrent_msg", 'OK', server="torrent") - + from core import scrapertools kodi_app = xbmc.translatePath('special://xbmc') kodi_app = scrapertools.find_single_match(kodi_app, '\/\w+\/\w+\/.*?\/(.*?)\/') @@ -201,10 +186,10 @@ try: output_cmd, error_cmd = p.communicate() log('Comando ROOT: %s' % str(command)) dir_list = output_cmd.split() - + if not dir_list: raise - + for file in dir_list: if kodi_app in file: kodi_dir = file @@ -228,12 +213,12 @@ try: if fp: fp.close() else: import libtorrent - + except Exception as e: log('ERROR Comando ROOT: %s, %s' % (str(command), str(dest_path))) if not PY3: e = unicode(str(e), "utf8", errors="replace").encode("utf8") - log(traceback.format_exc(1)) ### Alfa + log(traceback.format_exc(1)) log('fp = ' + str(fp)) log('pathname = ' + str(pathname)) log('description = ' + str(description)) @@ -241,15 +226,15 @@ try: if fp: fp.close() if libtorrent: - config.set_setting("libtorrent_path", dest_path, server="torrent") ### Alfa - config.set_setting("libtorrent_error", "", server="torrent") ### Alfa + config.set_setting("libtorrent_path", dest_path, server="torrent") + config.set_setting("libtorrent_error", "", server="torrent") log('Imported libtorrent v' + libtorrent.version + ' from "' + dest_path + '"') except Exception as e: if not PY3: e = unicode(str(e), "utf8", errors="replace").encode("utf8") - config.set_setting("libtorrent_path", "", server="torrent") ### Alfa - config.set_setting("libtorrent_error", str(e), server="torrent") ### Alfa + config.set_setting("libtorrent_path", "", server="torrent") + config.set_setting("libtorrent_error", str(e), server="torrent") log('Error importing libtorrent from "' + dest_path + '". Exception: ' + str(e)) if fp: fp.close() diff --git a/platformcode/mct.py b/platformcode/mct.py index 07f203ee..0bdba559 100644 --- a/platformcode/mct.py +++ b/platformcode/mct.py @@ -572,7 +572,7 @@ def play(url, xlistitem={}, is_view=None, subtitle="", password="", item=None): ok = xbmcgui.Dialog().yesno(msg_header, config.get_localized_string(30031), config.get_localized_string(30032)) else: ok = True # -- NO --------------------------------------------- - if not ok: + if ok: is_view=None bkg_user = True dp_cerrado = False @@ -613,7 +613,7 @@ def play(url, xlistitem={}, is_view=None, subtitle="", password="", item=None): dp.close() # Preguntamos si el usuario quiere pasar a backgroung dialog = xbmcgui.Dialog().yesno(msg_header, config.get_localized_string(30031), config.get_localized_string(30032)) - if not dialog: + if dialog: bkg_user = True dp_cerrado = False dp = xbmcgui.DialogProgressBG() diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po index 877d138c..72fdb315 100644 --- a/resources/language/English/strings.po +++ b/resources/language/English/strings.po @@ -134,11 +134,11 @@ msgid "Advanced Options" msgstr "" msgctxt "#30031" -msgid "Delete Download?" +msgid "Continue Download?" msgstr "" msgctxt "#30032" -msgid "Select NO to continue downloading in the background" +msgid "Select YES to continue downloading in the background" msgstr "" msgctxt "#30033" diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index f86b2de5..0f8413ca 100644 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -134,12 +134,12 @@ msgid "Advanced Options" msgstr "Opzioni Avanzate" msgctxt "#30031" -msgid "Delete Download?" -msgstr "Cancellare Download?" +msgid "Continue Download?" +msgstr "Continuare il Download?" msgctxt "#30032" -msgid "Select NO to continue downloading in the background" -msgstr "Seleziona NO per continuare il download in background" +msgid "Select YES to continue downloading in the background" +msgstr "Seleziona SI per continuare il download in background" msgctxt "#30033" msgid "Internal Client" diff --git a/servers/torrent.py b/servers/torrent.py index efbc49ee..62b17c31 100755 --- a/servers/torrent.py +++ b/servers/torrent.py @@ -459,7 +459,7 @@ def bt_client(mediaurl, xlistitem, rar_files, subtitle=None, password=None, item break else: - if platformtools.dialog_yesno(msg_header, config.get_localized_string(30031), config.get_localized_string(30032)): + if not platformtools.dialog_yesno(msg_header, config.get_localized_string(30031), config.get_localized_string(30032)): dp_cerrado = False progreso = platformtools.dialog_progress(msg_header, '') break