Power of man
Due to a bigger data loss, I had to re-collect my music. Fortunately I found all work of Yoko Kanno in a single torrent in lossless format.
The real problem was ahead of me, because ape is an Apple product, so it does not have good support under the free side of the world.
First I found a mac (Monkey’s audio codec) package, which was corrupt, because the version number started with a letter. How good that the creation of a deb package requires a whole life to be prefect.
The second hit was better, a post at Ubuntu forum contained an attached zip file of mac package. However the download cost a half an hour pain, because you cannot download a file from a post you have to login, manage the lost user account, connect it with your launchpad user… All of the trouble to accept a legal term, so Ubuntu will be protected against Apple, so Apple cannot attack them, because they support the Apple’s ugly audio format. Apple and the administrator of Ubuntu should be dead soon.
And now everything was ready to work.
cuetools was perfect for the job, my only problem was the file names. Their was be named after the track number only. But there is no problem at all cue is a text file so I grabbed sed:
sed -rn 's/\s+TITLE\s+"(.+)"/\1/p' CDImage.cue|sed =|sed -r -e 's/^([0-9])$/0\1/' -e 'N;s/\n/=/'|sed -rn -e 's/([0-9]+)=([^\n]+)/split-track\1.flac \1-\2.flac/p'
I mentioned Yoko Kanno before, she is a Japanese lady, so the titles hold some kanji as well. That trick fools sed a little. The second group in the sed expression is the title, and everything that was written after that (.flac) simply overwrote the head of the line.
I lost my temper at this point, and started to follow the dark side of programming: I wrote a small python script. It toke almost an hour but it worked. I thought that’s a missing point in cuetools, so I should distribute my silly code. But I checked the content of cuetools, maybe I lost something, and yes I did. cueprint does my job in a second:
cueprint CDImage.cue -t ‘mv split-track%02n.flac “%02n-%t.flac”\n’
Remarkable fact never leave out the study of the manuals.