示例#1
0
文件: tags.py 项目: Mic92/mygpo
    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'])
示例#2
0
文件: slugs.py 项目: Mic92/mygpo
    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
        )
示例#3
0
文件: tags.py 项目: Mic92/mygpo
    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]
示例#4
0
文件: models.py 项目: Mic92/mygpo
    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
示例#5
0
文件: models.py 项目: Mic92/mygpo
 def all(cls):
     return utils.multi_request_view(cls, 'episodes/by_podcast',
             reduce       = False,
             include_docs = True,
             stale        = 'update_after',
         )
示例#6
0
文件: merge.py 项目: Mic92/mygpo
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