def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'): self.platform = get_platform() self.storageDirectory = storageDirectory self.torrentFilesPath = os.path.join(self.storageDirectory, torrentFilesDirectory) + os.sep if not is_writable(self.storageDirectory): xbmcgui.Dialog().ok( Localization.localize('Torrenter v2'), Localization.localize( 'Your storage path is not writable or not local! Please change it in settings!' ), Localization.localize(self.storageDirectory)) sys.exit(1) try: from python_libtorrent import get_libtorrent libtorrent = get_libtorrent() log('Imported libtorrent v%s from python_libtorrent/%s' % (libtorrent.version, self.platform['system'])) module = True except Exception, e: module = False log('Error importing python_libtorrent.%s. Exception: %s' % (self.platform['system'], str(e))) import libtorrent
def __init__(self, userStorageDirectory, torrentUrl, params={}): print '!!!!!!!!!!!!!!!!!! BORN ' + self.__class__.__name__ self.userStorageDirectory = userStorageDirectory self.torrentUrl = torrentUrl xbmc.Player.__init__(self) log("[BTClientPlayer] Initalized") self.params = params self.get = self.params.get self.contentId = int(self.get("url")) self.platform = get_platform() self.init() self.torrent = Downloader.Torrent(self.userStorageDirectory, self.torrentUrl, self.torrentFilesDirectory).player self.lt = self.torrent.lt try: if self.get("url2"): self.ids_video = urllib.unquote_plus( self.get("url2")).split(',') else: self.ids_video = self.get_ids() except: pass args = Namespace( bt_download_limit=self.download_limit, #KB bt_upload_limit=self.upload_limit, choose_subtitles=False, clear_older=0, debug_log=os.path.join(self.userStorageDirectory, 'log.txt'), delete_on_finish=False, directory=self.userStorageDirectory, listen_port_max=6891, # listen_port_min=6881, no_resume=False, player='kodi', port=5001, print_pieces=False, quiet=False, stdin=False, stream=True, subtitles=None, trace=True, content_id=self.contentId, url=self.torrentUrl) args = main(args) #config self.free_port = args.port log('BTClientPlayer: args ' + str(args)) self.btclient = self.stream(args, BTClient)
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'): ''' #from ctypes import * #cdll.LoadLibrary(dirname + '/libtorrent-rasterbar.so.7')''' self.platform = get_platform() try: import libtorrent print '[script.module.libtorrent]: Imported libtorrent v' + libtorrent.version + ' from system' except Exception, e: print '[script.module.libtorrent]: Error importing from system. Exception: ' + str(e) import python_libtorrent as libtorrent
def __init__(self, userStorageDirectory, torrentUrl, params={}): print '!!!!!!!!!!!!!!!!!! BORN '+self.__class__.__name__ self.userStorageDirectory = userStorageDirectory self.torrentUrl = torrentUrl xbmc.Player.__init__(self) log("[BTClientPlayer] Initalized") self.params = params self.get = self.params.get self.contentId = int(self.get("url")) self.platform = get_platform() self.init() self.torrent = Downloader.Torrent(self.userStorageDirectory, self.torrentUrl, self.torrentFilesDirectory).player self.lt=self.torrent.lt try: if self.get("url2"): self.ids_video = urllib.unquote_plus(self.get("url2")).split(',') else: self.ids_video = self.get_ids() except: pass args=Namespace(bt_download_limit=self.download_limit,#KB bt_upload_limit=self.upload_limit, choose_subtitles=False, clear_older=0, debug_log=os.path.join(self.userStorageDirectory, 'log.txt'), delete_on_finish=False, directory=self.userStorageDirectory, listen_port_max=6891,# listen_port_min=6881, no_resume=False, player='kodi', port=5001, print_pieces=False, quiet=False, stdin=False, stream=True, subtitles=None, trace=True, content_id=self.contentId, url=self.torrentUrl) args=main(args) #config self.free_port = args.port log('BTClientPlayer: args '+str(args)) self.btclient=self.stream(args, BTClient)
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'): self.platform = get_platform() self.storageDirectory = storageDirectory self.torrentFilesPath = os.path.join(self.storageDirectory, torrentFilesDirectory) + os.sep if not is_writable(self.storageDirectory): xbmcgui.Dialog().ok(Localization.localize('Torrenter v2'), Localization.localize('Your storage path is not writable or not local! Please change it in settings!'), Localization.localize(self.storageDirectory)) sys.exit(1) try: from python_libtorrent import get_libtorrent libtorrent=get_libtorrent() log('Imported libtorrent v%s from python_libtorrent/%s' %(libtorrent.version, self.platform['system'])) module=True except Exception, e: module=False log('Error importing python_libtorrent.%s. Exception: %s' %(self.platform['system'], str(e))) import libtorrent
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'): '''dirname = os.path.join(xbmc.translatePath('special://home'), 'addons', 'plugin.video.torrenter', 'resources') sys.path.insert(0, dirname) try: import resources.libtorrent as libtorrent print 'Imported libtorrent v' + libtorrent.version + ' from python_libtorrent.' except Exception, e: print 'Error importing python_libtorrent. Exception: ' + str(e) try: from ctypes import * cdll.LoadLibrary(os.path.join(dirname,'libtorrent.so')) except Exception, e: print 'Error importing by ctypes. Exception: ' + str(e) try: print 'Imported libtorrent v' + libtorrent.version + ' from python_libtorrent.' except Exception, e: print 'Error importing python_libtorrent. Exception: ' + str(e) print 'Imported libtorrent v' + libtorrent.version + ' from ctypes. try: import libtorrent print 'Imported libtorrent v' + libtorrent.version + ' from system' except Exception, e: print 'Error importing from system. Exception: ' + str(e) if platform.system() != 'Windows': if sys.maxsize > 2 ** 32: system = 'linux_x86_64' else: system = 'linux_x86' else: system = 'windows' dirname = os.path.join(xbmc.translatePath('special://home'), 'addons', 'script.module.libtorrent', 'python_libtorrent', system) sys.path.insert(0, dirname) try: import libtorrent print 'Imported libtorrent v' + libtorrent.version + ' from python_libtorrent.' + system except Exception, e: print 'Error importing python_libtorrent.' + system + '. Exception: ' + str(e) pass #from ctypes import * #cdll.LoadLibrary(dirname + '/libtorrent-rasterbar.so.7')''' self.platform = get_platform() print '[Libtorrent] self.platform: ' + str(self.platform) try: import libtorrent print 'Imported libtorrent v' + libtorrent.version + ' from system' except Exception, e: print 'Error importing from system. Exception: ' + str(e) try: dirname = os.path.join(xbmc.translatePath('special://home'), 'addons', 'script.module.libtorrent', 'python_libtorrent', self.platform['system']) sys.path.insert(0, dirname) import libtorrent print 'Imported libtorrent v' + libtorrent.version + ' from python_libtorrent.' + self.platform[ 'system'] except Exception, e: print 'Error importing python_libtorrent.' + self.platform['system'] + '. Exception: ' + str(e) pass
from functions import LibraryManager, log from platform_pulsar import get_platform import xbmc import sys import os from platform import uname, machine, processor, system from traceback import format_exc # __addon__ = xbmcaddon.Addon() # __version__ = __addon__.getAddonInfo('version') # __id__ = __addon__.getAddonInfo('name') + " v." + __version__ # __language__ = __addon__.getLocalizedString libtorrent = None platform = get_platform() dirname = os.path.join(xbmc.translatePath('special://temp'), 'xbmcup', 'plugin.video.yatp', 'python_libtorrent') log('dirname:' + str(dirname)) default_path = '0.16.19' platform['version'] = default_path if not os.path.exists(os.path.join(os.path.dirname(__file__), platform['system'], platform['version'])): log('set_version: back to default '+ default_path) platform['version'] = default_path 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()
def __init__(self, dest_path): self.dest_path = dest_path self.platform = get_platform() self.root=os.path.dirname(__file__)
def __init__(self, dest_path): self.dest_path = dest_path self.platform = get_platform() tempdir(self.dest_path)