android update

pull/1/head
DiMartinoXBMC 2015-07-26 12:59:08 +03:00
parent bd8df8776a
commit 43b72172f7
2 changed files with 22 additions and 28 deletions

View File

@ -65,36 +65,30 @@ try:
log('CDLL = ' + str(liblibtorrent)) log('CDLL = ' + str(liblibtorrent))
import libtorrent import libtorrent
elif platform['system'] in ['android_armv7', 'android_x86']: elif platform['system'] in ['android_armv7', 'android_x86']:
import imp
from ctypes import CDLL
try: try:
import libtorrent dll_path=os.path.join(dest_path, 'liblibtorrent.so')
log('Imported libtorrent v' + libtorrent.version + ' from system') log('CDLL path = ' + dll_path)
except Exception, e:
log('Error importing libtorrent from system. Exception: ' + str(e))
import imp
from ctypes import CDLL
try:
dll_path=os.path.join(dest_path, 'liblibtorrent.so')
log('CDLL path = ' + dll_path)
liblibtorrent=CDLL(dll_path)
log('CDLL = ' + str(liblibtorrent))
except:
# If no permission in dest_path we need to go deeper!
# http://i3.kym-cdn.com/photos/images/original/000/531/557/a88.jpg
dest_path=lm.android_workaround()
dll_path=os.path.join(dest_path, 'liblibtorrent.so')
log('NEW CDLL path = ' + dll_path)
liblibtorrent=CDLL(dll_path) liblibtorrent=CDLL(dll_path)
log('CDLL = ' + str(liblibtorrent)) log('CDLL = ' + str(liblibtorrent))
path_list = [dest_path] except:
log('path_list = ' + str(path_list)) # If no permission in dest_path we need to go deeper!
fp, pathname, description = imp.find_module('libtorrent', path_list) # http://i3.kym-cdn.com/photos/images/original/000/531/557/a88.jpg
log('fp = ' + str(fp)) dest_path=lm.android_workaround()
log('pathname = ' + str(pathname)) dll_path=os.path.join(dest_path, 'liblibtorrent.so')
try: log('NEW CDLL path = ' + dll_path)
libtorrent = imp.load_module('libtorrent', fp, pathname, description) liblibtorrent=CDLL(dll_path)
finally: log('CDLL = ' + str(liblibtorrent))
if fp: fp.close() 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))
try:
libtorrent = imp.load_module('libtorrent', fp, pathname, description)
finally:
if fp: fp.close()
log('Imported libtorrent v' + libtorrent.version + ' from "' + dest_path + '"') log('Imported libtorrent v' + libtorrent.version + ' from "' + dest_path + '"')

View File

@ -76,7 +76,7 @@ class LibraryManager():
return True return True
def android_workaround(self): def android_workaround(self):
new_dest_path=os.path.join(xbmc.translatePath('special://xbmc'), self.platform['system']) new_dest_path='/data/data/org.xbmc.kodi/lib/'
for libname in get_libname(self.platform): for libname in get_libname(self.platform):
libpath=os.path.join(self.dest_path, libname) libpath=os.path.join(self.dest_path, libname)
size=str(os.path.getsize(libpath)) size=str(os.path.getsize(libpath))