示例#1
0
文件: podcastcmd.py 项目: fk-lx/mygpo
    def _get_podcasts(self, *args, **options):

        max_podcasts = options.get('max')

        if options.get('toplist'):
            yield (p.url for p in self.get_toplist(max_podcasts))

        if options.get('new'):
            podcasts = list(podcasts_need_update(limit=max_podcasts))
            random.shuffle(podcasts)
            yield (p.url for p in podcasts)

        if options.get('random'):
            # no need to pass "max" to random_podcasts, it uses chunked queries
            podcasts = random_podcasts()
            yield (p.url for p in individual_podcasts(podcasts))

        if options.get('next'):
            podcasts = podcasts_by_next_update(limit=max_podcasts)
            yield (p.url for p in individual_podcasts(podcasts))


        if args:
            yield args

        if not args and not options.get('toplist') and not options.get('new') \
                    and not options.get('random')  and not options.get('next'):
            podcasts = podcasts_by_last_update(limit=max_podcasts)
            yield (p.url for p in podcasts_by_last_update())
示例#2
0
文件: views.py 项目: fk-lx/mygpo
    def _get_feed_queue_status(self):
        now = datetime.utcnow()
        next_podcast = podcasts_by_next_update(limit=1)[0]

        delta = (next_podcast.next_update - now)
        delta_mins = delta.total_seconds() / 60
        return delta_mins