Python 批量转换 FLAC 文件
我想将工作目录中的所有 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( )
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()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)