show ratings of podcast lists
[mygpo.git] / mygpo / userfeeds / feeds.py
blobe34a2690c442c72a2813b2103203fe0fa7d8ef43
1 from django.core.urlresolvers import reverse
3 from mygpo.db.couchdb.episode import favorite_episodes_for_user
7 class FavoriteFeed():
9 def __init__(self, user):
10 self.user = user
12 def title(self):
13 return '%s\'s Favorite Episodes' % self.user.username
15 def get_episodes(self):
16 return favorite_episodes_for_user(self.user)
18 def language(self):
19 """
20 If all of the feed's episodes have the same language, return it,
21 otherwise return an empty string
22 """
23 l = list(set([x.language for x in self.get_episodes() if x.language]))
24 if len(l) == 1:
25 return l[0]
26 else:
27 return ''
29 def get_public_url(self, domain):
30 return 'http://%s%s' % (domain, reverse('favorites-feed', args=[self.user.username]))