コード例 #1
0
def genero_feed(episodesList):
    if episodesList:
        # Creo un nuovo podcast
        p = Podcast()

        p.name = "NECST Tech Time"
        p.description = "The NECSTLab (Novel, Emerging Computing System Technologies Laboratory) is a laboratory inside DEIB department of Politecnico di Milano, where there are a number of different research lines on advanced topics in computing systems: from architectural characteristics, to hardware-software codesign methodologies, to security and dependability issues of complex system architectures (scaling from mobile devices to large virtualized datacenters)."
        p.website = "http://www.poliradio.it/podcast/programmi/34/necst-tech-time"
        p.explicit = True
        p.image = "https://rss.draghetti.it/necst_image.jpg"
        p.feed_url = "https://rss.draghetti.it/necstpodcast.xml"
        p.copyright = "Poli Radio"
        p.language = "it-IT"

        for episodedetails in episodesList:
            episode = Episode()

            episode.title = episodedetails[1].encode("ascii", "ignore")
            episode.link = episodedetails[2].encode("ascii", "ignore")

            # La dimensione e statistica in base alle puntante analizzate
            episode.media = Media(episodedetails[3], 30000000, type="audio/x-m4a", duration=None)
            episode.publication_date = episodedetails[4]

            p.episodes.append(episode)

        # Print to stdout, just as an example
        p.rss_file(rssfile, minimize=False)
コード例 #2
0
def genero_feed(puntateList):
    if puntateList:
        # Creo un nuovo podcast
        p = Podcast()

        p.name = "Il Ruggito del Coniglio"
        p.description = "Il Ruggito del Coniglio, il programma cult di Radio 2 condotto da Marco Presta e Antonello Dose, racconta l'attualita con folgorante ironia."
        p.website = "http://www.raiplayradio.it/programmi/ilruggitodelconiglio/"
        p.explicit = True
        p.image = "https://rss.draghetti.it/ruggitodelconiglio_image.jpg"
        p.feed_url = "https://rss.draghetti.it/ruggitodelconiglio.xml"
        p.copyright = "Rai Radio 2"
        p.language = "it-IT"

        for puntata in puntateList:
            episode = Episode()

            episode.title = puntata[0].encode("ascii", "ignore")
            episode.link = puntata[1]

            # La dimensione del file e approssimativa
            episode.media = Media(puntata[3], puntata[4])

            if puntata[2]:
                episode.publication_date = datetime.datetime(int(puntata[2].split("/")[2]),
                                                             int(puntata[2].split("/")[1]),
                                                             int(puntata[2].split("/")[0]), 10,
                                                             00, tzinfo=pytz.utc)
            else:
                episode.publication_date = pytz.utc.localize(datetime.datetime.utcnow())

            p.episodes.append(episode)

        # Print to stdout, just as an example
        p.rss_file(rssfile, minimize=False)
コード例 #3
0
def genero_feed(episodesList):
    if episodesList:
        # Creo un nuovo podcast
        p = Podcast()

        p.name = "NECST Tech Time"
        p.description = "Feed Podcast non ufficiale di NECST Tech Time - Powered By Andrea Draghetti"
        p.website = "http://www.poliradio.it/podcast/programmi/34/necst-tech-time"
        p.explicit = True
        p.image = "https://rss.draghetti.it/necst_image.jpg"
        p.feed_url = "https://rss.draghetti.it/necstpodcast.xml"
        p.copyright = "Poli Radio"
        p.language = "it-IT"

        for episodedetails in episodesList:
            episode = Episode()

            episode.title = episodedetails[1].encode("ascii", "ignore")
            episode.link = episodedetails[2].encode("ascii", "ignore")

            # La dimensione e statistica in base alle puntante analizzate
            episode.media = Media(episodedetails[3],
                                  30000000,
                                  type="audio/x-m4a",
                                  duration=None)
            episode.publication_date = episodedetails[4]

            p.episodes.append(episode)

        # Print to stdout, just as an example
        p.rss_file(rssfile, minimize=False)
コード例 #4
0
def genero_feed(episodesList):
    if episodesList:
        # Creo un nuovo podcast
        p = Podcast()

        p.name = "All You Can Dance by Dino Brawn"
        p.description = "Feed Podcast non ufficiale di All You Can Dance by Dino Brown - Powered By Andrea Draghetti"
        p.website = "https://onedance.fm/"
        p.explicit = True
        p.image = "https://rss.draghetti.it/allyoucandance_image.jpg"
        p.feed_url = "https://rss.draghetti.it/allyoucandance.xml"
        p.copyright = "One Dance"
        p.language = "it-IT"

        for episodedetails in episodesList:
            episode = Episode()

            episode.title = episodedetails[1].encode("ascii", "ignore")
            episode.link = episodedetails[2].encode("ascii", "ignore")

            # La dimensione e statistica in base alle puntante analizzate
            episode.media = Media(episodedetails[3], 30000000, type="audio/x-m4a", duration=None)
            episode.publication_date = episodedetails[4]

            p.episodes.append(episode)

        # Print to stdout, just as an example
        p.rss_file(rssfile, minimize=False)
コード例 #5
0
ファイル: pascal.py プロジェクト: drego85/CarolaFeed
def genero_feed(puntateList):
    if puntateList:
        # Creo un nuovo podcast
        p = Podcast()

        p.name = "Pascal Rai Radio 2"
        p.description = "Pascal un programma di Matteo Caccia in onda su Radio2 che racconta storie di vita. Episodi grandi o piccoli, stravolgenti o minuti, momenti che hanno modificato per sempre la nostra vita o che, anche se di poco, l'hanno indirizzata. Storie che sono il termometro della temperatura di ognuno di noi e che in parte raccontano chi siamo. "
        p.website = "http://www.raiplayradio.it/programmi/pascal/"
        p.explicit = True
        p.image = "https://rss.draghetti.it/pascal_image.jpg"
        p.feed_url = "https://rss.draghetti.it/pascal.xml"
        p.copyright = "Rai Radio 2"
        p.language = "it-IT"

        for puntata in puntateList:
            episode = Episode()

            episode.title = puntata[0].encode("ascii", "ignore")
            episode.link = puntata[1]

            # La dimensione del file e approssimativa
            episode.media = Media(puntata[3], puntata[4])

            if puntata[2]:
                episode.publication_date = datetime.datetime(int(puntata[2].split("/")[2]),
                                                             int(puntata[2].split("/")[1]),
                                                             int(puntata[2].split("/")[0]), 20,
                                                             00, tzinfo=pytz.utc)
            else:
                episode.publication_date = pytz.utc.localize(datetime.datetime.utcnow())

            p.episodes.append(episode)

        # Print to stdout, just as an example
        p.rss_file(rssfile, minimize=False)
コード例 #6
0
ファイル: audiopod.py プロジェクト: YangVincent/audiopod
def generate_podcast_xml(base, books):
    from podgen import Podcast, Episode
    from datetime import timedelta
    from podgen import Media

    p = Podcast()

    p.name = "AeonNeo's Audiobooks"
    p.description = "Description"
    p.website = "www.yangvincent.com"
    p.explicit = False

    # create episode
    for book_name in books:
        ep = Episode()
        ep.title = book_name[:-4]
        full_path = base + '/files/' + book_name
        dev_path = 'files/' + book_name
        try:
            book_size = os.path.getsize(dev_path)
        except OSError as e:
            print(e)
            book_size = 0

        ep.media = Media(full_path, type='audio/mp4a', size=book_size)
        p.episodes.append(ep)

    # Generate rss
    p.rss_file('skeleton/rss.xml', minimize=True)
