[SUCS Devel] Listen Again

Andrew Price welshbyte at sucs.org
Sun Aug 12 16:21:58 BST 2007


On 11/08/07 22:43, Oliver Head wrote:
> Still need an 11pm hour created for Listen Again on Xtreme as it does not exist for any day at present!

I've changed the listenAgain script to use the correct date (i.e. the
day before) when it runs at midnight. I think that should solve the
missing 11pm problem.

For those interested, the script now looks like:

import os
import sys
import datetime
import subprocess
day = datetime.datetime.today() + datetime.timedelta(minutes=-30)
path = day.strftime('/home/icecast/logs/%Y/%m/%d/')
logs = os.listdir(path)
if len(logs) < 2:
    sys.exit(0)
logs.sort()
log = path+logs[-2]
when = day.strftime('%A-'+logs[-2][:2]+':00')
logfile = file('listenAgain.log-'+when,'w')
returncode = subprocess.call("ffmpeg" + " -y -i "+log+"
/tmp/"+when+".swf" , shell=True, stdout=logfile, stderr=logfile)
returncode = subprocess.call("scp" + " /tmp/"+when+".swf
xtreme at sucs.org:~/public_html/listen_again/" , shell=True,
stdout=logfile, stderr=logfile)
os.unlink("/tmp/"+when+".swf")




More information about the Devel mailing list