예제 #1
0
def make_item(feed, title):
    """Make a new item."""
    fp_values = item.FeedParserValues({})
    fp_values.data['entry_title'] = title
    fp_values.data['url'] = u'http://example.com/%s.mkv' % title
    # pick a random recent date for the release date
    seconds_ago = random.randint(0, 60 * 60 * 24 * 7)
    release_date = (datetime.datetime.now() -
                    datetime.timedelta(seconds=seconds_ago))
    fp_values.data['release_date'] = release_date
    return models.Item(fp_values, feed_id=feed.id)
예제 #2
0
 def make_item(self, url, title=u'default item title'):
     additional = {'title': title}
     entry = _build_entry(url, 'video/x-unknown', additional)
     item = models.Item(FeedParserValues(entry), feed_id=self.feed.id)
     return itemsource.DatabaseItemSource._item_info_for(item)
예제 #3
0
 def make_info(self, title):
     additional = {'title': title}
     url = u'http://example.com/'
     entry = _build_entry(url, 'video/x-unknown', additional)
     item = models.Item(FeedParserValues(entry), feed_id=self.feed.id)
     return itemsource.DatabaseItemSource._item_info_for(item)
예제 #4
0
 def make_item(self, url, title=u'default item title'):
     additional = {'title': title}
     entry = _build_entry(url, 'video/x-unknown', additional)
     item = models.Item(FeedParserValues(entry), feed_id=self.feed.id)
     self.searcher.add_item(self.make_info(item))
     return item