Пример #1
0
    def handle(self, *args, **options):

        silent = options.get('silent')

        podcasts = all_podcasts()
        total = podcast_count()

        for n, podcast in enumerate(podcasts):
            update_podcast_subscribers.delay(podcast.get_id())

            if not silent:
                progress(n, total)
Пример #2
0
    def handle(self, *args, **options):

        get_podcast = itemgetter(0)

        max_related = options.get('max')

        podcasts = all_podcasts()
        total = podcast_count()

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

            l = calc_similar_podcasts(podcast)[:max_related]

            related = map(get_podcast, l)

            update_related_podcasts(podcast, related)

            progress(n+1, total)
Пример #3
0
    def handle(self, *args, **options):

        total = podcast_count()
        podcasts = all_podcasts()
        actions = Counter()

        for n, podcast in enumerate(podcasts):

            psubscriber = subscriberdata_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)
Пример #4
0
 def _get_stats(self):
     return {
         'podcasts': podcast_count(),
         'episodes': episode_count(),
         'users': User.count(),
     }