Winamp playlist
- 18th August 2005 | permanent link
- comments (8)
I first came across the winamp recently played list on Janne's blog. He had already written a good entrie about the things required to make it all work, but he did not get into the more technical lingo, or even to show some of the code that he used to make the whole thing work. So I decided to take it a step further for all you bloggers who want to show the world what you're listening to while you're behind your computer.
Ingredients
Don't worry. It's a very short list :)
- First of all you'll need Winamp (a version 5.0 or higher for the plugin to work correctly).
- The Now Playing plugin.
- And a server that has PHP (for the purpose of this walkthrough a version 4.x is needed, but it should work just fine on higher versions) and MySQL (or some other database installed).
- And of course a text editor capable of edinig lines of PHP code.
Configure the plugin
I will trust you can make it to this point on your own, if not there are suitable instructions on the Winamp and Now Playing plugin home page.
But the documentation on configuring the plugin was a bit vague, at least to me. They forgot to mention to enable the plugin :)) Check the image for the settings I chose and where you find them.
Now everytime a song changes the plugin sends the information about the current song to the url you provided, wich points to a PHP script we'll discuss next.
The script
This script is part of a larger CMS framework, but the idea is the same as in a normal script. Let's take a look:
if ($_POST['Playing'] == 1) {
// we can add the mp3 info to the database
$query = "INSERT INTO winamp_playlist VALUES
('0', '".$_POST['Artist1']."',
'".$_POST['Title1']."', '".time()."')";
$result = $db->query($query);
}
exit();
As you can see everything is pretty straightforward. The database contains only an id, artist, title and the time the song was played. However, the condition is worth noting. The Playing parameter is 1 if Winamp is acctually playing the song. Here's some more info on the remaining parameters.
Parameters which are sent are:
Playing = 1 - WinAmp is playing the track, 0 - WinAmp is stopped.
Artist1 = Artist of currently playing or last played track.
Title1 = Title of currently playing or last played track. Album1 = Album of currently playing or last played track.
Year1 = Release year of currently playing or last played track.
Track1 = Track number of currently playing or last played track.
Length1 = Length of currently playing or last played track.
Genre1 = Genre of currently playing or last played track.
Quality1 = Quality of currently playing or last played track.
Comment1 = Comment of currently playing or last played track.
Filename1 = Filename of currently playing or last played track.
So all you have to do now is sit back and listen to some music and let the plugin do its thing.


Now Playing: An iTunes for Windows Plugin. Haven't tried it yet but it looks like the right one to try.
iTunes Watcher
But you're on your own on this one :)
Got to love free software :-)
Cheers,
Pascal
Soon everyone can know what weirdness I listen to! Oh no...
Andy, don't even mention it :)