Well, with no responses, and as I mentioned, no luck with Google, it appears that handling of compilations is something that SubSonic doesn't do particularly well. At some point I may try to dig into the code to see if I can add such a feature, but for now, I opted to try my hand at a
bash script that would automate creating links to songs in albums of various artists.
The script was designed for use with files ripped to flac, and it uses the
metaflac command.
When groups of Various Artist collections (compilations, soundtracks, etc.), their original grouping by album can be maintained. My belief is that this will be more compatible with other software or if/when SubSonic is updated with more direct support. These albums can be grouped under a "Various Artists" directory. However, to keep SubSonic from indexing these songs into a "Various Artists" artist, a dot directory can be used, like ".Various Artists". e.g:
- Code: Select all
/media/
music/
.Various Artists/
Guitar Rock Disc 1/
01-The Jimi Hendrix Experience-Purple Haze.flac
02-Bad Company-Feel Like Makin' Love.flac
...
Guitar Rock Disc 2/
01-The Moody Blues-I'm Just A Singer (In A Rock And Roll Band).flac
02-Rod Stewart with The Faces-(I Know) I'm Losing You.flac
...
Then, from the base of the music directory (/media/music in this example), use the script below like this:
- Code: Select all
va.sh ".Various Artists"
This will create a set of directories for each artist (from the "artist" tag), and fill them with symbolic links to the audio files, using relative paths. The names will be the same as the linked files, except any number will be stripped. e.g:
- Code: Select all
/media/
music/
The Jimi Hendrix Experience/
The Jimi Hendrix Experience-Purple Haze.flac -> ../.Various Artists/Guitar Rock Disc 1/01-The Jimi Hendrix Experience-Purple Haze.flac
Bad Company/
Bad Company-Feel Like Makin' Love.flac -> ../.Various Artists/Guitar Rock Disc 2/02-Bad Company-Feel Like Makin' Love.flac
The Moody Blues/
The Moody Blues-I'm Just A Singer (In A Rock And Roll Band).flac -> ../.Various Artists/Guitar Rock Disc 2/01-The Moody Blues-I'm Just A Singer (In A Rock And Roll Band).flac
Rod Stewart with The Faces/
Rod Stewart with The Faces-(I Know) I'm Losing You.flac -> ../.Various Artists/Guitar Rock Disc 2/02-Rod Stewart with The Faces-(I Know) I'm Losing You.flac
...
Also, the script should handle collisions of the same artist and title by renaming one using an index. This is so that both versions appear, in case they are different versions of the same song. Differentiation would need to be done based on the album, which doesn't appear to show up in the SubSonic web page, but does seems to show in some other clients.
Anyway, this script is provided as-is, with no warranty, expressed or implied, and with no copyright, so you can do as you want with it.
Oh, and if you find you want to remove the results of this script, I've found these two commands, issued in that same base directory, do the trick, assuming a similar setup to that described above is used:
- Code: Select all
find . -type l -name '*.flac' -execdir rm {} \;
rmdir *
One last note. I'm not an expert bash script writer, so I'm sure there are better ways of doing this, but it seems to work for my purposes, so I thought I'd share. Here is the script:
- Code: Select all
#!/bin/bash
for dir in "$@"
do
echo "processing dir=" "$dir"
find -L "$dir" -name "*.flac" | while read -r file
do
echo "processing file=" "$file"
artdir="$( metaflac --show-tag=artist "$file" | sed 's/artist=//' )"
justname="$(basename "$file")"
namenonum=$( echo "$justname" | sed 's/[0-9]*[-.]//' )
if [ ! -d "$artdir" ]; then
mkdir "$artdir"
fi
noext=$( echo "$namenonum" | sed 's/.flac//' | sed 's/.mp3//' )
num=0
while [ -f "./$artdir/$namenonum" ]
do
num="$(($num + 1))"
namenonum="$noext-$num.flac"
done
ln -s "../$file" "./$artdir/$namenonum"
done
done
rtilleryweb