我想要将工作目录中的所有FLAC文件转换为OGG:
这就是我已经拥有的。
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现在我想知道如何在包含FLAC文件的目录中检查是否有一个带有.cue的.flac,如果是这样的话do_something()
发布于 2011-10-29 18:38:47
for flacfiles in flacs:
if os.path.exists(os.path.splitext(flacfiles)[0] + '.cue')):
# do something https://stackoverflow.com/questions/7938128
复制相似问题