Skip to content

Instantly share code, notes, and snippets.

@lvzongting
Forked from yanyaoer/db_fm.py
Created February 13, 2012 02:30
Show Gist options
  • Save lvzongting/1812845 to your computer and use it in GitHub Desktop.
Save lvzongting/1812845 to your computer and use it in GitHub Desktop.
listening my douban.fm with python & mpg123
# vim: set et sw=4 ts=4 sts=4 fdm=syntax ff=unix fenc=utf8:
#!/usr/bin/python
import json
from subprocess import Popen
import urllib2
_url = 'http://douban.fm/j/mine/playlist?type=n&h=&channel=0'
req = urllib2.urlopen(urllib2.Request(_url))
obj = json.load(req)
playlist = ''
for s in obj['song']:
playlist = playlist+" "+s['url']
Popen('mpg123 '+playlist, shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment