SqueezeCenter 7

Written in the mid-afternoon in English • Tags: ,

I’ve been slowly pushing upgrades through my NetBSD machines and recently upgraded the “music server” that runs SlimServer to power my SqueezeBoxen. That brought a new version of Perl on the machine, which made SlimServer unhappy — it wouldn’t start anymore. I tried to rerun the little script that downloads the “blessed” versions of various CPAN packages from Slim Devices, but the files needed for my trusty old 6.2.1 version were no longer available on their server.

Well, I can’t live without the SqueezeBoxen so an emergency update was needed.

Today the SlimServer software is called SqueezeCenter, rebranded after Logitech acquired Slim Devices. I decided on a conservative approach and picked the current release version 7.0.1. After all, I’d rather have this running than figure out new and fun issues with a bleeding edge version.

Since NetBSD isn’t one of the supported-out-of-the-box platforms for SqueezeCenter, I did have to hammer in the software a bit. Some of the bundled CPAN software packages were older than what I had installed from pkgsrc on the system. This becomes an issue when there is a binary component to the software: it needs to match the Perl code. Since many CPAN packages are found in pkgsrc, I opted to use those instead of the (sometimes older) ones bundled with SqueezeCenter. I removed the following packages from the CPAN directory:

  • CGI
  • Compress
  • DBD/mysql and DBD/mysql.pm
  • GD and GD.pm
  • JSON
  • LWP and LWP.pm
  • Net/DNS and Net/DNS.pm
  • Net/IP.pm
  • Template and Template.pm
  • XML
  • YAML

Next I had a problem with connecting to MySQL: the error message files didn’t match, as again the one bundled with SqueezeCenter was older. There was an article on the SqueezeWiki that provided a quick fix — copy the files from the MySQL version you are using.

cp -p /usr/pkg/share/mysql/english/errmsg.sys MySQL/errmsg.sys
cp -p /usr/pkg/share/mysql/errmsg.txt MySQL/errmsg.txt

Now I was up and running!

I was lucky in still using my old startup script to start SqueezeCenter (the server script is still called “slimserver.pl”). The preferences are no longer kept in a single ~/.slimserver.pref file but instead there is a prefs directory. The software migrates your settings over, at least for the most part. I was glad that it kept my Favorites that contain several radio stations. I had to re-enter some settings:

  • rules for guessing meta data from the file system (directories and file names)
  • display formats on the players as well as available formats
  • date and time formats

There might have been others, too, that I’ve forgotten since browsing around in the new web interface.

Speaking of which, the new default skin is quite nice. It seems a bit more responsive, too, although I’m running it on rather slow hardware so don’t mind me.

I noticed an interesting surprise playing with the display formats: if I choose a “less informative” format, e.g. just “TITLE”, the web interface adds more lines to each entry with the “missing” information. The multiline format is much nicer to look at than stuffing everything on a single line, so I chose just “TITLE” as the default format. (I mostly use that on the players, too.)

A welcome surprise was that the AudioScrobbler plugin is now bundled with SqueezeCenter. A little bit of reading gave me the necessary steps to configure it (this wasn’t all that intuitive except maybe in 20/20 hindsight):

  • first enter your Last.fm account information in the plugin configuration page
  • then enable scrobbling on each player for your account

You can also have multiple accounts configured and choose which one to use on each player.

This means that finally I’m building a real profile on Last.fm as I mostly listen to music on the SqueezeBoxen. In the past only the music players on my desktop computer were scrobbling, which amounted to almost no data.

I also read about new things having been committed to the SqueezeCenter svn repository that expand on the Last.fm functionality. Most importantly the ability to play Last.fm radio streams has been added. I’ll probably be upgrading my server before the end of the summer…

There was one unpleasant issue that I noticed quickly: some track titles were transcoded to UTF-8 incorrectly. Somehow an “ää” followed by a space and preceded by some consonants but not others were being hit. For example:

Correct: Hyvää ja kaunista
Incorrect: Hyvהה ja kaunista

Later I noticed this happens with streams also. And all this bad data gets scrobbled on my track history!

I browsed around in the code and found the encodingFromString routine in Slim/Utils/Unicode.pm. It uses Encode::Detect::Detector to guess at the character set used in the string. (I saw another place in the code where it seemed the character set from a radio stream was simply discarded in favor of this later guesswork.) This was the culprit: it never guessed “iso-8859-1” for the track titles in Finnish. At best it would guess “windows-1252”, which is usually close enough. But for some tracks it would guess “windows-1255”, which apparently is a relative of “iso-8859-8”.

To confirm my discovery, I just commented out the code that calls Encode::Detect::Detector. This “fixed” the problem titles in my radio stream.

I then rescanned my library using

perl scanner.pl --wipe --progress

Well, my “fix” didn’t apply to MP3 tags, apparently. I ran fgrep to see if other places in the code were using Encode::Detect::Detector and discovered lib/MP3/Info.pm. It was guessing at two separate places, like this:

my $charset = Encode::Detect::Detector::detect($data) || 'iso-8859-1';

I commented that out and replaced it with

my $charset = 'iso-8859-1';

That’s a better guess since I’m not using any other character sets anyway.

An hour of rescanning later I can confirm that at least the couple of problem cases I can remember have now been correctly entered into the library.

Now it’s time to enjoy the music for a while again.