Exemplo n.º 1
0
    def __init__(self, userStorageDirectory, torrentUrl, params={}):
        self.userStorageDirectory = userStorageDirectory
        self.torrentUrl = torrentUrl
        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()
        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():
                        self.setup_subs()
                        self.loop()
                        WatchedHistoryDB().add(self.basename, 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.'), forced=True)
Exemplo n.º 2
0
    def __init__(self, userStorageDirectory, torrentUrl, params={}):
        self.userStorageDirectory = userStorageDirectory
        self.torrentUrl = torrentUrl
        xbmc.Player.__init__(self)
        log("[TorrentPlayer] Initalized")
        self.params = params
        self.get = self.params.get
        self.contentId = int(self.get("url"))
        if self.get("seek"):
            self.seek = int(self.get("seek"))
            log('[TorrentPlayer] Seek='+str(self.seek))   
        self.torrent = Downloader.Torrent(self.userStorageDirectory, self.torrentUrl, self.torrentFilesDirectory).player
        try:
            if self.get("url2"):
                self.ids_video = urllib.unquote_plus(self.get("url2")).split(',')
            else:
                self.ids_video = self.get_ids()
        except:
            pass
        self.init()
        self.setup_torrent()
        if self.buffer():
            while True:
                if self.setup_play():
                    debug('************************************* GOING LOOP')
                    self.torrent.startSession()
                    self.torrent.continueSession(self.contentId)
                    self.loop()
                    WatchedHistoryDB().add(self.basename, foldername(self.torrent.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize / 1024 / 1024)
                else:
                    break
                debug('************************************* GO NEXT?')
                if self.next_dl and self.next_dling 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('python-libtorrent'),
                                self.localize('Would you like to play next episode?'),
                                self.display_name):
                            break
                    self.contentId = self.next_contentId
                    continue
                debug('************************************* NO! break')
                break

        self.torrent.stopSession()
        self.torrent.threadComplete = True
        self.torrent.checkThread()
        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.'), forced=True)
Exemplo n.º 3
0
    def __init__(self, userStorageDirectory, torrentUrl, params={}):
        self.userStorageDirectory = userStorageDirectory
        self.torrentUrl = torrentUrl
        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():
                        self.setup_subs()
                        self.loop()
                        WatchedHistoryDB().add(self.basename, 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')
                break

        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.'), forced=True)
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
    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
Exemplo n.º 6
0
    def __init__(self, userStorageDirectory, torrentUrl, params={}):
        self.userStorageDirectory = userStorageDirectory
        self.torrentUrl = torrentUrl
        xbmc.Player.__init__(self)
        log("[TorrentPlayer] Initalized")
        self.params = params
        self.get = self.params.get
        self.contentId = int(self.get("url"))
        if self.get("seek"):
            self.seek = int(self.get("seek"))
            log('[TorrentPlayer] Seek=' + str(self.seek))
        self.torrent = Downloader.Torrent(self.userStorageDirectory,
                                          self.torrentUrl,
                                          self.torrentFilesDirectory).player
        try:
            if self.get("url2"):
                self.ids_video = urllib.unquote_plus(
                    self.get("url2")).split(',')
            else:
                self.ids_video = self.get_ids()
        except:
            pass
        self.init()
        self.setup_torrent()
        if self.buffer():
            while True:
                if self.setup_play():
                    debug('************************************* GOING LOOP')
                    self.torrent.startSession()
                    self.torrent.continueSession(self.contentId)
                    WatchedHistoryDB().add(
                        self.basename, self.torrentUrl,
                        foldername(self.torrent.getContentList()[
                            self.contentId]['title']), self.watchedTime,
                        self.totalTime, self.contentId,
                        self.fullSize / 1024 / 1024)
                    self.loop()
                    WatchedHistoryDB().add(
                        self.basename, self.torrentUrl,
                        foldername(self.torrent.getContentList()[
                            self.contentId]['title']), self.watchedTime,
                        self.totalTime, self.contentId,
                        self.fullSize / 1024 / 1024)
                else:
                    break
                debug('************************************* GO NEXT?')
                if self.next_dl and self.next_dling 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('python-libtorrent'),
                                self.localize(
                                    'Would you like to play next episode?'),
                                self.display_name):
                            break
                    self.contentId = self.next_contentId
                    continue
                debug('************************************* NO! break')
                break

        self.torrent.stopSession()
        self.torrent.threadComplete = True
        self.torrent.checkThread()
        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.'))
            else:
                if self.seeding: self.db_delete()
                showMessage(self.localize('Information'),
                            self.localize('Torrent downloading is stopped.'))

        loadsw_onstop()  # Reload Search Window