Esempio n. 1
0
    def post(self, request):
        user = request.user

        feed = FavoriteFeed(user)
        site = RequestSite(request)
        feed_url = feed.get_public_url(site.domain)

        podcast = Podcast.objects.get_or_create_for_url(feed_url)

        PublishedPodcast.objects.get_or_create(
            podcast=podcast,
            publisher=user,
        )

        update_podcast(feed_url)

        return HttpResponseRedirect(reverse('share-favorites'))
Esempio n. 2
0
    def post(self, request):
        user = request.user

        feed = FavoriteFeed(user)
        site = RequestSite(request)
        feed_url = feed.get_public_url(site.domain)

        podcast = Podcast.objects.get_or_create_for_url(feed_url)

        PublishedPodcast.objects.get_or_create(
            podcast=podcast,
            publisher=user,
        )

        update_podcast(feed_url)

        return HttpResponseRedirect(reverse('share-favorites'))
Esempio n. 3
0
def search_podcasts(q):

    if is_url(q):
        url = normalize_feed_url(q)

        try:
            podcast = Podcast.objects.get(urls__url=url)
        except Podcast.DoesNotExist:
            podcast = None

        if not podcast or not podcast.title:
            try:
                update_podcast(url)
            except NoPodcastCreated as npc:
                return []

        try:
            podcast = Podcast.objects.get(urls__url=url)
            return [podcast]
        except Podcast.DoesNotExist:
            return []

    return search(q)