Esempio n. 1
0
def main():
    from zweb.orm import ormiter
    exist = set()
    for i in ormiter(DoubanFeedOwner):
        topic_id = None
        user_id = None

        feed = DoubanFeed.get(i.id)
        if feed.cid == CID_DOUBAN_FEED_TOPIC:
            group_url = feed.topic_id or i.topic
            group = DoubanGroup.by_url(group_url)
            if not group:
                if not group_url in exist:
                    exist.add(group_url)
                    yield parse_group_htm, 'http://www.douban.com/group/%s/' % group_url

            else:
                topic_id = group

        user_id = feed.user_id or i.owner
        if not (user_id and str(user_id).isdigit()):
            user_id = DoubanUser.by_url(user_id)

        if topic_id is not None and user_id:
            feed.topic_id = topic_id
            feed.user_id = user_id
            feed.save()
            i.delete()
def main():
    from zweb.orm import ormiter

    exist = set()
    for i in ormiter(DoubanFeedOwner):
        topic_id = None
        user_id = None

        feed = DoubanFeed.get(i.id)
        if feed.cid == CID_DOUBAN_FEED_TOPIC:
            group_url = feed.topic_id or i.topic
            group = DoubanGroup.by_url(group_url)
            if not group:
                if not group_url in exist:
                    exist.add(group_url)
                    yield parse_group_htm, "http://www.douban.com/group/%s/" % group_url

            else:
                topic_id = group

        user_id = feed.user_id or i.owner
        if not (user_id and str(user_id).isdigit()):
            user_id = DoubanUser.by_url(user_id)

        if topic_id is not None and user_id:
            feed.topic_id = topic_id
            feed.user_id = user_id
            feed.save()
            i.delete()
Esempio n. 3
0
    def __call__(self, data, url):
        member_num = self.member_num(data)
        group_id = self.group_id(data)
        leader_id = self.leader_id(data)
        name = self.name(data)
        intro = self.intro(data)
        short_url = self.group_short_url(data)

        print name, member_num, leader_id

        group = DoubanGroup.new(group_id, short_url, name)
        group.member = member_num
        group.leader = leader_id
        group.save()
    def __call__(self, data, url):
        member_num = self.member_num(data)
        group_id = self.group_id(data)
        leader_id = self.leader_id(data)
        name = self.name(data)
        intro = self.intro(data)
        short_url = self.group_short_url(data)

        print name, member_num, leader_id

        group = DoubanGroup.new(group_id, short_url, name)
        group.member = member_num
        group.leader = leader_id
        group.save()