View Single Post
Posts: 5 | Thanked: 1 time | Joined on Jun 2008
#16
Code:
#!/bin/python
from subprocess import Popen,PIPE
import string

USER = "username"
PASS = "password"

print "XM Radio Player Script (^C Exits)"
print "XM Radio Favorites"

print "202 - The Virus XL"
print "48 - Squizz"
print "83 - Chrome"
print "150 - XM Comedy XL"

REPLY = raw_input("XM Radio Channel? ")

SPEED = raw_input("Speed/Quality? (low or high): ")

if REPLY == "":
	print "I need a Channel to listen to."
else:
	cmd = 'mplayer '
	cmd = cmd + '-vo null '
	cmd = cmd + '-cache 256 '
	cmd = cmd + '-playlist "http://www.xstreamxm.com/mobile/stream.asx?'
	cmd = cmd + 'email=' + USER + '&'
	cmd = cmd + 'pass=' + PASS + '&'
	cmd = cmd + 'chan=' + REPLY + '&'
	cmd = cmd + 'speed=' + SPEED + '"' 
	print "Opening channel " + REPLY
	p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
	out = string.join(p.stdout.readlines())
	outerr = string.join(p.stderr.readlines())
	print out
	print outerr
This may seem silly but I could not get the shell script to run so I went ahead and rewrote his script in python. It is a little messy but it makes it easier to read.
 

The Following User Says Thank You to jhdeval For This Useful Post: