Here is some useful stuff I use to work with my SlimServer.


A repository file for the Squeezecenter Extension Downloader is available here.


I develop these plugins in my spare time. If you like them, please, feel free to donate to support their continued evolution. Thank you....

Library Management

I rip my music on Linux using abcde. I use a two phase process. In the first phase, I collect the tag information from cddb, and rip the music to wave files. In the second phase, I encode the music to MP3's and FLAC's. This second phase happens in the background, and I use the autoencode utility, below, as a daemon to look for files which are ready to encode.


I find that abcde does a pretty good job, assuming the data from FreeDB is good. The one exception is when the data contains non-ASCII characters, then things get ugly.

I like to change my tags by manipulating my local cddb cache (~/.cddb/*, in my case). I hand edit the files in there, and then run my retag script on the appropriate files. This pulls in the data from the CDDB files, and sets the tags appropriately. Frequently, changing the tags will change the way I want to store the files. For this purpose, I have the reorg script below, which will rename and move files to the appropriate place in my music tree.

To facilitate this, I make sure to tag all files with track and CDDB ID number. In MP3 files, the CDDB ID goes into a TXXX tag, with a CDDB description. With FLAC, the tag is just CDDB. abcde needs to be changed slightly to handle this. First, change the tagging command for mp3's to include the TXXX line shown below:

        run_command tagtrack-$1 $TAGGER $TAGGEROPTS -c "$COMMENTOUTPUT" \
            -A "$DALBUM" -a "$TRACKARTIST" -t "$TRACKNAME" -y "$CDYEAR" \
            -g "$GENREID" -T "${TRACKNUM:-$1/$TRACKS}" \
            --TXXX "CDDB:$DISCID" \
and change the script for the FLAC to have the line
This second line is broken in the current version (2.3.3) of abcde. The former needs to be hardcoded, as apparently it can't be set in the ID3V2OPTS option, presumably because it contains a variable.

Also, I only tag with ID3v2 tags, not ID3v1. All the devices I use, SlimServer/SqueezeBox, Phatnoise Phatbox, and iPod/iPod nano understand ID3v2, so why bother with ID3v1? Let me know if you've got a good reason why I'd want to.


These pregrams are all written in Perl. They use the following CPAN modules. These are all available from CPAN. Use the command:
% perl -MCPAN -e shell
and then execute the following commands at the shell:
install MP3::Tag
install Audio::FLAC::Header
install CDDB::File

Notes on character sets

FreeDB returns characters in the Latin1/ISO 8859-1 character set, most of the time, and in DOS text file format all the time. ID3v2 tags can be in either Latin1 or UTF-8. When I started coding this, MP3::Tag only supported Latin1, so these store ID3 tags as Latin1 and FLAC tags as UTF-8.

Unfortunately, there's no great way to tell what FreeDB has given you. I try to make sure I convert files to Latin1, and store them consistently that way. Also, be sure to convert all CDDB files to Unix format, as they seem to be coming through in DOS format (ie, carriage return/newline pairs, rather than Unix style single newlines).

When using abcde as your encoder, if your artists, albums, or track titles contain non-ASCII/non-English characters, you're likely to get your filenames all mangled. For instance, the group Värttinä gives abcde fits. The file names will be created in Latin1 characters, and the FLAC files will not get tagged at all. After correcting any data in my CDDB database, I use the following command:

retag -t tracknumber -i CDDBID track.mp3
reorg track.mp3
to get the files in the right place.



Autoencode is a daemon process which snoops a directory for abcde sub-directories which are ready to encode. If it finds any directories ready to go, it encodes that directory, and when complete, moves along. If it can't find anything, it sleeps for a while, then checks again.
	Usage: autoencode [options]
		 --dir directory	where to look for ABCDE directories to encode.  Default: /tmp/music
		 --sleep minutes	How long to sleep between attempts to find work.  Default: 30 minutes.
		 --[no]verbose		Talk a lot.  Default: be quiet.
		 --loops numLoops	Number of loops at files to handle.  Default: Unlimited.
		 --[no]notify		Send mail when abced jobs fail.  Default: no.
		 --address address	Address where to send the mail to.  Default: The logged in user at the current domain.
		 --nice nicelevel	Nice level to run at.  Default: 10
		 --[no]quietabcde	Send abcde output to /dev/null.  Default: shut it up.
		 --[no]daemon		Log each job completing to the syslog.  Default: no.
		 --script		ABCDE script to run.  Default: /usr/local/bin/abcde
		 --help			This stuff.


Retag a file or files (MP3 or FLAC) based on the current data in the local CDDB database. Uses internal tags to determine which values to use. On MP3, looks for a TXXX tag with a CDDB description. In FLAC, looks for a CDDB tag. Also uses the appropiate track tag to determine which tag to use. Both values can be overridden on the command line.
	Usage: retag [options] files
		 --db directory		Where to search for CDDB files.  Default: $HOME/.cddb
		 --cddb file		File to load CDDB data from.  Prevents lookup in DB.  Default: None.
		 --id CDDB_ID		ID to use to tag these files.  Overrides any CDDB tags in the file.  Default: use the file.
		 --track track		Track number to lookup based on.  Overrides any track tags in the file.  Default:use the file.
		 --[no]utf8		CDDB files are in UTF-8.   Default: No (Latin1).
		 --help			This stuff.


Reorganize a music collection, or parts thereof. Puts files in the form Artist/Album/track.trackTitle.suffix. Uses the internal tags to generate the filenames. Can be given individual files, or even directories. If given directories, it will recurse the structure looking for files to reorganize.
	Usage: reorg [options] files directories
		 --base directory	Base directory for your collection.  Default: Yes.
		 --various string	Directory to put compilation albums in.  Defaut: VariousArtists
		 --drag file		Filename to "drag" along with moved files.  Can be used multiple times.  Default: cover.jpg
		 --[no]compilation	Force these files to be in a compilation.  Default: No.
		 --[no]utf8		Create filenames in UTF-8.  Default: Yes.
		 --[no]rename		Actually do the renaming.  Useful for testing.  Default: yes.
		 --[no]clean		Clean up empty directories.  Default: no.
		 --help			This stuff.