Archive.org radio: Difference between revisions
No edit summary |
No edit summary |
||
Line 22: | Line 22: | ||
print | print | ||
</source> | </source> | ||
Use Ctrl-C to go to the next song. | |||
[[Category: Cookbook]] [[Category: Audio]] [[Category: Python]] | [[Category: Cookbook]] [[Category: Audio]] [[Category: Python]] |
Revision as of 15:31, 20 June 2011
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import feedparser, os
from pprint import pprint
from time import sleep
from random import shuffle
feedurl = "http://www.archive.org/services/collection-rss.php?collection=audio_music"
feed = feedparser.parse(feedurl)
shuffle(feed.entries)
for item in feed.entries:
# pprint(item)
songurl = item['enclosures'][0]['href']
print item.get('title')
print item.get('link')
os.system('mplayer -really-quiet "%s" 2> /dev/null' % songurl)
sleep(3)
print
Use Ctrl-C to go to the next song.