show ratings of podcast lists
[mygpo.git] / mygpo / directory / search.py
blobb5100805a1be211b84fa9374dd2236b610068734
1 from mygpo.utils import is_url
2 from mygpo.data.feeddownloader import PodcastUpdater
3 from mygpo.api.sanitizing import sanitize_url
4 from mygpo.cache import cache_result
5 from mygpo.db.couchdb.podcast import podcast_for_url, search
8 @cache_result(timeout=60*60)
9 def search_podcasts(q, limit=20, skip=0):
11 if is_url(q):
12 url = sanitize_url(q)
14 podcast = podcast_for_url(url, create=True)
16 if not podcast.title:
17 updater = PodcastUpdater([podcast])
18 updater.update()
20 podcast = podcast_for_url(url)
22 return [podcast], 1
25 return search(q, skip, limit)