On Friday 29 February 2008 06:28, Dick Moores wrote: > I keep missing a certain weekly program on my local NPR station. My > idea is to record it using software I have, Easy Hi-Q Recorder. I can > set it to start recording when the program starts, 8pm, but I need to > have the program playing on my computer. The URL for the station's > audio is http://www.kuow.org/real.ram . > > I've got this so far: > > #!/usr/bin/env python > #coding=utf-8 > import time > b = '20:00:00' > while True: > a = time.strftime('%H:%M:%S') > time.sleep(0.5) > if a == b: > print "TIME!" > break > > Obviously, I need to replace the 'print "TIME"' line with something > that will open IE7 to http://www.kuow.org/real.ram . But what? > > Thanks, > > Dick Moores > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor
You might consider passing the URL directly to the audio player. This is usually all the web browser does for you, although its possible there's a different URL defined on that page each time, but then you could parse the page in python using urllib and re, or something similar. Not only that, launching IE7 is a time and memory consuming activity, and definitely lacks grace. I dunno how your media player works, but this did the job for me (from the command prompt): "c:\Program Files\Real Alternative\Media Player Classic\mplayerc.exe" http://www.kuow.org/real.ram You could put this directly into your windows scheduler, and not use python at all. Start Menu>All Programs>Accessories>System Tools>Scheduled Tasks You'll get an option to set the command line at the end of teh wizard, if you check "show advanced options" You could have a python process running in the background that executed this command through the subprocess module, at the appointed time. You could even use something like FireDaemon to turn it into a service. But, it seems better to use the windows scheduler. Cheers _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor