Ejemplo n.º 1
0
    def getFeedData(self, feedUrl, count):
        keyName = str(hash(feedUrl) * hash(feedUrl)) + '_' + str(count)

        feedDataSettings = GetFeedDataSettings(feedUrl)

        if feedDataSettings is None:
            logging.debug(
                'getFeedData => feedDataSettings is None. Why?!? %s keyName', feedUrl, keyName)
        else:
            if count == '-1':
                feedData = feedDataSettings.private_data
                priorData = feedDataSettings.feedDataCount
            else:
                fd = FeedData.get_by_id(keyName)
                if fd is None:
                    logging.debug('getFeedData => fd is None. Why?!?')
                    # ' %s keyName, feedUrl: ', keyName, feedUrl)
                    feedData = ''
                else:
                    feedData = fd.private_data
                priorData = int(count) - 1
                if count == '-1':
                    count = -2

        return feedData, keyName, priorData, feedDataSettings.article_count
Ejemplo n.º 2
0
    def findArticles(self, feedUrl, feedDataSettings):
        feedDataCount = 1
        articlesToMarkAsRead = self.findArticlesFromFeedData(
            feedDataSettings.private_data)

        while (feedDataCount <= feedDataSettings.feedDataCount):
            id = str(hash(feedUrl) * hash(feedUrl)) + '_' + str(feedDataCount)
            # memory hog otherwise!!!
            fd = FeedData.get_by_id(id, use_cache=False, use_memcache=False)
            if fd.private_data is not None and fd.private_data != '':
                articlesToMarkAsRead = articlesToMarkAsRead + \
                    self.findArticlesFromFeedData(fd.private_data)

            feedDataCount = feedDataCount + 1

        return articlesToMarkAsRead