I'm starting the longish process of ripping my CD collection. I've got abcde installed with the config from Andrew's Corner. It seems to be working ok but when the metadata fetch fails, the MP3s get written as Unknown Artist and Unknown Album. Which isn't a problem until the second metadata fetch fails. Then the tracks get overwritten. What would be ideal is that the second album gets a number on the name like "Unknown Album 2". Any suggestions on how to accomplish this? Or how to keep the directories from being ovewritten?
-
Serge's answer is best, but a hack is to add the `-W1` option. This treats discs as multi CD sets. If a duplicate disc set is found, then the current one is incremented to triple-digits (track 101 instead of 1, for example). – Klaatu von Schlacker Jun 06 '16 at 00:09
-
1I think the intended usage is that when an unknown cd is found you are prompted to edit the cddb file with the right titles/artist, then abcde carries on with this new info. The altruistic thing to do is to also get abcde to submit the result to [freedb](http://www.freedb.org/en/faq.3.html#21) which has provided you with info for all the other cds. – meuh Jun 06 '16 at 06:18
3 Answers
You could automate the process by wrapping the abcde with a script that invokes abcde and checks for 'Unknown Artist/Unknown Album' directory existence after abcde completion.
If the test shows that directory exists then rename it with a name that includes the disk CDDB ID which you can get with cd-discid tool. This script obtains the ID early, otherwise auto-eject prevents obtaining the ID after abcde has completed.
#!/bin/bash
id=$(cd-discid /dev/cdrom)
abcde $@ || exit 1
if [ -d "Unknown Artist/Unknown Album" ]; then
mv "Unknown Artist/Unknown Album" \
"Unknown Artist/Unknown Album $id"
fi
Using Serge's idea above, I edited the mungefilename function in the .abcde.conf configuration file.
I started with the configuration file supplied here: Andew's Corner has a very helpful tutorial
I edited the function to append the first bit of string returned from cd-discid.
mungefilename ()
{
CDDISKIDENT=$(cd-discid "$CDROM")
FIRSTPARTID=$(echo $CDDISKIDENT | cut -d' ' -f1)
echo "$@" | sed "s/Unknown\ Album/Unknown\ Album$FIRSTPARTID/" | sed -e 's/^\.*//' | tr -d ":><|*/\"'?[:cntrl:]"
}
- 11
- 2
-
Most tracks had `$FIRSTPARTID` appended to the directory, but the last did not. Presumably because the CD had ejected by then with my config. – Sparhawk Jul 26 '20 at 08:15
This appends the PID of the parent process when ripping a disc. This is because mungefilename is ran per file during the final copy process at the end of the rip, if you have set auto eject the disc won't be available to get the discid from. The parent PID is the only constant on a per disc basis.
mungefilename ()
{
echo "$@" | sed "s/Unknown\ Album/Unknown\ Album$PPID/" | sed -e 's/^\.*//' | tr -d ":><|*/\"'?[:cntrl:]"
}