コード例 #1
0
ファイル: sump.py プロジェクト: mickaobrien/sump
    def add_torrent(self, url, torrent_type):
        if url.startswith('magnet:?'):
            handle = lt.add_magnet_uri(self.session, url, self.params)
        else:
            params = self.params
            params['url'] = url
            handle = self.session.add_torrent(params)
            while (not handle.has_metadata()):
                time.sleep(1)

        return hashify(handle.info_hash().to_string())
コード例 #2
0
ファイル: sump.py プロジェクト: mickaobrien/sump
    def add_torrent(self, url, torrent_type):
        if url.startswith('magnet:?'):
            handle = lt.add_magnet_uri(self.session, url, self.params)
        else:
            params = self.params
            params['url'] = url
            handle = self.session.add_torrent(params)
            while (not handle.has_metadata()):
                time.sleep(1)

        return hashify(handle.info_hash().to_string())
コード例 #3
0
ファイル: sump.py プロジェクト: mickaobrien/sump
    def remove_completed(self):
        torrents = self.session.get_torrents()
        finished_torrents = [t for t in torrents if t.is_finished()]
        
        if not finished_torrents:
            return

        names = ['%s' % t.name() for t in finished_torrents]
        hashes = [hashify(t.info_hash().to_string()) for t in finished_torrents]

        for t in finished_torrents:
            self.session.remove_torrent(t)

        keys = [self.key_from_hash(h) for h in hashes]
        for k, name in zip(keys, names):
            self.db.update(k, '{"downloaded":true}')
            #move downloaded stuff from paths based on type
            self.organise_file(name, self.data[k]['type'])
        self.rename_files()
        self.move_renamed()
コード例 #4
0
ファイル: sump.py プロジェクト: mickaobrien/sump
    def remove_completed(self):
        torrents = self.session.get_torrents()
        finished_torrents = [t for t in torrents if t.is_finished()]

        if not finished_torrents:
            return

        names = ['%s' % t.name() for t in finished_torrents]
        hashes = [
            hashify(t.info_hash().to_string()) for t in finished_torrents
        ]

        for t in finished_torrents:
            self.session.remove_torrent(t)

        keys = [self.key_from_hash(h) for h in hashes]
        for k, name in zip(keys, names):
            self.db.update(k, '{"downloaded":true}')
            #move downloaded stuff from paths based on type
            self.organise_file(name, self.data[k]['type'])
        self.rename_files()
        self.move_renamed()