def subscribe_by_url(self, url): """Subscribe the user to the podcast at the given feed url.""" podcast = Podcast.get_by_url(url) if podcast == None: id = crawler.fetch(url, subscribe=self).id SubscribeResult(id=id) return SubscribeResult(success=self.subscribe(podcast))
def unsubscribe_by_url(self, url): """Unsubscribe the user from the podcast at the given feed url.""" podcast = Podcast.get_by_url(url) if not podcast: return SubscribeResult(success=False) return SubscribeResult(success=self.unsubscribe(podcast))
def _make_updates(url, data): podcast = Podcast.get_by_url(url) data["previous_urls"] = list(set(podcast.previous_urls).union(data["previous_urls"])) podcast.update(data)
def _make_updates(url, data): podcast = Podcast.get_by_url(url) data["previous_urls"] = list( set(podcast.previous_urls).union(data["previous_urls"])) podcast.update(data)