def setUp(self): MiroTestCase.setUp(self) self.feed = feed.Feed(u"http://feed.org") self.i1 = item.Item(item.FeedParserValues({'title': u'item1'}), feed_id=self.feed.id) self.i2 = item.Item(item.FeedParserValues({'title': u'item2'}), feed_id=self.feed.id) self.feed2 = feed.Feed(u"http://feed.com") self.i3 = item.Item(item.FeedParserValues({'title': u'item3'}), feed_id=self.feed2.id)
def test_track_creation_add(self): self.setup_view(item.Item.make_view("feed.userTitle='booya'", joins={'feed': 'feed.id=item.feed_id'})) i4 = item.Item(item.FeedParserValues({'title': u'item4'}), feed_id=self.feed.id) self.assertEquals(self.add_callbacks, [i4])
def test_phantom_feed_checking(self): f = feed.Feed(u"http://feed.uk") i = item.Item(item.FeedParserValues({}), feed_id=f.id) i2 = item.FileItem(self.make_temp_path('.txt'), feed_id=f.id) self.check_object_list_fails_test([i]) self.check_fix_if_possible([i, i2], []) self.check_object_list_passes_test([i, f]) self.check_object_list_passes_test([])
def download_video(fp_dict): """Takes a feedparser dict, generates an item.Item, adds the item to the manual feed, and sets the item to download. :param fp_dict: feedparser dict specifying metadata for the item """ fp_values = item.FeedParserValues(fp_dict) manual_feed = feed.Feed.get_manual_feed() new_item = item.Item(fp_values, feed_id=manual_feed.get_id()) new_item.download()
def setUp(self): StoreDatabaseTest.setUp(self) self.feed = feed.Feed(u"dtv:savedsearch/all?q=dogs") self.item = item.Item(item.FeedParserValues({'title': u'item1'}), feed_id=self.feed.id) self.downloader = downloader.RemoteDownloader( u'http://example.com/1/item1/movie.mpeg', self.item) self.item.set_downloader(self.downloader) self.tab_order = tabs.TabOrder(u'channel') self.guide = guide.ChannelGuide(u'http://example.com/') self.theme_hist = theme.ThemeHistory() self.view_state = widgetstate.ViewState((u'testtype', u'testid', 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()
def setUp(self): EventLoopTest.setUp(self) self.feed = feed.Feed(u'http://example.com/') self.item = item.Item(item.FeedParserValues({}), feed_id=self.feed.id) self.guide = guide.ChannelGuide(u'http://example.com/guide/')