def get_podcasts(self): """ Returns the podcasts with the current tag. Some podcasts might be returned twice """ res = multi_request_view(Podcast, 'podcasts/by_tag', wrap = False, startkey = [self.tag, None], endkey = [self.tag, {}], reduce = True, group = True, group_level = 2 ) for r in res: yield (r['key'][1], r['value']) res = multi_request_view(Podcast, 'usertags/podcasts', wrap = False, startkey = [self.tag, None], endkey = [self.tag, {}], reduce = True, group = True, group_level = 2 ) for r in res: yield (r['key'][1], r['value'])
def __iter__(self): return multi_request_view( self.cls, "slugs/missing", startkey=[self.doc_type] + self.end, endkey=[self.doc_type] + self.start, descending=True, include_docs=True, reduce=False, wrapper=self.wrapper, auto_advance=False, **self.kwargs )
def all(cls): """ Returns all tags Some tags might be returned twice """ res = multi_request_view(Podcast, 'podcasts/by_tag', wrap = False, reduce = True, group = True, group_level = 1 ) for r in res: yield r['key'][0] res = multi_request_view(Podcast, 'usertags/podcasts', wrap = False, reduce = True, group = True, group_level = 1 ) for r in res: yield r['key'][0]
def all_podcasts(cls): res = utils.multi_request_view(cls, 'podcasts/by_id', wrap = False, include_docs = True, stale = 'update_after', ) for r in res: obj = r['doc'] if obj['doc_type'] == 'Podcast': yield Podcast.wrap(obj) else: pid = r[u'key'] pg = PodcastGroup.wrap(obj) podcast = pg.get_podcast_by_id(pid) yield podcast
def all(cls): return utils.multi_request_view(cls, 'episodes/by_podcast', reduce = False, include_docs = True, stale = 'update_after', )
def get_view_count_iter(cls, view, *args, **kwargs): iterator = utils.multi_request_view(cls, view, *args, **kwargs) total = cls.view(view, limit=0).total_rows return iterator, total