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)
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)
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)
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)
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)
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)
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)