コード例 #7
0
def genero_feed(puntateList):
    if puntateList:
        # Creo un nuovo podcast
        p = Podcast()

        p.name = "Il Ruggito del Coniglio"
        p.description = "Il Ruggito del Coniglio, il programma cult di Radio 2 condotto da Marco Presta e Antonello Dose, racconta l'attualita con folgorante ironia."
        p.website = "http://www.raiplayradio.it/programmi/ilruggitodelconiglio/"
        p.explicit = True
        p.image = "https://rss.draghetti.it/ruggitodelconiglio_image.jpg"
        p.feed_url = "https://rss.draghetti.it/ruggitodelconiglio.xml"
        p.copyright = "Rai Radio 2"
        p.language = "it-IT"

        for puntata in puntateList:
            episode = Episode()

            episode.title = puntata[0].encode("ascii", "ignore")
            episode.link = puntata[1]

            # La dimensione del file e approssimativa
            episode.media = Media(puntata[3], puntata[4])

            if puntata[2]:
                episode.publication_date = datetime.datetime(int(puntata[2].split("/")[2]),
                                                             int(puntata[2].split("/")[1]),
                                                             int(puntata[2].split("/")[0]), 10,
                                                             00, tzinfo=pytz.utc)
            else:
                episode.publication_date = pytz.utc.localize(datetime.datetime.utcnow())

            p.episodes.append(episode)

        # Print to stdout, just as an example
        p.rss_file(rssfile, minimize=False)
コード例 #8
0
    def test_idNotSetButEnclosureIsUsed(self):
        guid = "http://example.com/podcast/episode1.mp3"
        episode = Episode()
        episode.title = "My first episode"
        episode.media = Media(guid, 97423487, "audio/mpeg")

        item = episode.rss_entry()
        assert item.find("guid").text == guid
コード例 #9
0
ファイル: test_episode.py プロジェクト: tobinus/python-podgen
    def test_idNotSetButEnclosureIsUsed(self):
        guid = "http://example.com/podcast/episode1.mp3"
        episode = Episode()
        episode.title = "My first episode"
        episode.media = Media(guid, 97423487, "audio/mpeg")

        item = episode.rss_entry()
        assert item.find("guid").text == guid
コード例 #10
0
    def test_idSetToFalseSoEnclosureNotUsed(self):
        episode = Episode()
        episode.title = "My first episode"
        episode.media = Media("http://example.com/podcast/episode1.mp3",
                              34328731, "audio/mpeg")
        episode.id = False

        item = episode.rss_entry()
        assert item.find("guid") is None
コード例 #11
0
ファイル: test_episode.py プロジェクト: tobinus/python-podgen
    def test_idSetToFalseSoEnclosureNotUsed(self):
        episode = Episode()
        episode.title = "My first episode"
        episode.media = Media("http://example.com/podcast/episode1.mp3",
                            34328731, "audio/mpeg")
        episode.id = False

        item = episode.rss_entry()
        assert item.find("guid") is None
コード例 #12
0
ファイル: app.py プロジェクト: candyer/audioCast
def rss(url_token):
    dropbox_access_token, title, description = get_the_latest_token_info(
        url_token)
    urls = get_temporary_link(dropbox_access_token)
    p = Podcast()
    p.name = title
    p.description = description
    p.website = "https://www.google.com"
    p.explicit = True

    for i, (size, url, uid, name) in enumerate(urls):
        my_episode = Episode()
        my_episode.title = os.path.splitext(name)[0]
        my_episode.id = uid
        my_episode.media = Media(url, size=size, type="audio/mpeg")
        p.episodes.append(my_episode)
    return Response(str(p), mimetype='text/xml')
コード例 #13
0
ファイル: app.py プロジェクト: candyer/Flask
def index():
	'''https://podgen.readthedocs.io/en/latest/'''
	urls = get_temporary_link()
	p = Podcast()
	p.name = "ambience"
	p.description = "ambience"
	p.website = "LINK HERE"
	p.explicit = True	

	for i, (size, url) in enumerate(urls):
		my_episode = Episode()
		my_episode.title = "ambience music {}".format(i + 1)
		my_episode.media = Media(url,
								 size=size,
								 type="audio/mpeg")
		p.episodes.append(my_episode)

	rss = str(p)
	return Response(rss, mimetype='text/xml')
