convert-to-mp3.py: can specify bitrate optionally
This commit is contained in:
parent
e01b650a7b
commit
496214cd71
@ -2,12 +2,27 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import getopt
|
||||
from subprocess import *
|
||||
|
||||
def main(argv):
|
||||
for f in argv:
|
||||
bitrate = 128
|
||||
try:
|
||||
opts, args = getopt.getopt(argv[1:], "b:")
|
||||
except getopt.GetoptError:
|
||||
usage()
|
||||
return 2
|
||||
|
||||
for opt, arg in opts:
|
||||
if opt == "-b":
|
||||
bitrate = arg
|
||||
else:
|
||||
usage()
|
||||
return 2
|
||||
|
||||
for f in args:
|
||||
if os.path.isfile(f):
|
||||
Popen(['lame', '-v', f, f + '.mp3']).wait()
|
||||
Popen(['lame', '-v', '-b', bitrate, f, f + '.mp3']).wait()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
||||
|
Loading…
x
Reference in New Issue
Block a user