Song Displayer Rewrite?
The Now Playing section I recently added to the sidebar shows the song I currently have playing in WinAmp on my desktop. To add this functionality I am using a version of Song Displayer that I had to massively rewrite to get working for me. Before I explain why I had to rewrite it let me first explain how this (and most other similar plugins) work.
These plugins work in a 3 step process:
- Your media player outputs the currently playing track to a file on your desktop.
- This file automatically gets uploaded (via FTP or HTTP) to a location on your webspace.
- WordPress reads the file and puts the song information on the blog.
The first two steps are done by a plugin to your media player (in my case WinAmp). The third step is done by a plugin to your blog (in my case WordPress). The Song Displayer plugin for WordPress works together with a WinAmp plugin called DoSomething to cover these three steps.
Song Displayer does a nice job and has a small footprint to get the job done. So why did I have to rewrite it? Song Displayer assumes that the MP3s you play will come from your hard drive. Based on that it assumes that the ID3 tags for each track (information like artist and song title) are formatted as they normally should be (artist, album, track, songname). But in my case I’m streaming my MP3’s from my MP3 player. As a result the only information WinAmp has access to is the filename of my MP3s. Editing the template that DoSomething uses to output it’s file was easy. But Song Displayer had to be edited to handle the new way information was being formatted.
While working on this I came accross several things about Song Displayer that could be improved.
- Song Displayer requires you to edit the PHP code of the plugin in order to get it to work with your setup. There are 3 things is requires you to change. This could be handled much better by adding an Options page to the WordPress Admin interface. That way you could make the changes on a form within WordPress and not have to make the changes directly in the code.
- Some of the logic that parses the input is not correct. It doesn’t properly take into account all of the possible combinations of ID3 tags it may encounter. In other words, if it’s missing the name of the artist it will only list the song name. But what if you want it to show the album in that situation (as I would).
- The instructions are lacking information that would make implementing the plugin alot easier. The end user is left to themselves far too much. It took me a whole day to figure out the 1 detail that was keeping the plugin from running.
- DoSomething crashes WinAmp too often.
The second issue is a personal preference that could make the plugin unwieldy if not implemented properly. The other three issues are valid. To that end I was thinking of doing a complete rewrite of the plugin for the general public. The plugin as it stands now (and even more so if I complete a rewrite) would look very little like the original. The only functionality that would be exactly the same is how it reads in the file and how it uses the options.
Is anyone interested in such a plugin? If so then please let me know in the comments. I’m also open to suggestions for a different WinAmp plugin to work with my new vesrions of Song Displayer so you can leave that in the comments too.
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.