예제 #1
0
    def get(self, podcastId):
        """Get a podcast by id."""
        args = podcast_parser.parse_args()
        fetch = args.get("fetch")
        max_episodes = args.get("maxEpisodes")
        podcastId = urllib.unquote(podcastId)
        if fetch:
            podcast = Podcast.get_or_fetch(podcastId,
                                           max_episodes=max_episodes)
        else:
            podcast = Podcast.get_by_url(podcastId, max_episodes=max_episodes)

        if podcast == None:
            abort(404, message="Podcast not found: %s" % podcastId)
        podcast.ensure_episode_images()
        return podcast