All pastes #21770 Raw Edit

Python

public python v1 · immutable
#21770 ·published 2005-08-31 21:26 UTC
rendered paste body
#! /usr/bin/env pythonimport sys, os, re, os.pathbasedir = sys.argv[1]files = os.listdir(basedir)mp3_rx = re.compile("^(.+)\\.mp3$")ogg_rx = re.compile("^(.+)\\.ogg$")def process_mp3(path, name):    print name    os.spawnlp(os.P_WAIT, "mpg123", "mpg123", path, "-w", name + ".wav")def process_ogg(path, name):    print name    os.spawnlp(os.P_WAIT, "ogg123", "ogg123", "-d", "wav", path, "-f", name + ".wav")for file in files:    print file    m = mp3_rx.match(file)    if m is not None:	process_mp3(os.path.join(basedir, file), m.group(1))    m = ogg_rx.match(file)    if m is not None:	process_ogg(os.path.join(basedir, file), m.group(1))