custom path & system
This commit is contained in:
		
							parent
							
								
									07133b8891
								
							
						
					
					
						commit
						64f11899a2
					
				@ -1,5 +1,5 @@
 | 
				
			|||||||
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
 | 
					<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
 | 
				
			||||||
<addon id='script.module.libtorrent' version='0.6.19i' name='LibTorrent' provider-name='DiMartino, srg70, RussakHH'>
 | 
					<addon id='script.module.libtorrent' version='0.6.19k' name='LibTorrent' provider-name='DiMartino, srg70, RussakHH'>
 | 
				
			||||||
  <requires>
 | 
					  <requires>
 | 
				
			||||||
    <import addon='xbmc.python' version='2.1.0'/>
 | 
					    <import addon='xbmc.python' version='2.1.0'/>
 | 
				
			||||||
  </requires>
 | 
					  </requires>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,7 @@
 | 
				
			|||||||
0.6.19c:
 | 
					0.6.19k:
 | 
				
			||||||
 | 
					Added custom library path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					0.6.19c:
 | 
				
			||||||
Added Android x86 0.16.19
 | 
					Added Android x86 0.16.19
 | 
				
			||||||
 | 
					
 | 
				
			||||||
0.6.19b:
 | 
					0.6.19b:
 | 
				
			||||||
 | 
				
			|||||||
