Exemple #1
0
    def get_podcast(self, url):
        """Get a specific podcast by URL

        Returns a podcast object for the URL or None if
        the podcast has not been subscribed to.
        """
        url = util.normalize_feed_url(url)
        channel = PodcastChannel.load(self._db, url, create=False, download_dir=self._config.download_dir)
        if channel is None:
            return None
        else:
            return Podcast(channel, self)
Exemple #2
0
    def get_podcast(self, url):
        """Get a specific podcast by URL

        Returns a podcast object for the URL or None if
        the podcast has not been subscribed to.
        """
        url = util.normalize_feed_url(url)
        channel = PodcastChannel.load(self._db, url, create=False, download_dir=self._config.download_dir)
        if channel is None:
            return None
        else:
            return Podcast(channel, self)
Exemple #3
0
    def create_podcast(self, url, title=None):
        """Subscribe to a new podcast

        Add a subscription for "url", optionally
        renaming the podcast to "title" and return
        the resulting object.
        """
        url = util.normalize_feed_url(url)
        podcast = PodcastChannel.load(self._db, url, create=True, \
                max_episodes=self._config.max_episodes_per_feed, \
                download_dir=self._config.download_dir, \
                allow_empty_feeds=self._config.allow_empty_feeds)
        if podcast is not None:
            if title is not None:
                podcast.set_custom_title(title)
            podcast.save()
            return Podcast(podcast, self)

        return None
Exemple #4
0
    def create_podcast(self, url, title=None):
        """Subscribe to a new podcast

        Add a subscription for "url", optionally
        renaming the podcast to "title" and return
        the resulting object.
        """
        url = util.normalize_feed_url(url)
        podcast = PodcastChannel.load(self._db, url, create=True, \
                max_episodes=self._config.max_episodes_per_feed, \
                download_dir=self._config.download_dir, \
                allow_empty_feeds=self._config.allow_empty_feeds, \
                mimetype_prefs=self._config.mimetype_prefs)
        if podcast is not None:
            if title is not None:
                podcast.set_custom_title(title)
            podcast.save()
            return Podcast(podcast, self)

        return None