예제 #1
0
    def checkfeedslist(self, fetchllimit, defDir, defStat, defDate, feedset,
                       checknumber):
        delitems = 0
        delitemi = 0
        listits = FeedsList()
        fetchllimit = self.__checklimit(fetchllimit,
                                        listits.all().count(), checknumber)
        feeds = listits.all().filter('fetch_stat < ',
                                     4).fetch(checknumber, fetchllimit)
        s = 0
        i = 0
        updated = []
        logging.info('beging to check the feedslist for No %s to %s',
                     fetchllimit, fetchllimit + checknumber)
        for feed in feeds:
            s += 1
            result = self.__checklistnull(feed, s)
            if result != True:
                logging.info('delete the No. %s items', s)
                feed.delete()

                i += 1
        # check the datetime of lists,and del the older
            else:
                result = self.__checkliststat(feed, s, defDate, defStat)
                if result != True:
                    logging.info('delete the No. %s items', s)
                    feed.delete()

                    i += 1
                else:
                    result = self.__checklisterr(feed, s, defDir)
                    if result != True:
                        logging.info('delete the No. %s items', s)
                        i += 1
                        feed.delete()

        #finished the feedslist check
        #db.put(feeds)
        logging.info('The totel items is %s,and we fixed the %s', s, i)
        delitems = s
        delitemi = i

        feedset.delitems = delitems
        feedset.delitemi = delitemi
        feedset.last_feedslist = fetchllimit + s
        feedset.put()
        return True
예제 #2
0
    def changefeedstat(self, defDate, defStat, feedset, checknumber):
        i = 0
        if defStat == True:
            feed_clean_date = datetime.now() - timedelta(days=14)
            listit = FeedsList()
            #TODO the fetch_stat=2,is mean the feeds maybe can try to seconds fetch,so we change the stat=0
            feeds = listit.all().filter('date <', feed_clean_date).filter(
                'fetch_stat = ', 2).fetch(int(checknumber))
            logging.info('Start to change the feedslist stat')
            for feed in feeds:
                feed.fetch_stat = 0
                i += 1
            db.put(feeds)
            logging.info('finish!fixed %s', i)
        else:
            logging.info('nothing need to be change')

        feedset.chnitemi = i
        feedset.put()
예제 #3
0
파일: feedblog.py 프로젝트: alexliyu/lincdm
 def get(self):
     listit = FeedList()
     feeds = listit.all()
     listits = FeedsList()
     self.getFeed()