#!/usr/bin/env python # Brian Gianforcaro # this script is a very primitive script for use with Matrix Orbital LCD display's. It display's the current/last playing song for your audioscrobbler/last.fm account. # email b.gianfo@gmail.com if you have any suggestions, fixes or comments # www.audioscrobbler.com # www.matrixorbital.com # matrix emulator avaliable for palm handhelds at palmorb.sourceforge.net import serial import urllib2 import time asid = "realrbman" # your Audioscrobbler user name MYPORT = "/dev/ttyd1" #on unix #MYPORT = "COM1" #on windows ser = serial.Serial(MYPORT, 19200, bytesize=8, parity='N', stopbits=1, timeout=1, rtscts=0) #opens second serial port def getsong(asid): MYGET=urllib2.Request("http://ws.audioscrobbler.com/txt/recent/%s.txt" % (asid)) MYGET.add_header("user-agent","testing 1 2 3") data=urllib2.urlopen(MYGET) if data==None: print "no songs" return "no songs" else: o=data.read().split("\n") song= o[1] print song return song print ser.portstr while 1: ser.write("\xFE\x58") ser.write("\xFE\x47\x01\x01") ser.write(getsong(asid)) time.sleep(420)