简体   繁体   English

使用 osx 上的 xld 在命令行中拆分提示音频文件

[英]splitting cued audio files in command line with xld on osx

I'm writing a script for batch processing audio files, with xld.我正在使用 xld 编写用于批处理音频文件的脚本。 I want to find unsplitted albums, split them and convert them in flac, with the proper tags.我想找到未拆分的专辑,将它们拆分并在 flac 中转换它们,并带有适当的标签。

find . -name "*.ape" -exec sh -c 'exec xld  "$1" -f flac' _ {} \;

this command line is converting the audio to flac but i have to add "-c filename.cue" option with xld to make it split the file.此命令行正在将音频转换为 flac,但我必须在 xld 中添加“-c filename.cue”选项以使其拆分文件。

find .找 。 -name "*.ape" -exec sh -c 'exec echo $1 | -name "*.ape" -exec sh -c 'exec echo $1 | sed 's/.ape/.cue/'' _ {} ; sed 's/.ape/.cue/'' _ {} ;

this command line shows me the path of .cue files这个命令行显示了 .cue 文件的路径

find .找 。 -name "*.ape" -exec sh -c 'exec xld "$1" -f flac -c $1 | -name "*.ape" -exec sh -c 'exec xld "$1" -f flac -c $1 | sed 's/.ape/.cue/'' _ {} ; sed 's/.ape/.cue/'' _ {} ;

this command line doesn't work, xld says he didn't found de cue file.这个命令行不起作用,xld 说他没有找到 de cue 文件。 i think it's just a syntax problem.我认为这只是一个语法问题。

thanks for your help感谢您的帮助

I'm not at a computer to test this like I normally would, but in bash you can substitute the trailing part of a variable like this:我不像往常那样在计算机上进行测试,但是在bash您可以像这样替换变量的尾随部分:

thing="fred.ape"
echo ${thing/%.ape/.cue}
fred.cue

It's called "parameter substitution/expansion" and is explained with examples here .它称为“参数替换/扩展”,在此处通过示例进行解释。

So, based on that, you'd need to exec bash something like this (UNTESTED):因此,基于此,您需要执行bash这样的操作(未测试):

find . -name "*.ape" -exec bash -c "xld  "$1" -f flac -c "${1/%.ape/.cue}"' _ {} \;

Personally, I'd do them all in parallel with GNU Parallel like this:就个人而言,我会像这样与GNU Parallel 并行执行它们:

parallel xld {} -f flac -c {.}.cue ::: *.ape

You can install it with homebrew using:您可以使用自制软件安装它:

brew install parallel

太好了,它正在工作,谢谢!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM