Supporto Torrent
This commit is contained in:
260
lib/python_libtorrent/python_libtorrent/__init__.py
Normal file
260
lib/python_libtorrent/python_libtorrent/__init__.py
Normal file
@@ -0,0 +1,260 @@
|
||||
#-*- coding: utf-8 -*-
|
||||
'''
|
||||
python-libtorrent for Kodi (script.module.libtorrent)
|
||||
Copyright (C) 2015-2016 DiMartino, srg70, RussakHH, aisman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
'''
|
||||
from __future__ import absolute_import
|
||||
#from builtins import str
|
||||
import sys
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
from .functions import *
|
||||
import xbmc, xbmcaddon
|
||||
import sys
|
||||
import os
|
||||
import traceback ### Alfa
|
||||
|
||||
|
||||
#__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.alfa') ### Alfa
|
||||
__version__ = '1.1.17' ### Alfa
|
||||
__plugin__ = "python-libtorrent v.1.1.7" ### Alfa
|
||||
#__language__ = __settings__.getLocalizedString ### Alfa
|
||||
__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
|
||||
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
|
||||
|
||||
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
|
||||
default_path = versions[-1]
|
||||
#set_version = int(__settings__.getSetting('set_version')) ### Alfa
|
||||
set_version = 0 ### Alfa
|
||||
if getSettingAsBool('custom_version'):
|
||||
log('set_version:' +str(set_version)+' '+versions[set_version])
|
||||
platform['version'] = versions[set_version]
|
||||
else:
|
||||
platform['version'] = default_path
|
||||
|
||||
sizefile_path = os.path.join(__root__, platform['system'], platform['version'])
|
||||
if not os.path.exists(sizefile_path):
|
||||
log('set_version: no sizefile at %s back to default %s' % (sizefile_path, default_path))
|
||||
platform['version'] = default_path
|
||||
sizefile_path = os.path.join(__root__, platform['system'], platform['version'])
|
||||
if not os.path.exists(sizefile_path):
|
||||
log('set_version: no default at %s searching for any version' % sizefile_path)
|
||||
try:
|
||||
versions = sorted(os.listdir(os.path.join(__root__, platform['system'])))
|
||||
except:
|
||||
versions = []
|
||||
for ver in versions:
|
||||
if not os.path.isdir(os.path.join(__root__, platform['system'], ver)):
|
||||
versions.remove(ver)
|
||||
|
||||
if len(versions)>0:
|
||||
platform['version'] = versions[-1]
|
||||
log('set_version: chose %s out of %s' % (platform['version'], str(versions)))
|
||||
else:
|
||||
e = 'die because the folder is empty'
|
||||
log(e)
|
||||
raise Exception(e)
|
||||
dest_path = os.path.join(dirname, platform['system'], platform['version'])
|
||||
sys.path.insert(0, dest_path)
|
||||
|
||||
lm=LibraryManager(dest_path, platform)
|
||||
if not lm.check_exist():
|
||||
ok=lm.download()
|
||||
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
|
||||
log('os: '+str(os.uname()))
|
||||
log_text = 'ucs4' if sys.maxunicode > 65536 else 'ucs2'
|
||||
log_text += ' x64' if sys.maxsize > 2147483647 else ' x86'
|
||||
log(log_text)
|
||||
|
||||
try:
|
||||
fp = ''
|
||||
pathname = ''
|
||||
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
|
||||
import libtorrent
|
||||
|
||||
elif PY3 and platform['system'] not in ['android_armv7', 'android_x86']:
|
||||
import libtorrent ### Alfa
|
||||
|
||||
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)
|
||||
log('fp = ' + str(fp))
|
||||
log('pathname = ' + str(pathname))
|
||||
log('description = ' + str(description))
|
||||
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)
|
||||
liblibtorrent=CDLL(dll_path)
|
||||
log('CDLL = ' + str(liblibtorrent))
|
||||
path_list = [dest_path]
|
||||
log('path_list = ' + str(path_list))
|
||||
fp, pathname, description = imp.find_module('libtorrent', path_list)
|
||||
log('fp = ' + str(fp))
|
||||
log('pathname = ' + str(pathname))
|
||||
log('description = ' + str(description))
|
||||
try:
|
||||
libtorrent = imp.load_module('libtorrent', fp, pathname, description)
|
||||
finally:
|
||||
if fp: fp.close()
|
||||
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
|
||||
log(traceback.format_exc(1))
|
||||
log('fp = ' + str(fp))
|
||||
log('pathname = ' + str(pathname))
|
||||
log('description = ' + str(description))
|
||||
log('Error importing libtorrent from "' + dest_path + '". Exception: ' + str(e))
|
||||
if fp: fp.close()
|
||||
|
||||
# If no permission in dest_path we need to go deeper on root!
|
||||
try: ### Alfa START
|
||||
sys_path = '/data/app/'
|
||||
fp = ''
|
||||
pathname = sys_path
|
||||
dest_path = sys_path
|
||||
description = ''
|
||||
libtorrent = ''
|
||||
LIBTORRENT_MSG = config.get_setting("libtorrent_msg", server="torrent", default='')
|
||||
if not LIBTORRENT_MSG:
|
||||
dialog = xbmcgui.Dialog()
|
||||
dialog.notification('ALFA: Instalando Cliente Torrent interno', \
|
||||
'Puede solicitarle permisos de Superusuario', time=15000)
|
||||
log('### ALFA: Notificación enviada: Instalando Cliente Torrent interno')
|
||||
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+\/.*?\/(.*?)\/')
|
||||
kodi_dir = '%s-1' % kodi_app
|
||||
dir_list = ''
|
||||
try:
|
||||
dir_list = os.listdir(sys_path).split()
|
||||
except:
|
||||
import subprocess
|
||||
command = ['su', '-c', 'ls', sys_path]
|
||||
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
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
|
||||
break
|
||||
|
||||
bits = sys.maxsize > 2 ** 32 and "64" or ""
|
||||
dest_path = os.path.join(sys_path, kodi_dir, 'lib', platform['arch'] + bits)
|
||||
dest_path=lm.android_workaround(new_dest_path=dest_path)
|
||||
sys.path.insert(0, dest_path)
|
||||
dll_path=os.path.join(dest_path, 'liblibtorrent.so')
|
||||
log('NEW CDLL path = ' + dll_path)
|
||||
if not PY3:
|
||||
liblibtorrent=CDLL(dll_path)
|
||||
log('CDLL = ' + str(liblibtorrent))
|
||||
path_list = [dest_path]
|
||||
log('path_list = ' + str(path_list))
|
||||
fp, pathname, description = imp.find_module('libtorrent', path_list)
|
||||
try:
|
||||
libtorrent = imp.load_module('libtorrent', fp, pathname, description)
|
||||
finally:
|
||||
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('fp = ' + str(fp))
|
||||
log('pathname = ' + str(pathname))
|
||||
log('description = ' + str(description))
|
||||
log('Error importing libtorrent from "' + dest_path + '". Exception: ' + str(e))
|
||||
if fp: fp.close()
|
||||
|
||||
if libtorrent:
|
||||
config.set_setting("libtorrent_path", dest_path, server="torrent") ### Alfa
|
||||
config.set_setting("libtorrent_error", "", server="torrent") ### Alfa
|
||||
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
|
||||
log('Error importing libtorrent from "' + dest_path + '". Exception: ' + str(e))
|
||||
if fp: fp.close()
|
||||
|
||||
|
||||
def get_libtorrent():
|
||||
return libtorrent
|
||||
187
lib/python_libtorrent/python_libtorrent/functions.py
Normal file
187
lib/python_libtorrent/python_libtorrent/functions.py
Normal file
@@ -0,0 +1,187 @@
|
||||
#-*- coding: utf-8 -*-
|
||||
'''
|
||||
python-libtorrent for Kodi (script.module.libtorrent)
|
||||
Copyright (C) 2015-2016 DiMartino, srg70, RussakHH, aisman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
'''
|
||||
from __future__ import absolute_import
|
||||
#from builtins import str
|
||||
import sys
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
from builtins import object
|
||||
|
||||
import os
|
||||
import xbmc, xbmcgui, xbmcaddon
|
||||
|
||||
from .net import HTTP
|
||||
from core import filetools ### Alfa
|
||||
|
||||
__libbaseurl__ = "https://github.com/DiMartinoXBMC/script.module.libtorrent/raw/master/python_libtorrent"
|
||||
#__settings__ = xbmcaddon.Addon(id='script.module.libtorrent')
|
||||
#__version__ = __settings__.getAddonInfo('version')
|
||||
#__plugin__ = __settings__.getAddonInfo('name') + " v." + __version__
|
||||
#__icon__=os.path.join(xbmc.translatePath('special://home'), 'addons',
|
||||
# 'script.module.libtorrent', 'icon.png')
|
||||
#__settings__ = xbmcaddon.Addon(id='plugin.video.alfa') ### Alfa
|
||||
__version__ = '1.1.17' ### Alfa
|
||||
__plugin__ = "python-libtorrent v.1.1.7" ### Alfa
|
||||
__icon__=os.path.join(xbmc.translatePath('special://home'), 'addons',
|
||||
'plugin.video.alfa', 'icon.png') ### Alfa
|
||||
#__language__ = __settings__.getLocalizedString ### Alfa
|
||||
|
||||
#from python_libtorrent.platform_pulsar import get_platform, get_libname ### Alfa
|
||||
from lib.python_libtorrent.python_libtorrent.platform_pulsar import get_platform, get_libname ### Alfa
|
||||
|
||||
def log(msg):
|
||||
try:
|
||||
xbmc.log("### [%s]: %s" % (__plugin__,msg,), level=xbmc.LOGNOTICE )
|
||||
except UnicodeEncodeError:
|
||||
xbmc.log("### [%s]: %s" % (__plugin__,msg.encode("utf-8", "ignore"),), level=xbmc.LOGNOTICE )
|
||||
except:
|
||||
xbmc.log("### [%s]: %s" % (__plugin__,'ERROR LOG',), level=xbmc.LOGNOTICE )
|
||||
|
||||
def getSettingAsBool(setting):
|
||||
__settings__ = xbmcaddon.Addon(id='plugin.video.alfa') ### Alfa
|
||||
return __settings__.getSetting(setting).lower() == "true"
|
||||
|
||||
class LibraryManager(object):
|
||||
def __init__(self, dest_path, platform):
|
||||
self.dest_path = dest_path
|
||||
self.platform = platform
|
||||
self.root=os.path.dirname(os.path.dirname(__file__))
|
||||
ver1, ver2, ver3 = platform['version'].split('.') ### Alfa: resto método
|
||||
try:
|
||||
ver1 = int(ver1)
|
||||
ver2 = int(ver2)
|
||||
except:
|
||||
pass
|
||||
if ver1 >= 1 and ver2 >= 2:
|
||||
global __libbaseurl__
|
||||
#__libbaseurl__ = 'https://github.com/alfa-addon/alfa-repo/raw/master/downloads/libtorrent'
|
||||
__libbaseurl__ = 'https://bitbucket.org/alfa_addon/alfa-repo/raw/master/downloads/libtorrent'
|
||||
|
||||
def check_exist(self):
|
||||
for libname in get_libname(self.platform):
|
||||
if not filetools.exists(os.path.join(self.dest_path,libname)):
|
||||
return False
|
||||
return True
|
||||
|
||||
def check_update(self):
|
||||
need_update=False
|
||||
for libname in get_libname(self.platform):
|
||||
if libname!='liblibtorrent.so':
|
||||
self.libpath = os.path.join(self.dest_path, libname)
|
||||
self.sizepath=os.path.join(self.root, self.platform['system'], self.platform['version'], libname+'.size.txt')
|
||||
size=str(os.path.getsize(self.libpath))
|
||||
size_old=open( self.sizepath, "r" ).read()
|
||||
if size_old!=size:
|
||||
need_update=True
|
||||
return need_update
|
||||
|
||||
def update(self):
|
||||
if self.check_update():
|
||||
for libname in get_libname(self.platform):
|
||||
self.libpath = os.path.join(self.dest_path, libname)
|
||||
filetools.remove(self.libpath)
|
||||
self.download()
|
||||
|
||||
def download(self):
|
||||
__settings__ = xbmcaddon.Addon(id='plugin.video.alfa') ### Alfa
|
||||
filetools.mkdir(self.dest_path)
|
||||
for libname in get_libname(self.platform):
|
||||
dest = os.path.join(self.dest_path, libname)
|
||||
log("try to fetch %s" % libname)
|
||||
url = "%s/%s/%s/%s.zip" % (__libbaseurl__, self.platform['system'], self.platform['version'], libname)
|
||||
if libname!='liblibtorrent.so':
|
||||
try:
|
||||
self.http = HTTP()
|
||||
self.http.fetch(url, download=dest + ".zip", progress=False) ### Alfa
|
||||
log("%s -> %s" % (url, dest))
|
||||
xbmc.executebuiltin('XBMC.Extract("%s.zip","%s")' % (dest, self.dest_path), True)
|
||||
filetools.remove(dest + ".zip")
|
||||
except:
|
||||
text = 'Failed download %s!' % libname
|
||||
xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__plugin__,text,750,__icon__))
|
||||
else:
|
||||
filetools.copy(os.path.join(self.dest_path, 'libtorrent.so'), dest, silent=True) ### Alfa
|
||||
dest_alfa = os.path.join(xbmc.translatePath(__settings__.getAddonInfo('Path')), \
|
||||
'lib', libname) ### Alfa
|
||||
filetools.copy(dest, dest_alfa, silent=True) ### Alfa
|
||||
dest_alfa = os.path.join(xbmc.translatePath(__settings__.getAddonInfo('Profile')), \
|
||||
'custom_code', 'lib', libname) ### Alfa
|
||||
filetools.copy(dest, dest_alfa, silent=True) ### Alfa
|
||||
return True
|
||||
|
||||
def android_workaround(self, new_dest_path): ### Alfa (entera)
|
||||
import subprocess
|
||||
|
||||
for libname in get_libname(self.platform):
|
||||
libpath=os.path.join(self.dest_path, libname)
|
||||
size=str(os.path.getsize(libpath))
|
||||
new_libpath=os.path.join(new_dest_path, libname)
|
||||
|
||||
if filetools.exists(new_libpath):
|
||||
new_size=str(os.path.getsize(new_libpath))
|
||||
if size != new_size:
|
||||
filetools.remove(new_libpath)
|
||||
if filetools.exists(new_libpath):
|
||||
try:
|
||||
command = ['su', '-c', 'rm', '%s' % new_libpath]
|
||||
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output_cmd, error_cmd = p.communicate()
|
||||
log('Comando ROOT: %s' % str(command))
|
||||
except:
|
||||
log('Sin PERMISOS ROOT: %s' % str(command))
|
||||
|
||||
if not filetools.exists(new_libpath):
|
||||
log('Deleted: (%s) %s -> (%s) %s' %(size, libpath, new_size, new_libpath))
|
||||
|
||||
if not filetools.exists(new_libpath):
|
||||
filetools.copy(libpath, new_libpath, silent=True) ### ALFA
|
||||
log('Copying... %s -> %s' %(libpath, new_libpath))
|
||||
|
||||
if not filetools.exists(new_libpath):
|
||||
try:
|
||||
command = ['su', '-c', 'cp', '%s' % libpath, '%s' % new_libpath]
|
||||
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output_cmd, error_cmd = p.communicate()
|
||||
log('Comando ROOT: %s' % str(command))
|
||||
|
||||
command = ['su', '-c', 'chmod', '777', '%s' % new_libpath]
|
||||
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output_cmd, error_cmd = p.communicate()
|
||||
log('Comando ROOT: %s' % str(command))
|
||||
except:
|
||||
log('Sin PERMISOS ROOT: %s' % str(command))
|
||||
|
||||
if not filetools.exists(new_libpath):
|
||||
log('ROOT Copy Failed!')
|
||||
|
||||
else:
|
||||
command = ['chmod', '777', '%s' % new_libpath]
|
||||
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output_cmd, error_cmd = p.communicate()
|
||||
log('Comando: %s' % str(command))
|
||||
else:
|
||||
log('Module exists. Not copied... %s' % new_libpath) ### ALFA
|
||||
|
||||
return new_dest_path
|
||||
332
lib/python_libtorrent/python_libtorrent/net.py
Normal file
332
lib/python_libtorrent/python_libtorrent/net.py
Normal file
@@ -0,0 +1,332 @@
|
||||
#-*- coding: utf-8 -*-
|
||||
'''
|
||||
python-libtorrent for Kodi (script.module.libtorrent)
|
||||
Copyright (C) 2015-2016 DiMartino, srg70, RussakHH, aisman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
'''
|
||||
from __future__ import division
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
#from builtins import str
|
||||
import sys
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
from builtins import object
|
||||
from past.utils import old_div
|
||||
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
# import http.cookiejar
|
||||
import future.backports.http.cookiejar as http_cookiejar
|
||||
import base64
|
||||
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
#import xbmcvfs ### Alfa
|
||||
|
||||
RE = {
|
||||
'content-disposition': re.compile('attachment;\sfilename="*([^"\s]+)"|\s')
|
||||
}
|
||||
|
||||
# ################################
|
||||
#
|
||||
# HTTP
|
||||
#
|
||||
# ################################
|
||||
|
||||
class HTTP(object):
|
||||
def __init__(self):
|
||||
#self._dirname = xbmc.translatePath('special://temp') ### Alfa
|
||||
#for subdir in ('xbmcup', 'script.module.libtorrent'): ### Alfa
|
||||
self._dirname = os.path.dirname(os.path.dirname(__file__)) ### Alfa
|
||||
#for subdir in ('lib', 'python_libtorrent'): ### Alfa
|
||||
# self._dirname = os.path.join(self._dirname, subdir) ### Alfa
|
||||
# if not xbmcvfs.exists(self._dirname): ### Alfa
|
||||
# xbmcvfs.mkdir(self._dirname) ### Alfa
|
||||
|
||||
def fetch(self, request, **kwargs):
|
||||
self.con, self.fd, self.progress, self.cookies, self.request = None, None, None, None, request
|
||||
|
||||
if not isinstance(self.request, HTTPRequest):
|
||||
self.request = HTTPRequest(url=self.request, **kwargs)
|
||||
|
||||
self.response = HTTPResponse(self.request)
|
||||
|
||||
xbmc.log('XBMCup: HTTP: request: ' + str(self.request), xbmc.LOGDEBUG)
|
||||
|
||||
try:
|
||||
self._opener()
|
||||
self._fetch()
|
||||
except Exception as e:
|
||||
xbmc.log('XBMCup: HTTP: ' + str(e), xbmc.LOGERROR)
|
||||
if isinstance(e, urllib.error.HTTPError):
|
||||
self.response.code = e.code
|
||||
self.response.error = e
|
||||
else:
|
||||
self.response.code = 200
|
||||
|
||||
if self.fd:
|
||||
self.fd.close()
|
||||
self.fd = None
|
||||
|
||||
if self.con:
|
||||
self.con.close()
|
||||
self.con = None
|
||||
|
||||
if self.progress:
|
||||
self.progress.close()
|
||||
self.progress = None
|
||||
|
||||
self.response.time = time.time() - self.response.time
|
||||
|
||||
xbmc.log('XBMCup: HTTP: response: ' + str(self.response), xbmc.LOGDEBUG)
|
||||
|
||||
return self.response
|
||||
|
||||
def _opener(self):
|
||||
|
||||
build = [urllib.request.HTTPHandler()]
|
||||
|
||||
if self.request.redirect:
|
||||
build.append(urllib.request.HTTPRedirectHandler())
|
||||
|
||||
if self.request.proxy_host and self.request.proxy_port:
|
||||
build.append(urllib.request.ProxyHandler(
|
||||
{self.request.proxy_protocol: self.request.proxy_host + ':' + str(self.request.proxy_port)}))
|
||||
|
||||
if self.request.proxy_username:
|
||||
proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()
|
||||
proxy_auth_handler.add_password('realm', 'uri', self.request.proxy_username,
|
||||
self.request.proxy_password)
|
||||
build.append(proxy_auth_handler)
|
||||
|
||||
if self.request.cookies:
|
||||
self.request.cookies = os.path.join(self._dirname, self.request.cookies)
|
||||
self.cookies = http_cookiejar.MozillaCookieJar()
|
||||
if os.path.isfile(self.request.cookies):
|
||||
self.cookies.load(self.request.cookies)
|
||||
build.append(urllib.request.HTTPCookieProcessor(self.cookies))
|
||||
|
||||
urllib.request.install_opener(urllib.request.build_opener(*build))
|
||||
|
||||
def _fetch(self):
|
||||
params = {} if self.request.params is None else self.request.params
|
||||
|
||||
if self.request.upload:
|
||||
boundary, upload = self._upload(self.request.upload, params)
|
||||
req = urllib.request.Request(self.request.url)
|
||||
req.add_data(upload)
|
||||
else:
|
||||
|
||||
if self.request.method == 'POST':
|
||||
if isinstance(params, dict) or isinstance(params, list):
|
||||
params = urllib.parse.urlencode(params)
|
||||
req = urllib.request.Request(self.request.url, params)
|
||||
else:
|
||||
req = urllib.request.Request(self.request.url)
|
||||
|
||||
for key, value in self.request.headers.items():
|
||||
req.add_header(key, value)
|
||||
|
||||
if self.request.upload:
|
||||
req.add_header('Content-type', 'multipart/form-data; boundary=%s' % boundary)
|
||||
req.add_header('Content-length', len(upload))
|
||||
|
||||
if self.request.auth_username and self.request.auth_password:
|
||||
req.add_header('Authorization', 'Basic %s' % base64.encodestring(
|
||||
':'.join([self.request.auth_username, self.request.auth_password])).strip())
|
||||
|
||||
self.con = urllib.request.urlopen(req, timeout=self.request.timeout)
|
||||
# self.con = urllib2.urlopen(req)
|
||||
self.response.headers = self._headers(self.con.info())
|
||||
|
||||
if self.request.download:
|
||||
self._download()
|
||||
else:
|
||||
self.response.body = self.con.read()
|
||||
|
||||
if self.request.cookies:
|
||||
self.cookies.save(self.request.cookies)
|
||||
|
||||
def _download(self):
|
||||
fd = open(self.request.download, 'wb')
|
||||
if self.request.progress:
|
||||
self.progress = xbmcgui.DialogProgress()
|
||||
self.progress.create(u'Download')
|
||||
|
||||
bs = 1024 * 8
|
||||
size = -1
|
||||
read = 0
|
||||
name = None
|
||||
|
||||
if self.request.progress:
|
||||
if 'content-length' in self.response.headers:
|
||||
size = int(self.response.headers['content-length'])
|
||||
if 'content-disposition' in self.response.headers:
|
||||
r = RE['content-disposition'].search(self.response.headers['content-disposition'])
|
||||
if r:
|
||||
name = urllib.parse.unquote(r.group(1))
|
||||
|
||||
while 1:
|
||||
buf = self.con.read(bs)
|
||||
if not buf:
|
||||
break
|
||||
read += len(buf)
|
||||
fd.write(buf)
|
||||
|
||||
if self.request.progress:
|
||||
self.progress.update(*self._progress(read, size, name))
|
||||
|
||||
self.response.filename = self.request.download
|
||||
|
||||
def _upload(self, upload, params):
|
||||
import mimetools
|
||||
import itertools
|
||||
|
||||
res = []
|
||||
boundary = mimetools.choose_boundary()
|
||||
part_boundary = '--' + boundary
|
||||
|
||||
if params:
|
||||
for name, value in params.items():
|
||||
res.append([part_boundary, 'Content-Disposition: form-data; name="%s"' % name, '', value])
|
||||
|
||||
if isinstance(upload, dict):
|
||||
upload = [upload]
|
||||
|
||||
for obj in upload:
|
||||
name = obj.get('name')
|
||||
filename = obj.get('filename', 'default')
|
||||
content_type = obj.get('content-type')
|
||||
try:
|
||||
body = obj['body'].read()
|
||||
except AttributeError:
|
||||
body = obj['body']
|
||||
|
||||
if content_type:
|
||||
res.append([part_boundary,
|
||||
'Content-Disposition: file; name="%s"; filename="%s"' % (name, urllib.parse.quote(filename)),
|
||||
'Content-Type: %s' % content_type, '', body])
|
||||
else:
|
||||
res.append([part_boundary,
|
||||
'Content-Disposition: file; name="%s"; filename="%s"' % (name, urllib.parse.quote(filename)), '',
|
||||
body])
|
||||
|
||||
result = list(itertools.chain(*res))
|
||||
result.append('--' + boundary + '--')
|
||||
result.append('')
|
||||
return boundary, '\r\n'.join(result)
|
||||
|
||||
def _headers(self, raw):
|
||||
headers = {}
|
||||
for line in str(raw).split('\n'):
|
||||
pair = line.split(':', 1)
|
||||
if len(pair) == 2:
|
||||
tag = pair[0].lower().strip()
|
||||
value = pair[1].strip()
|
||||
if tag and value:
|
||||
headers[tag] = value
|
||||
return headers
|
||||
|
||||
def _progress(self, read, size, name):
|
||||
res = []
|
||||
if size < 0:
|
||||
res.append(1)
|
||||
else:
|
||||
res.append(int(float(read) / (float(size) / 100.0)))
|
||||
if name:
|
||||
res.append(u'File: ' + name)
|
||||
if size != -1:
|
||||
res.append(u'Size: ' + self._human(size))
|
||||
res.append(u'Load: ' + self._human(read))
|
||||
return res
|
||||
|
||||
def _human(self, size):
|
||||
human = None
|
||||
for h, f in (('KB', 1024), ('MB', 1024 * 1024), ('GB', 1024 * 1024 * 1024), ('TB', 1024 * 1024 * 1024 * 1024)):
|
||||
if old_div(size, f) > 0:
|
||||
human = h
|
||||
factor = f
|
||||
else:
|
||||
break
|
||||
if human is None:
|
||||
return (u'%10.1f %s' % (size, u'byte')).replace(u'.0', u'')
|
||||
else:
|
||||
return u'%10.2f %s' % (float(size) / float(factor), human)
|
||||
|
||||
|
||||
class HTTPRequest(object):
|
||||
def __init__(self, url, method='GET', headers=None, cookies=None, params=None, upload=None, download=None,
|
||||
progress=False, auth_username=None, auth_password=None, proxy_protocol='http', proxy_host=None,
|
||||
proxy_port=None, proxy_username=None, proxy_password='', timeout=20.0, redirect=True, gzip=False):
|
||||
if headers is None:
|
||||
headers = {}
|
||||
|
||||
self.url = url
|
||||
self.method = method
|
||||
self.headers = headers
|
||||
|
||||
self.cookies = cookies
|
||||
|
||||
self.params = params
|
||||
|
||||
self.upload = upload
|
||||
self.download = download
|
||||
self.progress = progress
|
||||
|
||||
self.auth_username = auth_username
|
||||
self.auth_password = auth_password
|
||||
|
||||
self.proxy_protocol = proxy_protocol
|
||||
self.proxy_host = proxy_host
|
||||
self.proxy_port = proxy_port
|
||||
self.proxy_username = proxy_username
|
||||
self.proxy_password = proxy_password
|
||||
|
||||
self.timeout = timeout
|
||||
|
||||
self.redirect = redirect
|
||||
|
||||
self.gzip = gzip
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%s)' % (self.__class__.__name__, ','.join('%s=%r' % i for i in self.__dict__.items()))
|
||||
|
||||
|
||||
class HTTPResponse(object):
|
||||
def __init__(self, request):
|
||||
self.request = request
|
||||
self.code = None
|
||||
self.headers = {}
|
||||
self.error = None
|
||||
self.body = None
|
||||
self.filename = None
|
||||
self.time = time.time()
|
||||
|
||||
def __repr__(self):
|
||||
args = ','.join('%s=%r' % i for i in self.__dict__.items() if i[0] != 'body')
|
||||
if self.body:
|
||||
args += ',body=<data>'
|
||||
else:
|
||||
args += ',body=None'
|
||||
return '%s(%s)' % (self.__class__.__name__, args)
|
||||
208
lib/python_libtorrent/python_libtorrent/platform_pulsar.py
Normal file
208
lib/python_libtorrent/python_libtorrent/platform_pulsar.py
Normal file
@@ -0,0 +1,208 @@
|
||||
#-*- coding: utf-8 -*-
|
||||
'''
|
||||
python-libtorrent for Kodi (script.module.libtorrent)
|
||||
Copyright (C) 2015-2016 DiMartino, srg70, RussakHH, aisman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
'''
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
import os
|
||||
try:
|
||||
import xbmc, xbmcaddon
|
||||
#__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.alfa') ### Alfa
|
||||
__version__ = '1.1.17' ### Alfa
|
||||
__plugin__ = "python-libtorrent v.1.1.7" ### Alfa
|
||||
except:
|
||||
__plugin__ = "python-libtorrent v.1.1.7" ### Alfa
|
||||
pass
|
||||
|
||||
def log(msg):
|
||||
try:
|
||||
xbmc.log("### [%s]: %s" % (__plugin__,msg,), level=xbmc.LOGNOTICE )
|
||||
except UnicodeEncodeError:
|
||||
xbmc.log("### [%s]: %s" % (__plugin__,msg.encode("utf-8", "ignore"),), level=xbmc.LOGNOTICE )
|
||||
except:
|
||||
try:
|
||||
xbmc.log("### [%s]: %s" % (__plugin__,'ERROR LOG',), level=xbmc.LOGNOTICE )
|
||||
except:
|
||||
print(msg)
|
||||
|
||||
def get_libname(platform):
|
||||
libname=[]
|
||||
if platform['system'] in ['darwin', 'linux_x86', 'linux_arm', 'linux_armv6',
|
||||
'linux_armv7', 'linux_x86_64', 'ios_arm',
|
||||
'linux_mipsel_ucs2', 'linux_mipsel_ucs4', 'linux_aarch64_ucs2', 'linux_aarch64_ucs4']:
|
||||
libname=['libtorrent.so']
|
||||
elif platform['system'] in ['windows', 'windows_x64']: ### Alfa
|
||||
libname=['libtorrent.pyd']
|
||||
elif platform['system'] in ['android_armv7', 'android_x86']:
|
||||
libname=['libtorrent.so', 'liblibtorrent.so']
|
||||
return libname
|
||||
|
||||
def get_platform():
|
||||
#__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.alfa') ### Alfa
|
||||
__version__ = '1.1.17' ### Alfa
|
||||
__plugin__ = "python-libtorrent v.1.1.7" ### Alfa
|
||||
__language__ = __settings__.getLocalizedString
|
||||
|
||||
if __settings__.getSetting('custom_system').lower() == "true":
|
||||
system = int(__settings__.getSetting('set_system'))
|
||||
log('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"] = "armv7"
|
||||
elif system==4:
|
||||
ret["os"] = "linux"
|
||||
ret["arch"] = "armv6"
|
||||
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"
|
||||
elif system==10:
|
||||
ret["os"] = "linux"
|
||||
ret["arch"] = "mipsel_ucs2"
|
||||
elif system==11:
|
||||
ret["os"] = "linux"
|
||||
ret["arch"] = "mipsel_ucs4"
|
||||
elif system == 12:
|
||||
ret["os"] = "linux"
|
||||
ret["arch"] = "linux_aarch64_ucs2"
|
||||
elif system == 13:
|
||||
ret["os"] = "linux"
|
||||
ret["arch"] = "linux_aarch64_ucs4"
|
||||
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] or "aarch64" in os.uname()[4]:
|
||||
ret["arch"] = "arm"
|
||||
elif xbmc.getCondVisibility("system.platform.linux"):
|
||||
ret["os"] = "linux"
|
||||
uname=os.uname()[4]
|
||||
if "arm" in uname:
|
||||
if "armv7" in uname:
|
||||
ret["arch"] = "armv7"
|
||||
else:
|
||||
ret["arch"] = "armv6"
|
||||
elif "mips" in uname:
|
||||
if sys.maxunicode > 65536:
|
||||
ret["arch"] = 'mipsel_ucs4'
|
||||
else:
|
||||
ret["arch"] = 'mipsel_ucs2'
|
||||
elif "aarch64" in uname:
|
||||
if sys.maxsize > 2147483647: #is_64bit_system
|
||||
if sys.maxunicode > 65536:
|
||||
ret["arch"] = 'aarch64_ucs4'
|
||||
else:
|
||||
ret["arch"] = 'aarch64_ucs2'
|
||||
else:
|
||||
ret["arch"] = "armv7" #32-bit userspace
|
||||
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"] = ['', '']
|
||||
|
||||
if ret["os"] == 'windows' and ret["arch"] != "x64": ### Alfa
|
||||
ret["system"] = 'windows'
|
||||
ret["message"] = ['Windows has static compiled python-libtorrent included.',
|
||||
'You should install "script.module.libtorrent" from "MyShows.me Kodi Repo"']
|
||||
elif ret["os"] == 'windows' and ret["arch"] == "x64": ### Alfa
|
||||
ret["system"] = 'windows_x64' ### Alfa
|
||||
ret["message"] = ['Windows x64 has static compiled python-libtorrent included.', ### Alfa
|
||||
'You should install "script.module.libtorrent" from "MyShows.me Kodi Repo"'] ### Alfa
|
||||
elif ret["os"] == "linux" and ret["arch"] == "x64":
|
||||
ret["system"] = 'linux_x86_64'
|
||||
ret["message"] = ['Linux x64 has not static compiled python-libtorrent included.',
|
||||
'You should install it by "sudo apt-get install python-libtorrent"']
|
||||
elif ret["os"] == "linux" and ret["arch"] == "x86":
|
||||
ret["system"] = 'linux_x86'
|
||||
ret["message"] = ['Linux has static compiled python-libtorrent included but it didn\'t work.',
|
||||
'You should install it by "sudo apt-get install python-libtorrent"']
|
||||
elif ret["os"] == "linux" and "aarch64" in ret["arch"]:
|
||||
ret["system"] = 'linux_' + ret["arch"]
|
||||
ret["message"] = ['Linux has static compiled python-libtorrent included but it didn\'t work.',
|
||||
'You should install it by "sudo apt-get install python-libtorrent"']
|
||||
elif ret["os"] == "linux" and ("arm" or "mips" in ret["arch"]):
|
||||
ret["system"] = 'linux_'+ret["arch"]
|
||||
ret["message"] = ['As far as I know you can compile python-libtorrent for ARMv6-7.',
|
||||
'You should search for "OneEvil\'s OpenELEC libtorrent" or use Ace Stream.']
|
||||
elif ret["os"] == "android":
|
||||
if ret["arch"]=='arm':
|
||||
ret["system"] = 'android_armv7'
|
||||
else:
|
||||
ret["system"] = 'android_x86'
|
||||
ret["message"] = ['Please contact DiMartino on kodi.tv forum. We compiled python-libtorrent for Android,',
|
||||
'but we need your help with some tests on different processors.']
|
||||
elif ret["os"] == "darwin":
|
||||
ret["system"] = 'darwin'
|
||||
ret["message"] = ['It is possible to compile python-libtorrent for OS X.',
|
||||
'But you would have to do it by yourself, there is some info on github.com.']
|
||||
elif ret["os"] == "ios" and ret["arch"] == "arm":
|
||||
ret["system"] = 'ios_arm'
|
||||
ret["message"] = ['It is probably NOT possible to compile python-libtorrent for iOS.',
|
||||
'But you can use torrent-client control functions.']
|
||||
|
||||
return ret
|
||||
Reference in New Issue
Block a user