Esempio n. 1
0
def episode_for_slug_id(p_slug_id, e_slug_id):
    """ Returns the Episode for Podcast Slug/Id and Episode Slug/Id """

    if not p_slug_id:
        raise QueryParameterMissing('p_slug_id')

    if not e_slug_id:
        raise QueryParameterMissing('e_slug_id')


    # The Episode-Id is unique, so take that
    if is_couchdb_id(e_slug_id):
        return episode_by_id(e_slug_id)

    # If we search using a slug, we need the Podcast's Id
    if is_couchdb_id(p_slug_id):
        p_id = p_slug_id
    else:
        podcast = podcast_for_slug_id(p_slug_id)

        if podcast is None:
            return None

        p_id = podcast.get_id()

    return episode_for_slug(p_id, e_slug_id)
Esempio n. 2
0
def podcast_for_slug_id(slug_id):
    """ Returns the Podcast for either an CouchDB-ID for a Slug """

    if is_couchdb_id(slug_id):
        return podcast_by_id(slug_id)
    else:
        return podcast_for_slug(slug_id)
Esempio n. 3
0
def podcastgroup_for_slug_id(slug_id):
    """ Returns the Podcast for either an CouchDB-ID for a Slug """

    if not slug_id:
        raise QueryParameterMissing('slug_id')

    if is_couchdb_id(slug_id):
        return podcastgroup_by_id(slug_id)

    else:
        #TODO: implement
        return PodcastGroup.for_slug(slug_id)