Squeezebox Stuff‎ > ‎

Now Playing

Keep a log of played tracks and easily provide information on your web site about what you're currently listening to with your Squeezebox.

Warning: This currently uses threads when FTP-ing files to a remote server. This isn't a great idea as SlimServer is not thread-safe. That said, I have run this plugin on my own server for over 6 months now without any problems. If you do use the FTP features of this plugin, please make sure that you test them first, and disable them again if you have any problems.

What exactly does this plugin do?

This plugin logs information about the tracks that you play on your Squeezebox. It can maintain a log of every track you've ever played, and can also write information about just the currently playing track to a file. The plugin can optionally upload the contents of this file to an ftp server every time the current track changes, allowing you to include it in a web page—I use this to provide the "Currently listening to" information at the bottom of this page. Alternately, you could include the file in your signature in emails, blogs or forum postings.

How do I install the plugin?

Download the zip file from the top of this page and unzip it into your SlimServer Plugins directory. This will create a directory called NowPlaying. You now need to edit the plugin's source file in order to configure it. Within the NowPlaying directory, there will be a file called Plugin.pm. Open this file in a text editor and change the "Configurable variables" section at the top of the file. Here, you should specify the location and name of the various files that the plugin produces. You can disable features by setting the variables to undef—see the comments in the file for more details. If you leave the ftp feature enabled, make sure that you specify the correct server details and your username and password. Once you've done this, save the file and restart SlimServer.

With any luck, things should now work. To test it, play a track on your Squeezebox and then look to see if the files you specified have been created. If they haven't, have a look at the SlimServer log file for details of what's going on (run SlimServer with the --d_plugins argument for more information). If you want some help, try asking in the SlimDevices Forums.

How do I include now playing information in my web pages?

In order to do this yourself, you'll need the following:

  • FTP access to your web site's files, or have SlimServer running on the same machine as your webserver
  • Web scripting (Perl, PHP etc) or Server Side Includes support on your web site

Assuming that your web server isn't running on the same server as SlimServer, you'll need to use the plugin to ftp a file containing the now playing information onto your web server. Once the file is on your web server, you can use one of any number of techniques to place the contents of this file into your web site. I do this using Apache's 'server side includes' and place my now playing file, called nowPlaying.txt, in the root of my web space. I can then include the file using the following bit of code:

<p>
  Currently listening to: <!--#include virtual="/nowPlaying.txt" -->
</p>

In order for this to work, I had to enable server side includes by putting the following in a .htaccess file:

AddHandler server-parsed .html

See Apache Tutorial: Introduction to Server Side Includes for more information.

If you can use Perl or PHP on your web site, including the contents of a file is very easy to do. However, I'm afraid that providing details on configuring your web server to do this are a bit beyond the scope of this page!

Planned features

  • This plugin doesn't work very well if you have more than one player playing at once. The now playing information is overwritten every time a player starts a new track, which could be confusing. Also, the log file doesn't include details about which player played a track.
  • The plugin should have a configuration page in the SlimServer web interface. Configuration by editing the source isn't good!
ċ
NowPlaying-6.5.zip
(8k)
Max Spicer,
5 Aug 2010, 12:48
ċ
NowPlaying-7.0.zip
(3k)
Max Spicer,
5 Aug 2010, 12:48
ċ
NowPlaying.zip
(2k)
Max Spicer,
5 Aug 2010, 12:49
Comments