def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'): 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' % (libtorrent.version)) module = True except Exception, e: module = False log('Error importing python_libtorrent Exception: %s' % (str(e))) import libtorrent
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'): self.storageDirectory = storageDirectory self.torrentFilesPath = os.path.join(self.storageDirectory, torrentFilesDirectory) + os.sep if not is_writable(self.storageDirectory): xbmcgui.Dialog().ok(self.localize('Torrenter v2'), self.localize('Your storage path is not writable or not local! Please change it in settings!'), self.localize(self.storageDirectory)) sys.exit(1) #pre settings if re.match("^magnet\:.+$", torrentFile): self.magnetLink = torrentFile else: self.torrentFile = torrentFile
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'): 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' %(libtorrent.version)) module=True except Exception, e: module=False log('Error importing python_libtorrent Exception: %s' %( str(e))) import libtorrent
def __init__(self, userStorageDirectory, torrentUrl, params={}): self.userStorageDirectory = userStorageDirectory self.torrentUrl = torrentUrl if not is_writable(self.userStorageDirectory): xbmcgui.Dialog().ok( Localization.localize('Torrenter v2'), Localization.localize( 'Your storage path is not writable or not local! Please change it in settings!' ), self.storageDirectory) sys.exit(1) xbmc.Player.__init__(self) log("[" + author + "Player] Initalized v" + __version__) self.params = params self.get = self.params.get self.contentId = int(self.get("url")) if self.get("seek"): self.seek = int(self.get("seek")) self.init() self.setup_engine() self.on_playback_resumed.append(self.engine.resume) self.on_playback_paused.append(self.engine.pause) showMessage('[%sPlayer v%s] ' % (author, __version__), self.localize('Please Wait')) try: self.engine.start() self.setup_nextep() self.engine.activate_file(self.contentId) if self.buffer(): while True: log('[' + author + 'Player]: ************************************* GOING LOOP' ) if self.setup_play(): WatchedHistoryDB().add( self.basename, self.torrentUrl, foldername(self.getContentList()[self.contentId] ['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize) self.setup_subs() self.loop() WatchedHistoryDB().add( self.basename, self.torrentUrl, foldername(self.getContentList()[self.contentId] ['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize) else: log('[' + author + 'Player]: ************************************* break' ) break log('[' + author + 'Player]: ************************************* GO NEXT?' ) if self.next_dl and self.next_contentId != False and isinstance( self.next_contentId, int) and self.iterator == 100: if not self.next_play: xbmc.sleep(3000) if not xbmcgui.Dialog().yesno( self.localize('[%sPlayer v%s] ' % (author, __version__)), self.localize( 'Would you like to play next episode?') ): break self.contentId = self.next_contentId self.engine.activate_file(self.contentId) showMessage('[%sPlayer v%s] ' % (author, __version__), self.localize('Please Wait')) continue log('[' + author + 'Player]: ************************************* NO! break' ) break except: import traceback log(traceback.format_exc()) finally: self.engine.close() xbmc.Player().stop() if '1' != self.__settings__.getSetting( "keep_files" ) and 'Saved Files' not in self.userStorageDirectory: xbmc.sleep(1000) clearStorage(self.userStorageDirectory) else: #if self.seeding_status: #showMessage(self.localize('Information'), # self.localize('Torrent is seeding. To stop it use Download Status.'), forced=True) #else: #if self.seeding: self.db_delete() showMessage(self.localize('Information'), self.localize('Torrent downloading is stopped.')) loadsw_onstop() # Reload Search Window
def __init__(self, userStorageDirectory, torrentUrl, params={}): self.userStorageDirectory = userStorageDirectory self.torrentUrl = torrentUrl if not is_writable(self.userStorageDirectory): xbmcgui.Dialog().ok(Localization.localize('Torrenter v2'), Localization.localize('Your storage path is not writable or not local! Please change it in settings!'), self.storageDirectory) sys.exit(1) xbmc.Player.__init__(self) log("["+author+"Player] Initalized v"+__version__) self.params = params self.get = self.params.get self.contentId = int(self.get("url")) if self.get("seek"): self.seek = int(self.get("seek")) #self.torrent = AnteoLoader(self.userStorageDirectory, self.torrentUrl, self.torrentFilesDirectory) self.init() self.setup_engine() with closing(self.engine): self.engine.start(self.contentId) self.setup_nextep() while True: if self.buffer(): log('[AnteoPlayer]: ************************************* GOING LOOP') if self.setup_play(): WatchedHistoryDB().add(self.basename, self.torrentUrl, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize) self.setup_subs() self.loop() WatchedHistoryDB().add(self.basename, self.torrentUrl, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize) else: log('[AnteoPlayer]: ************************************* break') break log('[AnteoPlayer]: ************************************* GO NEXT?') if self.next_dl and self.next_contentId != False and isinstance(self.next_contentId, int) and self.iterator == 100: if not self.next_play: xbmc.sleep(3000) if not xbmcgui.Dialog().yesno( self.localize('[%sPlayer v%s] ' % (author, __version__)), self.localize('Would you like to play next episode?')): break self.contentId = self.next_contentId continue log('[AnteoPlayer]: ************************************* NO! break') showMessage(self.localize('Information'), self.localize('Stopping the torrent2http process...')) break xbmc.Player().stop() if '1' != self.__settings__.getSetting("keep_files") and 'Saved Files' not in self.userStorageDirectory: xbmc.sleep(1000) clearStorage(self.userStorageDirectory) showMessage(self.localize('Information'), self.localize('torrent2http process stopped.')) loadsw_onstop() # Reload Search Window
def __init__(self, userStorageDirectory, torrentUrl, params={}): self.userStorageDirectory = userStorageDirectory self.torrentUrl = torrentUrl if not is_writable(self.userStorageDirectory): xbmcgui.Dialog().ok(Localization.localize('Torrenter v2'), Localization.localize('Your storage path is not writable or not local! Please change it in settings!'), self.storageDirectory) sys.exit(1) xbmc.Player.__init__(self) log("["+author+"Player] Initalized v"+__version__) self.params = params self.get = self.params.get self.contentId = int(self.get("url")) if self.get("seek"): self.seek = int(self.get("seek")) self.init() self.setup_engine() self.on_playback_resumed.append(self.engine.resume) self.on_playback_paused.append(self.engine.pause) showMessage('[%sPlayer v%s] ' % (author, __version__), self.localize('Please Wait')) try: self.engine.start() self.setup_nextep() self.engine.activate_file(self.contentId) if self.buffer(): while True: log('['+author+'Player]: ************************************* GOING LOOP') if self.setup_play(): WatchedHistoryDB().add(self.basename, self.torrentUrl, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize) self.setup_subs() self.loop() WatchedHistoryDB().add(self.basename, self.torrentUrl, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize) else: log('['+author+'Player]: ************************************* break') break log('['+author+'Player]: ************************************* GO NEXT?') if self.next_dl and self.next_contentId != False and isinstance(self.next_contentId, int) and self.iterator == 100: if not self.next_play: xbmc.sleep(3000) if not xbmcgui.Dialog().yesno( self.localize('[%sPlayer v%s] ' % (author, __version__)), self.localize('Would you like to play next episode?')): break self.contentId = self.next_contentId self.engine.activate_file(self.contentId) showMessage('[%sPlayer v%s] ' % (author, __version__), self.localize('Please Wait')) continue log('['+author+'Player]: ************************************* NO! break') break except: import traceback log(traceback.format_exc()) finally: self.engine.close() xbmc.Player().stop() if '1' != self.__settings__.getSetting("keep_files") and 'Saved Files' not in self.userStorageDirectory: xbmc.sleep(1000) clearStorage(self.userStorageDirectory) else: #if self.seeding_status: #showMessage(self.localize('Information'), # self.localize('Torrent is seeding. To stop it use Download Status.'), forced=True) #else: #if self.seeding: self.db_delete() showMessage(self.localize('Information'), self.localize('Torrent downloading is stopped.')) loadsw_onstop() # Reload Search Window