I want to convert all FLAC files to OGG in the working directory:
This is what I ALREADY have.
for root, dirs, files in os.walk(args):
flacs = [f for f in files if f.endswith('.flac')]
oggs = [o for o in files if o.endswith('.ogg')]
for flacfiles in flacs:
id3 = ('id3v2', '-C', flacfiles)
cmd = ('oggenc', '-q7', flacfiles)
try:
subprocess.check_call(id3, cwd=root)
subprocess.check_call(cmd, cwd=root)
except subprocess.CalledProcessError:
print "subprocess.CalledProcessError: Command %s returned non-zero exit status 1" % cwd
Now I want to know how I can - in the directory containing my FLAC files - check if there is one .flac
with a .cue
and if that is the case do_something()