diff --git a/addon.xml b/addon.xml index 4cdddb5..96579bc 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index 61be1a8..b73b3e6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,7 @@ -0.6.19c: +0.6.19k: +Added custom library path + +0.6.19c: Added Android x86 0.16.19 0.6.19b: diff --git a/default.py b/default.py index be0b316..8de6e12 100644 --- a/default.py +++ b/default.py @@ -18,5 +18,5 @@ except Exception, e: log('Error importing from get_libtorrent(). Exception: ' + str(e)) -line2='Python-libtorrent %s IMPORTED successfully' % version if sucsess else 'Failed to import python-libtorrent!' +line2='python-libtorrent %s IMPORTED successfully' % version if sucsess else 'Failed to import python-libtorrent!' dialog.ok('Libtorrent','OS:'+p['os']+' arch:'+p['arch'], line2) \ No newline at end of file diff --git a/platform_pulsar.py b/platform_pulsar.py index 5dba602..319dd60 100644 --- a/platform_pulsar.py +++ b/platform_pulsar.py @@ -7,7 +7,7 @@ import sys import os try: - import xbmc + import xbmc, xbmcaddon except: pass @@ -24,28 +24,73 @@ def get_libname(platform): return libname def get_platform(): - ret = { - "arch": sys.maxsize > 2 ** 32 and "x64" or "x86", - } - if xbmc.getCondVisibility("system.platform.android"): - ret["os"] = "android" - if "arm" in os.uname()[4]: - ret["arch"] = "arm" - elif xbmc.getCondVisibility("system.platform.linux"): - ret["os"] = "linux" - if "arm" in os.uname()[4]: - ret["arch"] = "arm" - elif xbmc.getCondVisibility("system.platform.xbox"): - system_platform = "xbox" - ret["arch"] = "" - elif xbmc.getCondVisibility("system.platform.windows"): - ret["os"] = "windows" - elif xbmc.getCondVisibility("system.platform.osx"): - ret["os"] = "darwin" - elif xbmc.getCondVisibility("system.platform.ios"): - ret["os"] = "ios" - ret["arch"] = "arm" + __settings__ = xbmcaddon.Addon(id='script.module.libtorrent') + __version__ = __settings__.getAddonInfo('version') + __plugin__ = __settings__.getAddonInfo('name') + " v." + __version__ + __language__ = __settings__.getLocalizedString + if __settings__.getSetting('custom_system').lower() == "true": + system = int(__settings__.getSetting('set_system')) + print 'USE CUSTOM SYSTEM: '+__language__(1100+system) + + ret={} + + if system==0: + ret["os"] = "windows" + ret["arch"] = "x86" + elif system==1: + ret["os"] = "linux" + ret["arch"] = "x86" + elif system==2: + ret["os"] = "linux" + ret["arch"] = "x64" + elif system==3: + ret["os"] = "linux" + ret["arch"] = "arm" + elif system==4: + ret["os"] = "linux" + ret["arch"] = "arm" + elif system==5: + ret["os"] = "android" + ret["arch"] = "arm" + elif system==6: + ret["os"] = "android" + ret["arch"] = "x86" + elif system==7: + ret["os"] = "darwin" + ret["arch"] = "x64" + elif system==8: + ret["os"] = "ios" + ret["arch"] = "arm" + elif system==9: + ret["os"] = "ios" + ret["arch"] = "arm" + + else: + + ret = { + "arch": sys.maxsize > 2 ** 32 and "x64" or "x86", + } + if xbmc.getCondVisibility("system.platform.android"): + ret["os"] = "android" + if "arm" in os.uname()[4]: + ret["arch"] = "arm" + elif xbmc.getCondVisibility("system.platform.linux"): + ret["os"] = "linux" + if "arm" in os.uname()[4]: + ret["arch"] = "arm" + elif xbmc.getCondVisibility("system.platform.windows"): + ret["os"] = "windows" + elif xbmc.getCondVisibility("system.platform.osx"): + ret["os"] = "darwin" + elif xbmc.getCondVisibility("system.platform.ios"): + ret["os"] = "ios" + ret["arch"] = "arm" + + ret=get_system(ret) + return ret + +def get_system(ret): ret["system"] = '' ret["message"] = ['', ''] diff --git a/python_libtorrent/__init__.py b/python_libtorrent/__init__.py index 23bdaba..27ca0e6 100644 --- a/python_libtorrent/__init__.py +++ b/python_libtorrent/__init__.py @@ -12,11 +12,20 @@ import os __settings__ = xbmcaddon.Addon(id='script.module.libtorrent') __version__ = __settings__.getAddonInfo('version') __plugin__ = __settings__.getAddonInfo('name') + " v." + __version__ +__language__ = __settings__.getLocalizedString libtorrent=None platform = get_platform() -dirname = os.path.join(xbmc.translatePath('special://temp'), 'xbmcup', 'script.module.libtorrent', - 'python_libtorrent') +set_dirname=__settings__.getSetting('dirname') +log('set_dirname:' +str(set_dirname)) +if getSettingAsBool('custom_dirname') and set_dirname: + + dirname=set_dirname +else: + dirname = os.path.join(xbmc.translatePath('special://temp'), 'xbmcup', 'script.module.libtorrent', + 'python_libtorrent') + +log('dirname:' +str(dirname)) dest_path = os.path.join(dirname, platform['system']) sys.path.insert(0, dest_path) diff --git a/python_libtorrent/functions.py b/python_libtorrent/functions.py index 4adea26..7a990b3 100644 --- a/python_libtorrent/functions.py +++ b/python_libtorrent/functions.py @@ -9,8 +9,7 @@ __version__ = __settings__.getAddonInfo('version') __plugin__ = __settings__.getAddonInfo('name') + " v." + __version__ __icon__=os.path.join(xbmc.translatePath('special://home'), 'addons', 'script.module.libtorrent', 'icon.png') -#dirname = os.path.join(xbmc.translatePath('special://home'), 'addons', 'script.module.libtorrent') -#sys.path.insert(0, dirname) +__language__ = __settings__.getLocalizedString from platform_pulsar import get_platform, get_libname @@ -18,7 +17,7 @@ class DownloaderClass(): def __init__(self, dest_path): self.dest_path = dest_path self.platform = get_platform() - tempdir(self.platform) + tempdir(self.dest_path) def tools_download(self): for libname in get_libname(self.platform): @@ -47,14 +46,13 @@ def log(msg): except: xbmc.log("### [%s]: %s" % (__plugin__,'ERROR LOG',), level=xbmc.LOGNOTICE ) -def tempdir(platform): - dirname=xbmc.translatePath('special://temp') - for subdir in ('xbmcup', 'script.module.libtorrent', 'python_libtorrent', platform['system']): - dirname = os.path.join(dirname, subdir) - if not xbmcvfs.exists(dirname): - xbmcvfs.mkdir(dirname) +def tempdir(dirname): + xbmcvfs.mkdirs(dirname) return dirname +def getSettingAsBool(setting): + return __settings__.getSetting(setting).lower() == "true" + class LibraryManager(): def __init__(self, dest_path): self.dest_path = dest_path diff --git a/resources/language/english/strings.xml b/resources/language/english/strings.xml index e2903a0..658b13d 100644 --- a/resources/language/english/strings.xml +++ b/resources/language/english/strings.xml @@ -1,19 +1,23 @@  - Initialization - Connecting - Waiting - Sending Data - Receiving link - Playing - Cancel + Settings + Use custom path to library + Custom path to library + Disable automatic system detection + Use library for + + - Pre-buffering - Buffering - Downloading - Verifying data - TS Engine Idling - TS Engine Waiting + Windows 32-bit, 64-bit + Linux 32-bit + Linux 64-bit (not ready) + Linux ARM v7 (RPi 2, not ready) + Linux ARM v6 (RPi, not ready) + Android ARM v7 + Android 32-bit + OS X + Apple TV2 (not ready) + iOS (not ready) Seeds: %s Speed: %s Seconds %s' diff --git a/resources/language/russian/strings.xml b/resources/language/russian/strings.xml index 072603b..a64e567 100644 --- a/resources/language/russian/strings.xml +++ b/resources/language/russian/strings.xml @@ -1,19 +1,12 @@ - Инициализация - Соединение - Жду ответа - Передаю данные - Получаю ссылку - Начинаю воспроизведение - Отмена - - Предварительная буферизация - Буферизация - Скачивание - Проверка - TS Engine бездействует - TS Engine ожидает + Настройки + Изменить путь к библиотеке + Путь к библиотеке + Отключить автоматическое определение системы + Библиотека для + + Пиры:%s Скорость:%s Секунд %ы' diff --git a/resources/settings.xml b/resources/settings.xml index d36934e..523d688 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -1,5 +1,9 @@ - + + + + +