def __init__(self, poll=True): # Timer self.poll_timer = eTimer() self.poll_timer_conn = self.poll_timer.timeout.connect(self.poll) self.do_poll = poll # this indicates we're reloading the list of feeds self.reloading = False self.newItemFeed = BaseFeed( "", _("New Items"), _("New Items since last Auto-Update"), ) # Generate Feeds self.feeds = [ UniversalFeed(x.uri.value, x.autoupdate.value) for x in config.plugins.simpleRSS.feed ] if not config.plugins.simpleRSS.enable_google_reader.value: if poll: self.poll_timer.start(0, 1) else: self.googleReader = GoogleReader( config.plugins.simpleRSS.google_username.value, config.plugins.simpleRSS.google_password.value) self.googleReader.login().addCallback( self.googleLoggedIn).addErrback(self.googleLoginFailed) # Initialize Vars self.current_feed = 0
def triggerReload(self): self.reloading = True newfeeds = [] oldfeeds = self.feeds found = False for x in config.plugins.simpleRSS.feed: for feed in oldfeeds: if x.uri.value == feed.uri: # Update possibly different autoupdate value feed.autoupdate = x.autoupdate.value newfeeds.append(feed) # Append to new Feeds oldfeeds.remove(feed) # Remove from old Feeds found = True break if not found: newfeeds.append(UniversalFeed(x.uri.value, x.autoupdate.value)) found = False self.feeds = newfeeds if config.plugins.simpleRSS.enable_google_reader.value: self.googleReader = GoogleReader( config.plugins.simpleRSS.google_username.value, config.plugins.simpleRSS.google_password.value) self.googleReader.login().addCallback( self.googleLoggedIn).addErrback(self.googleLoginFailed) else: self.reloading = False
def gotSubscriptionList(self, res = None, defer = None): l = [] if res: dom = cet_fromstring(res) for item in dom.getiterator(): if item.tag == 'string': if item.get('name') == 'id' and item.text.startswith('feed/'): l.append(UniversalFeed(item.text[5:], True, True)) if defer: defer.callback(l)