here is a script which works:

http://pastebin.com/i50iQdeA

you only have to change the lame options, as now it only does 320 kbps cbr.