コード例 #14
0
def genero_feed(puntateList):
    if puntateList:
        # Creo un nuovo podcast
        p = Podcast()

        p.name = "Pascal Rai Radio 2"
        p.description = "Pascal un programma di Matteo Caccia in onda su Radio2 che racconta storie di vita. Episodi grandi o piccoli, stravolgenti o minuti, momenti che hanno modificato per sempre la nostra vita o che, anche se di poco, l'hanno indirizzata. Storie che sono il termometro della temperatura di ognuno di noi e che in parte raccontano chi siamo. "
        p.website = "http://www.raiplayradio.it/programmi/pascal/"
        p.explicit = True
        p.image = "https://rss.draghetti.it/pascal_image.jpg"
        p.feed_url = "https://rss.draghetti.it/pascal.xml"
        p.copyright = "Rai Radio 2"
        p.language = "it-IT"

        for puntata in puntateList:
            episode = Episode()

            episode.title = puntata[0].encode("ascii", "ignore")
            episode.link = puntata[1]

            # La dimensione del file e approssimativa
            episode.media = Media(puntata[3], puntata[4])

            if puntata[2]:
                episode.publication_date = datetime.datetime(
                    int(puntata[2].split("/")[2]),
                    int(puntata[2].split("/")[1]),
                    int(puntata[2].split("/")[0]),
                    20,
                    00,
                    tzinfo=pytz.utc)
            else:
                episode.publication_date = pytz.utc.localize(
                    datetime.datetime.utcnow())

            p.episodes.append(episode)

        # Print to stdout, just as an example
        p.rss_file(rssfile, minimize=False)
コード例 #15
0
ファイル: folderpodgen.py プロジェクト: danohu/folderpodgen
def generate(name, description, website, explicit, image, author_name,
             author_email, feed_path, copyright, language, category, blog,
             blog_path, verbose, folder):
    """Generate a podcast from mp3 files located in the provided FOLDER"""
    if verbose:
        logging.basicConfig(level=logging.DEBUG)
    else:
        logging.basicConfig(level=logging.INFO)

    attrs = locals()
    logging.debug('Processing input: %s' % (attrs))
    del attrs['folder']
    del attrs['author_name']
    del attrs['author_email']
    del attrs['verbose']
    del attrs['feed_path']
    del attrs['blog']
    del attrs['blog_path']

    attrs['authors'] = [Person(author_name, author_email)]
    attrs['owner'] = attrs['authors'][0]

    attrs['category'] = Category(category)

    feed_name = name.lower().replace(' ', '_') + '.rss'
    feed_base = '%s/%s' % (website, feed_path)
    feed_url = '%s/%s' % (feed_base, feed_name)
    attrs['feed_url'] = feed_url

    logging.info('Creating podcast %s, feed %s' % (name, feed_url))
    p = Podcast(**attrs)

    for fpath in sorted(glob.glob('%s*.mp3' % (folder))):
        logging.info('Adding episode %s' % (fpath))
        fname = os.path.basename(fpath)
        size = os.path.getsize(fpath)
        logging.debug('Filename: %s, size %i' % (fname, size))
        try:
            tag = ID3(fpath)
        except ID3NoHeaderError:
            logging.error('%s is not a valid mp3 file, ignoring it' % (fpath))
            continue
        logging.debug('Read tag: %s' % (tag))
        e = Episode()
        if 'TPE1' in tag:
            e.authors = [Person(tag['TPE1'][0])]
        else:
            e.authors = attrs['authors']
        e.title = tag['TIT2'][0]
        e.subtitle = e.title
        if 'COMM::eng' in tag:
            e.summary = tag['COMM::eng'][0]
        else:
            e.summary = description
        episode_url = '%s/%s' % (feed_base, fname)
        logging.debug('Episode url: %s' % (episode_url))
        e.media = Media(episode_url, size, type='audio/mpeg')
        e.media.populate_duration_from(fpath)
        pubdate = datetime.strptime(tag['TDRC'][0].text[:10], '%Y-%m-%d')
        pubdate = pubdate.replace(tzinfo=pytz.utc)
        e.publication_date = pubdate
        if blog:
            blog_post = ''
            short_name = re.search('[a-z]*_-_([a-z_]*[#0-9]*)', fname)
            if short_name:
                blog_post = short_name.group(1).replace('_', '-').\
                    replace('#', '') + '.html'
                e.link = '%s/%s/%s' % (website, blog_path, blog_post)
        p.episodes.append(e)

    feed_local_path = '%s%s' % (folder, feed_name)
    logging.info('Generating feed in %s' % (feed_local_path))
    p.rss_file(feed_local_path, minimize=False)