def _add_default(self, default): # folder if isinstance(default, tuple) and isinstance(default[1], list): defaultFolder = default try: c_folder = folder.ChannelFolder.get_by_title(defaultFolder[0]) except ObjectNotFoundError: c_folder = folder.ChannelFolder(defaultFolder[0]) c_folder.signal_change() for url, autodownload in defaultFolder[1]: logging.info("adding feed %s" % (url, )) d_feed = feed.lookup_feed(default[0]) if d_feed is None: d_feed = feed.Feed(url, initiallyAutoDownloadable=autodownload) d_feed.set_folder(c_folder) d_feed.signal_change() # feed else: d_feed = feed.lookup_feed(default[0]) if d_feed is None: logging.info("adding feed %s" % (default, )) d_feed = feed.Feed(default[0], initiallyAutoDownloadable=default[1]) d_feed.signal_change()
def handle_folder(self, folder_dict, parent_folder): """ Folder subscriptions look like:: { 'type': 'folder', 'title': name of the folder, 'children': a list of sub-feeds } """ assert parent_folder is None, "no nested folders" title = folder_dict['title'] obj = folder.ChannelFolder(title) return self.add_subscriptions(folder_dict['children'], obj)
def add_feeds(urls, new_folder_name=None): """Adds a list of feeds that aren't already added to Miro to Miro. :param urls: list of urls to be added :param new_folder_name: if not None, the feeds will be added to this folder when created. """ if not urls: return if new_folder_name is not None: new_folder = folder.ChannelFolder(new_folder_name) for url in filter_existing_feed_urls(urls): f = feed.Feed(url) if new_folder_name is not None: f.set_folder(new_folder)
def setUp(self): StoreDatabaseTest.setUp(self) self.f1 = feed.Feed(u"http://example.com/1") self.f2 = feed.Feed(u"http://example.com/2") self.folder = folder.ChannelFolder(u'test channel folder') self.tab_order = tabs.TabOrder(u'channel')