pull/1/head
DiMartinoXBMC 2015-07-19 03:01:30 +03:00
parent b7bab5a42d
commit 63b3184a6a
1 changed files with 8 additions and 6 deletions

View File

@ -1,10 +1,12 @@
#import sys #import sys
import os import os
import xbmc, xbmcgui, xbmcvfs import xbmc, xbmcgui, xbmcvfs, xbmcaddon
from net import HTTP from net import HTTP
__libbaseurl__ = "https://github.com/DiMartinoXBMC/script.module.libtorrent/raw/master/python_libtorrent" __libbaseurl__ = "https://github.com/DiMartinoXBMC/script.module.libtorrent/raw/master/python_libtorrent"
__scriptname__ = "script.module.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', __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') #dirname = os.path.join(xbmc.translatePath('special://home'), 'addons', 'script.module.libtorrent')
@ -32,18 +34,18 @@ class DownloaderClass():
xbmcvfs.delete(dest + ".zip") xbmcvfs.delete(dest + ".zip")
except: except:
text = 'Failed download %s!' % libname text = 'Failed download %s!' % libname
xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,750,__icon__)) xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__plugin__,text,750,__icon__))
else: else:
x=xbmcvfs.copy(os.path.join(self.dest_path, 'libtorrent.so'), dest) x=xbmcvfs.copy(os.path.join(self.dest_path, 'libtorrent.so'), dest)
return True return True
def log(msg): def log(msg):
try: try:
xbmc.log("### [%s]: %s" % (__scriptname__,msg,), level=xbmc.LOGNOTICE ) xbmc.log("### [%s]: %s" % (__plugin__,msg,), level=xbmc.LOGNOTICE )
except UnicodeEncodeError: except UnicodeEncodeError:
xbmc.log("### [%s]: %s" % (__scriptname__,msg.encode("utf-8", "ignore"),), level=xbmc.LOGNOTICE ) xbmc.log("### [%s]: %s" % (__plugin__,msg.encode("utf-8", "ignore"),), level=xbmc.LOGNOTICE )
except: except:
xbmc.log("### [%s]: %s" % (__scriptname__,'ERROR LOG',), level=xbmc.LOGNOTICE ) xbmc.log("### [%s]: %s" % (__plugin__,'ERROR LOG',), level=xbmc.LOGNOTICE )
def tempdir(platform): def tempdir(platform):
dirname=xbmc.translatePath('special://temp') dirname=xbmc.translatePath('special://temp')