1 from mygpo
.podcasts
.models
import Podcast
2 from mygpo
.utils
import is_url
, normalize_feed_url
3 from mygpo
.data
.feeddownloader
import PodcastUpdater
, NoPodcastCreated
4 from mygpo
.search
.index
import search_podcasts
as search
7 def search_podcasts(q
):
10 url
= normalize_feed_url(q
)
13 podcast
= Podcast
.objects
.get(urls__url
=url
)
14 except Podcast
.DoesNotExist
:
17 updater
= PodcastUpdater(url
)
19 if not podcast
or not podcast
.title
:
21 updater
.update_podcast()
22 except NoPodcastCreated
as npc
:
26 podcast
= Podcast
.objects
.get(urls__url
=url
)
28 except Podcast
.DoesNotExist
: