コード例 #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
ファイル: podcastcmd.py プロジェクト: fk-lx/mygpo
 def get_toplist(self, max_podcasts=100):
     toplist = PodcastToplist()
     return individual_podcasts(p for i, p in toplist[:max_podcasts])