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
.cache
import cache_result
5 from mygpo
.db
.couchdb
.podcast
import search
8 @cache_result(timeout
=60*60)
9 def search_podcasts(q
, limit
=20, skip
=0):
12 url
= normalize_feed_url(q
)
15 podcast
= Podcast
.objects
.get(urls__url
=url
)
16 except Podcast
.DoesNotExist
:
19 if not podcast
or not podcast
.title
:
21 updater
= PodcastUpdater()
25 except NoPodcastCreated
as npc
:
29 podcast
= Podcast
.objects
.get(urls__url
=url
)
31 except Podcast
.DoesNotExist
:
35 return search(q
, skip
, limit
)