本文整理汇总了Python中mygpo.core.models.Podcast.count方法的典型用法代码示例。如果您正苦于以下问题:Python Podcast.count方法的具体用法?Python Podcast.count怎么用?Python Podcast.count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygpo.core.models.Podcast
的用法示例。
在下文中一共展示了Podcast.count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import count [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)
示例2: welcome
# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import count [as 别名]
def welcome(request):
current_site = RequestSite(request)
podcasts = get_cache_or_calc('podcast-count', timeout=60*60,
calc=lambda: Podcast.count())
users = get_cache_or_calc('user-count', timeout=60*60,
calc=lambda: User.count())
episodes = get_cache_or_calc('episode-count', timeout=60*60,
calc=lambda: Episode.count())
lang = utils.process_lang_params(request)
toplist = PodcastToplist(lang)
return render(request, 'home.html', {
'podcast_count': podcasts,
'user_count': users,
'episode_count': episodes,
'url': current_site,
'toplist': toplist,
})