Beispiel #1
0
    def get_podcasts(cls):
        h_podcastlist = hoerapi.get_podcasts()

        for pod in h_podcastlist:
            data = hoerapi.get_podcast_data(pod.slug)

            if data.rundfunk:
                type = models.TYPE_RADIO
            else:
                type = models.TYPE_PODCAST

            cover = models.Cover.from_url(None, data.imageurl)

            if cover is None:
                logger.debug("could not get cover for %s", pod.slug)

            yield ((
                models.Podcast(
                    creator=None,
                    title=data.title,
                    description=data.description,
                    url=data.url,
                    cover=cover,
                    stream=None,
                    chat=data.chat_url,
                    type=type,
                    import_date=datetime.now(),
                    source=cls.shortname,
                    source_id=data.id
                ),
                models.PodcastSlug(
                    slug=data.slug,
                ),
            ))
Beispiel #2
0
    def get_podcasts(cls):
        h_podcastlist = hoerapi.get_podcasts()

        for pod in h_podcastlist:
            data = hoerapi.get_podcast_data(pod.slug)

            if data.rundfunk:
                type = models.TYPE_RADIO
            else:
                type = models.TYPE_PODCAST

            cover = None
            if data.imageurl:
                cover = models.Cover.from_url(None, data.imageurl)

            if cover is None:
                logger.debug("could not get cover for %s", pod.slug)

            yield ((
                models.Podcast(
                    creator=None,
                    title=data.title,
                    description=data.description,
                    url=data.url,
                    cover=cover,
                    stream=None,
                    chat=data.chat_url,
                    type=type,
                    import_date=datetime.now(),
                    source=cls.shortname,
                    source_id=data.id
                ),
                models.PodcastSlug(
                    slug=data.slug,
                ),
            ))
Beispiel #3
0
def test_get_podcasts():
    pods = hoerapi.get_podcasts()
    assert len(pods) > 0