Which raises the question of how to maintain a mirror database of music encoded in whatever format one's portable music player requires - even if the player supports flac, a high bit-rate lossy format might be preferable to fit more music into it, and it would be nice to automatically make mp3's or oggs or whatever as you rip new flacs, and automatically update them as you notice and fix tagging errors.
This script is what I'm currently using to do the job. It is an outgrowth of various ideas and tidbits I had found in these forums along with my own coding to solve these common problems. I'm sharing it here because it might be helpful to someone else, and to return something to the community.
It is a longish script so it'll be put in a followup post. (If there's a better way to make these things available please let me know!)
Requirements
Needs flac, metaflac, lame (only if you want to encode to mp3), faac (only if encoding to aac), oggenc (only if encoding to ogg).
Installation
To install, copy the code in my 2nd post below into a file named /usr/local/bin/flac2any and mark it executable. Then make the following symlinks. As root:
Code: Select all
cd /usr/local/bin
chmod +x flac2any
ln -s flac2any flac2ogg
ln -s flac2any flac2mp3
ln -s flac2any flac2aacThis script examines its name to know what conversion to perform. (That's why the symlinks when installing it.)
As usual, --help gives a short usage reminder:
Code: Select all
flac2ogg --helpCode: Select all
flac2ogg file.flacTo encode a flac file to ogg but give it a specific name:
Code: Select all
flac2ogg -o newname.ogg file.flacCode: Select all
flac2ogg -dir /place/for/ogg/files *.flacCode: Select all
flac2ogg -r -dir /place/for/ogg/files *Code: Select all
flac2ogg -r -dir /place/for/ogg/files /main/flac/collection/.Finally, there's the -n "no, don't do it" flag. It prints out what would be done without actually doing anything. This is good if you just want to see what would be done (like if you use the -u flag, you can see what's been updated since last time).
But -n is also very useful in conjection with this parallel-shell script if you have a multi-core machine, to keep all the cores busy with encoding:
Code: Select all
time flac2aac -r -n -u --quality 180 -dir /your/aac/mirror /your/flac/files/* | nice -20 parallel-sh -v



