Beispiel #1
0
            endkey       = [podcast.get_id(), until],
            include_docs = True,
            reduce       = False,
            **kwargs
        )

    episodes = list(res)

    for episode in episodes:
        if episode.needs_update:
            incomplete_obj.send_robust(sender=episode)

    return episodes


episodes_for_podcast = cache_result(timeout=60*60)(episodes_for_podcast_uncached)


@cache_result(timeout=60*60)
def episode_count_for_podcast(podcast, since=None, until={}, **kwargs):

    if not podcast:
        raise QueryParameterMissing('podcast')


    if kwargs.get('descending', False):
        since, until = until, since

    if isinstance(since, datetime):
        since = since.isoformat()
Beispiel #2
0
    podcast = get_single_result(db, 'podcasts/by_id',
            key          = podcast_id,
            include_docs = True,
            wrapper      = _wrap_podcast_group,
        )

    if not podcast:
        return None

    if podcast.needs_update:
        incomplete_obj.send_robust(sender=podcast)

    return podcast


podcast_by_id = cache_result(timeout=60*60)(podcast_by_id_uncached)


@cache_result(timeout=60*60)
def podcastgroup_by_id(group_id):

    if not group_id:
        raise QueryParameterMissing('group_id')

    pg = PodcastGroup.get(group_id)

    if pg.needs_update:
        incomplete_obj.send_robust(sender=pg)

    return pg
Beispiel #3
0
    if not tag:
        raise QueryParameterMissing('tag')

    db = get_categories_database()
    cat = get_single_result(db, 'categories/by_tags',
            key          = tag,
            include_docs = True,
            stale        = 'update_after',
            schema       = Category
        )

    return cat


category_for_tag = cache_result(timeout=60*60)(category_for_tag_uncached)


@cache_result(timeout=60*60)
def top_categories(offset, count, with_podcasts=False):

    if offset is None:
        raise QueryParameterMissing('offset')

    if not count:
        raise QueryParameterMissing('count')

    db = get_categories_database()

    if with_podcasts:
        r = db.view('categories/by_update',