def create_feed(name, username, subscriptions, yt): all_vids = [] for s in sorted(subscriptions): vids = yt.get_videos(s.url) all_vids += vids feed = DefaultFeed(title="%s's YouTube Vids [%s]" % (username, name), link="http://gonzo.probablydavid.com/", description=name) for video in sorted(all_vids, reverse=True)[:MAX_RSS_SIZE]: feed.add_item(title=video.title, link=video.get_link(), description=video.description) folder = '/home/dlu/public_html/%s' % username if not os.path.exists(folder): os.mkdir(folder) filename = '%s/%s.rss' % (folder, name) f = open(filename, 'w') s = feed.writeString('utf-8') f.write(s) f.close()
def __init__(self, title, link, description, image=None, thumbnail=None, prefix=None): DefaultFeed.__init__(self, title=title, link=link, description=description) self.title = title self.link = link self.image = image self.thumbnail = thumbnail self.prefix = prefix
def create_feed(name, username, subscriptions, yt): all_vids = [] for s in sorted(subscriptions): vids = yt.get_videos(s.url) all_vids += vids feed = DefaultFeed( title="%s's YouTube Vids [%s]" % (username, name), link="http://gonzo.probablydavid.com/", description=name) for video in sorted(all_vids, reverse=True)[:MAX_RSS_SIZE]: feed.add_item( title=video.title, link=video.get_link(), description=video.description) folder = '/home/dlu/public_html/%s'%username if not os.path.exists(folder): os.mkdir(folder) filename = '%s/%s.rss'%(folder, name) f = open(filename, 'w') s = feed.writeString('utf-8') f.write(s) f.close()
exit(0) if len(title) <= 1: base = os.path.split(filename) title = os.path.splitext(base[1])[0] data.append({'title': title, 'filename': HOSTNAME + "/" + filename, 'length': size, 'type': 'audio/mpeg', 'date': formatDate()}) yaml.dump(data, open(DFILENAME, 'w')) feed = DefaultFeed( title="David's Miscallaneous Podcasts", link="http://gonzo.probablydavid.com/", description="[description]") for item in data: e = Enclosure(item['filename'], str(item['length']), item['type']) if not os.path.exists(to_local_name(item['filename'])): print item['filename'] feed.add_item( title=item['title'], categories=["Podcasts"], link=HOSTNAME, enclosure=e, description=item.get( 'description', ''), pubdate=datetime.strptime(