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))
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()
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()
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)
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)
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))