コード例 #1
0
ファイル: test_loader.py プロジェクト: DKILLER123/seedbox
    def test_load_torrents_still_downloading(self):

        def _is_torrent_downloading(media_items):
            return True

        self.patch(loader, '_is_torrent_downloading', _is_torrent_downloading)
        loader.load_torrents(self.dbapi)
コード例 #2
0
ファイル: test_loader.py プロジェクト: DKILLER123/seedbox
    def test_load_torrents_no_parse(self):
        for tor in glob.glob(os.path.join(torrent_path, '*.torrent')):
            _tor = models.Torrent.make_empty()
            _tor.name = os.path.basename(tor)
            _tor.invalid = True
            self.dbapi.save_torrent(_tor)

        loader.load_torrents(self.dbapi)
コード例 #3
0
ファイル: test_loader.py プロジェクト: DKILLER123/seedbox
    def test_load_torrents_parse_error(self):

        class TorrentParser(object):

            def __init__(self, tfile):
                raise parser.ParsingError('failed to parse')

        self.patch(parser, 'TorrentParser', TorrentParser)
        loader.load_torrents(self.dbapi)
コード例 #4
0
ファイル: __init__.py プロジェクト: shad7/seedbox
def _get_work(dbapi):

    # search through the directory of torrents and load any
    # new ones into the cache.
    loader.load_torrents(dbapi)

    flows = []
    # now retrieve any torrents that are eligible for processing
    # and kick off the workflows.
    for tor in dbapi.get_torrents_active():
        # need to make sure there are actually media files that
        # were parsed for the torrent.
        LOG.debug("torrent %s media files: %s", tor.torrent_id, tor.media_files)
        if tor.media_files:
            LOG.debug("creating workflow for torrent: %s", tor)
            flows.append(workflow.Workflow(dbapi, tor))

    return flows
コード例 #5
0
ファイル: test_loader.py プロジェクト: DKILLER123/seedbox
 def test_load_torrents(self):
     loader.load_torrents(self.dbapi)