(self)
return podcast
Update the podcast
Update the podcast
Update the podcast
def update_podcast(self):
        """Update the podcast"""

        with models.PodcastUpdateResult(podcast_url=self.podcast_url) as res:

            parsed, podcast, created = self.parse_feed()

            if not podcast:
                res.podcast_created = False
                res.error_message = '"{}" could not be parsed'.format(self.podcast_url)

                return

            res.podcast = podcast
            res.podcast_created = created

            res.episodes_added = 0
            episode_updater = MultiEpisodeUpdater(podcast, res)

            if not parsed:
                # if it exists already, we mark it as outdated
                self._mark_outdated(
                    podcast, "error while fetching feed", episode_updater
                )
                return

            episode_updater.update_episodes(parsed.get("episodes", []))

            podcast.refresh_from_db()
            podcast.episode_count = episode_updater.count_episodes()
            podcast.save()

            episode_updater.order_episodes()

            self._update_podcast(podcast, parsed, episode_updater, res)

        return podcast
def update_podcast ( self ) : with models . PodcastUpdateResult ( podcast_url = self . podcast_url ) as res : parsed , podcast , created = self . parse_feed ( ) if not podcast : res . podcast_created = False res . error_message = '"{}" could not be parsed' . format ( self . podcast_url ) return res . podcast = podcast res . podcast_created = created res . episodes_added = 0 episode_updater = MultiEpisodeUpdater ( podcast , res ) if not parsed : # if it exists already, we mark it as outdated self . _mark_outdated ( podcast , "error while fetching feed" , episode_updater ) return episode_updater . update_episodes ( parsed . get ( "episodes" , [ ] ) ) podcast . refresh_from_db ( ) podcast . episode_count = episode_updater . count_episodes ( ) podcast . save ( ) episode_updater . order_episodes ( ) self . _update_podcast ( podcast , parsed , episode_updater , res ) return podcast