mp3info and python

Dave Pawson DaveP at dpawson.freeserve.co.uk
Thu Dec 6 12:39:06 EST 2001


After a little off list support from Brett, here's a way to
use the python solution.


thanks Brett.

daveP

f = open(fil)
m = mp3info.mp3info(f.read())
h = m.id3

#for i in h.keys():
#    print i, h[i]

entry = os.stat(fil)
size  = entry[stat.ST_SIZE]
br = int(h['bitrate'])
print "File size is :",size, " Bitrate = ", br
dur = (size) / (br * 1000 / 8)
print dur
hrs = dur / 3600
mins = (dur % 3600) / 60
secs = (dur % 3600) % 60
print "dur= ",hrs,":",mins ,":", secs


m.free_file()
f.close()
sys.exit()



More information about the Python-list mailing list