Skip to content

Instantly share code, notes, and snippets.

@ameliaikeda
Last active December 26, 2015 20:09
Show Gist options
  • Select an option

  • Save ameliaikeda/7206867 to your computer and use it in GitHub Desktop.

Select an option

Save ameliaikeda/7206867 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf8 -*-
import urllib
from time import sleep
meta = open("/Users/hiroto/metadata", "r+")
prev_song = False
while True:
file = urllib.urlopen("http://localhost:8003/status2.xsl")
song = file.read()
song = song.strip()
song = song.replace("<pre>", "").replace("</pre>", "").replace("<pre/>", "")
if prev_song == song:
sleep(4)
else:
prev_song = song
meta.seek(0)
meta.write(song)
meta.truncate()
sleep(4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment