当前位置: 首页>>代码示例>>Python>>正文


Python Podcast.all_podcasts方法代码示例

本文整理汇总了Python中mygpo.core.models.Podcast.all_podcasts方法的典型用法代码示例。如果您正苦于以下问题:Python Podcast.all_podcasts方法的具体用法?Python Podcast.all_podcasts怎么用?Python Podcast.all_podcasts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mygpo.core.models.Podcast的用法示例。


在下文中一共展示了Podcast.all_podcasts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle

# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import all_podcasts [as 别名]
    def handle(self, *args, **options):

        silent = options.get('silent')

        # couchdbkit doesn't preserve microseconds
        started = datetime.utcnow().replace(microsecond=0)

        podcasts = Podcast.all_podcasts()
        total = Podcast.view('podcasts/by_oldid', limit=0).total_rows

        for n, podcast in enumerate(podcasts):
            subscriber_count = self.get_subscriber_count(podcast)
            self.update(podcast=podcast, started=started, subscriber_count=subscriber_count)

            if not silent:
                progress(n, total)
开发者ID:Mic92,项目名称:mygpo,代码行数:18,代码来源:update-toplist.py

示例2: handle

# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import all_podcasts [as 别名]
    def handle(self, *args, **options):

        total = Podcast.count()
        podcasts = Podcast.all_podcasts()
        actions = Counter()

        for n, podcast in enumerate(podcasts):

            psubscriber = PodcastSubscriberData.for_podcast(podcast.get_id())

            res = self.update_subscriber_data(podcast, data=psubscriber)
            self.update_podcast(podcast=podcast)

            action = 'updated' if res else 'skipped'
            actions[action] += 1

            status_str = ', '.join('%s: %d' % x for x in actions.items())
            progress(n+1, total, status_str)
开发者ID:Mic92,项目名称:mygpo,代码行数:20,代码来源:move-subscriber-data.py

示例3: handle

# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import all_podcasts [as 别名]
    def handle(self, *args, **options):

        get_podcast = itemgetter(0)

        max_related = options.get('max')

        podcasts = Podcast.all_podcasts()
        total = Podcast.view('podcasts/by_id', limit=0).total_rows

        for (n, podcast) in enumerate(podcasts):

            l = calc_similar_podcasts(podcast)[:max_related]

            related = map(get_podcast, l)

            @repeat_on_conflict(['podcast'])
            def _update(podcast, related):
                podcast.related_podcasts = related
                podcast.save()

            _update(podcast=podcast, related=related)

            progress(n+1, total)
开发者ID:Mic92,项目名称:mygpo,代码行数:25,代码来源:update-related-podcasts.py


注:本文中的mygpo.core.models.Podcast.all_podcasts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。