예제 #1
0
def make_file_item(feed, title=None, path=None, ext='.avi'):
    if path is None:
        path = current_test.make_temp_path(ext)
    ensure_file_exists(path)
    return models.FileItem(path,
                           feed.id,
                           fp_values=item.fp_values_for_file(path, title))
예제 #2
0
def add_torrent(path, torrent_info_hash):
    manual_feed = feed.Feed.get_manual_feed()
    for i in manual_feed.items:
        if ((i.downloader is not None
             and i.downloader.status.get('infohash') == torrent_info_hash)):
            logging.info("not downloading %s, it's already a download for %s",
                         path, i)
            if i.downloader.get_state() in ('paused', 'stopped'):
                i.download()
            return
    new_item = item.Item(item.fp_values_for_file(path),
                         feed_id=manual_feed.get_id())
    new_item.download()
예제 #3
0
def add_torrent(path, torrent_info_hash):
    manual_feed = feed.Feed.get_manual_feed()
    for i in manual_feed.items:
        if ((i.downloader is not None
             and i.downloader.info_hash == torrent_info_hash)):
            logging.info("not downloading %s, it's already a download for %s",
                         path, i)
            if i.downloader.get_state() in ('paused', 'stopped'):
                i.download()
            return
    new_item = item.Item(item.fp_values_for_file(path),
                         feed_id=manual_feed.get_id())
    new_item.download()
예제 #4
0
파일: conversions.py 프로젝트: cool-RR/Miro
def _create_item_for_conversion(filename, source_info, conversion_name):
    """Make a new FileItem for a converted file."""

    # Note: We are adding things to the database.  This function
    # should only get called in the event loop.

    name = _(
        "%(original_name)s (Converted to %(format)s)", {"original_name": source_info.name, "format": conversion_name}
    )

    fp_values = item.fp_values_for_file(filename, name, source_info.description)
    manual_feed = models.Feed.get_manual_feed()
    models.FileItem(filename, feed_id=manual_feed.id, fp_values=fp_values)
예제 #5
0
파일: conversions.py 프로젝트: kfatehi/miro
def _create_item_for_conversion(filename, source_info, conversion_name):
    """Make a new FileItem for a converted file."""

    # Note: We are adding things to the database.  This function
    # should only get called in the event loop.

    name = _('%(original_name)s (Converted to %(format)s)',
            {'original_name': source_info.name, 'format': conversion_name})

    fp_values = item.fp_values_for_file(filename, name,
            source_info.description)
    manual_feed = models.Feed.get_manual_feed()
    models.FileItem(filename, feed_id=manual_feed.id,
                    fp_values=fp_values)
예제 #6
0
def make_file_item(feed, title=None, path=None):
    if path is None:
        path = current_test.make_temp_path('.avi')
    ensure_file_exists(path)
    return models.FileItem(path, feed.id,
                           fp_values=item.fp_values_for_file(path, title))