From a25646b4c68a38a59a15bf8da36db9ec3f8fbf5b Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Tue, 28 Jul 2015 20:17:37 +0300 Subject: [PATCH] android workaround update --- addon.xml | 2 +- python_libtorrent/__init__.py | 17 +++++++++++++---- python_libtorrent/functions.py | 3 +-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/addon.xml b/addon.xml index 1ba39c5..71057f1 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/python_libtorrent/__init__.py b/python_libtorrent/__init__.py index c318d75..ebfa60d 100644 --- a/python_libtorrent/__init__.py +++ b/python_libtorrent/__init__.py @@ -74,10 +74,19 @@ try: 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) + try: + dest_path=lm.android_workaround(new_dest_path='/data/data/org.xbmc.kodi/lib/') + dll_path=os.path.join(dest_path, 'liblibtorrent.so') + log('NEW CDLL path = ' + dll_path) + liblibtorrent=CDLL(dll_path) + log('CDLL = ' + str(liblibtorrent)) + except: + # http://i3.kym-cdn.com/photos/images/original/000/531/557/a88.jpg + dest_path=lm.android_workaround(new_dest_path=xbmc.translatePath('special://xbmc')) + dll_path=os.path.join(dest_path, 'liblibtorrent.so') + log('NEW CDLL path = ' + dll_path) + liblibtorrent=CDLL(dll_path) + log('CDLL = ' + str(liblibtorrent)) liblibtorrent=CDLL(dll_path) log('CDLL = ' + str(liblibtorrent)) path_list = [dest_path] diff --git a/python_libtorrent/functions.py b/python_libtorrent/functions.py index a3e0c12..3b18620 100644 --- a/python_libtorrent/functions.py +++ b/python_libtorrent/functions.py @@ -75,8 +75,7 @@ class LibraryManager(): xbmcvfs.copy(os.path.join(self.dest_path, 'libtorrent.so'), dest) return True - def android_workaround(self): - new_dest_path='/data/data/org.xbmc.kodi/lib/' + def android_workaround(self, new_dest_path): for libname in get_libname(self.platform): libpath=os.path.join(self.dest_path, libname) size=str(os.path.getsize(libpath))