@ -18,5 +18,5 @@ except Exception, e:
 | 
				
			|||||||
    log('Error importing from get_libtorrent(). Exception: ' + str(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)
 | 
					dialog.ok('Libtorrent','OS:'+p['os']+' arch:'+p['arch'], line2)
 | 
				
			||||||
@ -7,7 +7,7 @@
 | 
				
			|||||||
import sys
 | 
					import sys
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
try:
 | 
					try:
 | 
				
			||||||
    import xbmc
 | 
					    import xbmc, xbmcaddon
 | 
				
			||||||
except:
 | 
					except:
 | 
				
			||||||
    pass
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -24,6 +24,50 @@ def get_libname(platform):
 | 
				
			|||||||
    return libname
 | 
					    return libname
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_platform():
 | 
					def get_platform():
 | 
				
			||||||
 | 
					    __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 = {
 | 
					        ret = {
 | 
				
			||||||
            "arch": sys.maxsize > 2 ** 32 and "x64" or "x86",
 | 
					            "arch": sys.maxsize > 2 ** 32 and "x64" or "x86",
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -35,9 +79,6 @@ def get_platform():
 | 
				
			|||||||
            ret["os"] = "linux"
 | 
					            ret["os"] = "linux"
 | 
				
			||||||
            if "arm" in os.uname()[4]:
 | 
					            if "arm" in os.uname()[4]:
 | 
				
			||||||
                ret["arch"] = "arm"
 | 
					                ret["arch"] = "arm"
 | 
				
			||||||
    elif xbmc.getCondVisibility("system.platform.xbox"):
 | 
					 | 
				
			||||||
        system_platform = "xbox"
 | 
					 | 
				
			||||||
        ret["arch"] = ""
 | 
					 | 
				
			||||||
        elif xbmc.getCondVisibility("system.platform.windows"):
 | 
					        elif xbmc.getCondVisibility("system.platform.windows"):
 | 
				
			||||||
            ret["os"] = "windows"
 | 
					            ret["os"] = "windows"
 | 
				
			||||||
        elif xbmc.getCondVisibility("system.platform.osx"):
 | 
					        elif xbmc.getCondVisibility("system.platform.osx"):
 | 
				
			||||||
@ -46,6 +87,10 @@ def get_platform():
 | 
				
			|||||||
            ret["os"] = "ios"
 | 
					            ret["os"] = "ios"
 | 
				
			||||||
            ret["arch"] = "arm"
 | 
					            ret["arch"] = "arm"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ret=get_system(ret)
 | 
				
			||||||
 | 
					    return ret
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def get_system(ret):
 | 
				
			||||||
    ret["system"] = ''
 | 
					    ret["system"] = ''
 | 
				
			||||||
    ret["message"] = ['', '']
 | 
					    ret["message"] = ['', '']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -12,11 +12,20 @@ import os
 | 
				
			|||||||
__settings__ = xbmcaddon.Addon(id='script.module.libtorrent')
 | 
					__settings__ = xbmcaddon.Addon(id='script.module.libtorrent')
 | 
				
			||||||
__version__ = __settings__.getAddonInfo('version')
 | 
					__version__ = __settings__.getAddonInfo('version')
 | 
				
			||||||
__plugin__ = __settings__.getAddonInfo('name') + " v." + __version__
 | 
					__plugin__ = __settings__.getAddonInfo('name') + " v." + __version__
 | 
				
			||||||
 | 
					__language__ = __settings__.getLocalizedString
 | 
				
			||||||
 | 
					
 | 
				
			||||||
libtorrent=None
 | 
					libtorrent=None
 | 
				
			||||||
platform = get_platform()
 | 
					platform = get_platform()
 | 
				
			||||||
 | 
					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',
 | 
					    dirname = os.path.join(xbmc.translatePath('special://temp'), 'xbmcup', 'script.module.libtorrent',
 | 
				
			||||||
                           'python_libtorrent')
 | 
					                           'python_libtorrent')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					log('dirname:' +str(dirname))
 | 
				
			||||||
dest_path = os.path.join(dirname, platform['system'])
 | 
					dest_path = os.path.join(dirname, platform['system'])
 | 
				
			||||||
sys.path.insert(0, dest_path)
 | 
					sys.path.insert(0, dest_path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -9,8 +9,7 @@ __version__ = __settings__.getAddonInfo('version')
 | 
				
			|||||||
__plugin__ = __settings__.getAddonInfo('name') + " v." + __version__
 | 
					__plugin__ = __settings__.getAddonInfo('name') + " v." + __version__
 | 
				
			||||||
__icon__=os.path.join(xbmc.translatePath('special://home'), 'addons',
 | 
					__icon__=os.path.join(xbmc.translatePath('special://home'), 'addons',
 | 
				
			||||||
                                   'script.module.libtorrent', 'icon.png')
 | 
					                                   'script.module.libtorrent', 'icon.png')
 | 
				
			||||||
#dirname = os.path.join(xbmc.translatePath('special://home'), 'addons', 'script.module.libtorrent')
 | 
					__language__ = __settings__.getLocalizedString
 | 
				
			||||||
#sys.path.insert(0, dirname)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
from platform_pulsar import get_platform, get_libname
 | 
					from platform_pulsar import get_platform, get_libname
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -18,7 +17,7 @@ class DownloaderClass():
 | 
				
			|||||||
    def __init__(self, dest_path):
 | 
					    def __init__(self, dest_path):
 | 
				
			||||||
        self.dest_path = dest_path
 | 
					        self.dest_path = dest_path
 | 
				
			||||||
        self.platform = get_platform()
 | 
					        self.platform = get_platform()
 | 
				
			||||||
        tempdir(self.platform)
 | 
					        tempdir(self.dest_path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def tools_download(self):
 | 
					    def tools_download(self):
 | 
				
			||||||
        for libname in get_libname(self.platform):
 | 
					        for libname in get_libname(self.platform):
 | 
				
			||||||
@ -47,14 +46,13 @@ def log(msg):
 | 
				
			|||||||
    except:
 | 
					    except:
 | 
				
			||||||
        xbmc.log("### [%s]: %s" % (__plugin__,'ERROR LOG',), level=xbmc.LOGNOTICE )
 | 
					        xbmc.log("### [%s]: %s" % (__plugin__,'ERROR LOG',), level=xbmc.LOGNOTICE )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def tempdir(platform):
 | 
					def tempdir(dirname):
 | 
				
			||||||
    dirname=xbmc.translatePath('special://temp')
 | 
					    xbmcvfs.mkdirs(dirname)
 | 
				
			||||||
    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)
 | 
					 | 
				
			||||||
    return dirname
 | 
					    return dirname
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def getSettingAsBool(setting):
 | 
				
			||||||
 | 
					    return __settings__.getSetting(setting).lower() == "true"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class LibraryManager():
 | 
					class LibraryManager():
 | 
				
			||||||
    def __init__(self, dest_path):
 | 
					    def __init__(self, dest_path):
 | 
				
			||||||
        self.dest_path = dest_path
 | 
					        self.dest_path = dest_path
 | 
				
			||||||
 | 
				
			|||||||
@ -1,19 +1,23 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 | 
					<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 | 
				
			||||||
<strings>
 | 
					<strings>
 | 
				
			||||||
    <string id="1000">Initialization</string>
 | 
					    <string id="1000">Settings</string>
 | 
				
			||||||
	<string id="1001">Connecting</string>
 | 
						<string id="1001">Use custom path to library</string>
 | 
				
			||||||
	<string id="1002">Waiting</string>
 | 
						<string id="1002">Custom path to library</string>
 | 
				
			||||||
	<string id="1003">Sending Data</string>
 | 
						<string id="1003">Disable automatic system detection</string>
 | 
				
			||||||
	<string id="1004">Receiving link</string>
 | 
						<string id="1004">Use library for</string>
 | 
				
			||||||
	<string id="1005">Playing</string>
 | 
						<string id="1005"></string>
 | 
				
			||||||
	<string id="1006">Cancel</string>
 | 
						<string id="1006"></string>
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	<string id="1100">Pre-buffering</string>
 | 
						<string id="1100">Windows 32-bit, 64-bit</string>
 | 
				
			||||||
	<string id="1101">Buffering</string>
 | 
						<string id="1101">Linux 32-bit</string>
 | 
				
			||||||
	<string id="1102">Downloading</string>
 | 
						<string id="1102">Linux 64-bit (not ready)</string>
 | 
				
			||||||
	<string id="1103">Verifying data</string>
 | 
						<string id="1103">Linux ARM v7 (RPi 2, not ready)</string>
 | 
				
			||||||
	<string id="1104">TS Engine Idling</string>
 | 
						<string id="1104">Linux ARM v6 (RPi, not ready)</string>
 | 
				
			||||||
	<string id="1105">TS Engine Waiting</string>
 | 
						<string id="1105">Android ARM v7</string>
 | 
				
			||||||
 | 
						<string id="1106">Android 32-bit</string>
 | 
				
			||||||
 | 
						<string id="1107">OS X</string>
 | 
				
			||||||
 | 
						<string id="1108">Apple TV2 (not ready)</string>
 | 
				
			||||||
 | 
						<string id="1109">iOS (not ready)</string>
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	<string id="1150">Seeds: %s Speed: %s</string>
 | 
						<string id="1150">Seeds: %s Speed: %s</string>
 | 
				
			||||||
	<string id="1151">Seconds %s'</string>
 | 
						<string id="1151">Seconds %s'</string>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,19 +1,12 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 | 
					<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 | 
				
			||||||
<strings>
 | 
					<strings>
 | 
				
			||||||
    <string id="1000">Инициализация</string>
 | 
					    <string id="1000">Настройки</string>
 | 
				
			||||||
	<string id="1001">Соединение</string>
 | 
						<string id="1001">Изменить путь к библиотеке</string>
 | 
				
			||||||
	<string id="1002">Жду ответа</string>
 | 
						<string id="1002">Путь к библиотеке</string>
 | 
				
			||||||
	<string id="1003">Передаю данные</string>
 | 
						<string id="1003">Отключить автоматическое определение системы</string>
 | 
				
			||||||
	<string id="1004">Получаю ссылку</string>
 | 
						<string id="1004">Библиотека для</string>
 | 
				
			||||||
	<string id="1005">Начинаю воспроизведение</string>
 | 
						<string id="1005"></string>
 | 
				
			||||||
	<string id="1006">Отмена</string>
 | 
						<string id="1006"></string>
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	<string id="1100">Предварительная буферизация</string>
 | 
					 | 
				
			||||||
	<string id="1101">Буферизация</string>
 | 
					 | 
				
			||||||
	<string id="1102">Скачивание</string>
 | 
					 | 
				
			||||||
	<string id="1103">Проверка</string>
 | 
					 | 
				
			||||||
	<string id="1104">TS Engine бездействует</string>
 | 
					 | 
				
			||||||
	<string id="1105">TS Engine ожидает</string>
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	<string id="1150">Пиры:%s Скорость:%s</string>
 | 
						<string id="1150">Пиры:%s Скорость:%s</string>
 | 
				
			||||||
	<string id="1151">Секунд %ы'</string>
 | 
						<string id="1151">Секунд %ы'</string>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,9 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 | 
					<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 | 
				
			||||||
<settings>
 | 
					<settings>
 | 
				
			||||||
<category label="Настройки">
 | 
					 <category label="1000">
 | 
				
			||||||
 | 
					  <setting id="custom_dirname" type="bool" label="1001" default="false" />
 | 
				
			||||||
 | 
					  <setting id="dirname" type="folder" label="1002" enable="eq(-1,true)" />
 | 
				
			||||||
 | 
					  <setting id="custom_system" type="bool" label="1003" default="false" />
 | 
				
			||||||
 | 
					  <setting id="set_system"  type="enum" label="1004" enable="eq(-1,true)" default="0" lvalues="1100|1101|1102|1103|1104|1105|1106|1107|1108|1109"/>
 | 
				
			||||||
 </category>
 | 
					 </category>
 | 
				
			||||||
</settings>
 | 
					</settings>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user