All pastes #675432 Raw Edit

Miscellany

public text v1 · immutable
#675432 ·published 2007-08-30 03:45 UTC
rendered paste body
#!/usr/bin/python
#
# Copyright (c) 2007 Elliot Peele <elliot@bentlogic.net>
#

import os
import subprocess

for file in os.listdir(os.getcwd()):
    if not file.endswith('.flac'):
        continue

    oggName = '.'.join(file.split('.')[:-1]) + '.ogg'

    if os.path.exists(oggName):
        continue

    print "Converting %s to ogg" % file
    cmd = [ '/usr/bin/oggenc', '-b', '256', '-o%s' % oggName, file ]
    subprocess.call(cmd)