Now Playing: A Yahoo! Music Engine Plugin

Hacks, Now Playing13 Comments

Current version is released on 2008-11-17

Other Editions: iTunes for Windows | iTunes for Mac OS X | Winamp | Windows Media Player



The Now Playing plugin allows you to easily publishing what you are listening to! The end result is something that could look like this on your web site!

Yahoo! Music Engine allows you to install plugins that can do various tasks for you. The Now Playing plugin monitors the song you are listening to and publishes the data in various ways:

  1. Creates a XML file with information on that song. A file called now_playing.xml is created in your Now Playing plugin directory.
  2. The plugin also offers you the ability to FTP/SFTP that file to a server of your choosing after its updated.
  3. Create a ping with the song information.
  4. Post information on Twitter.

The idea is that you publish the XML up to your web server and then through some scripting magic, you can display your currently playing song or your recently played tracks. To make your web site more interactive, the plugin also retrieves the following information for you to use:

  1. URL of the album image cover art from (if found).
  2. Link to the product page for the CD (if found).
  3. Link to the Apple iTunes Music Store product page with the song highlighted within iTunes (if found).

Installation Instructions

  1. Run the installer.
  2. Start Yahoo! Music Engine.
  3. The configuration screen will come up right away the first time you run Yahoo! Music Engine after installing. Fill in whatever information suits you and hit OK when you are done.
  4. Play a song!


About: Get version information.

Now Playing Options - About

Options: Configure a few basic options for the plugin.

  • Publish Stop: If you want the plugin to publish a message when you stop playing music. The playlist in the XML will be emptied but it is still cached for the next time you fire up the player.
  • Clear Playlist: When the player exits, you can choose to keep or clear the playlist memory for the plugin.
  • Playlist Delay: The playlist will only keep a new entry if it plays for at least the amount of time specified. If you change tracks before the time elapses, the playlist entry for the song you skipped will be overwritten with the next song. So instead of advancing the oldest item off the list, it leaves the items in tact and just overwrites the prior.
  • Logging: If you are not getting the results you expect from the plugin, you may want to enable logging. A file called NowPlaying-Log.txt will be generated in the Program Files\Yahoo\Yahoo! Music Engine\Plugins\Now Playing directory. If you contact me about an issue, I will be more likely to solve your issue if you send the log file with the event captured at the debug log level.
Now Playing Options - General

XML: Configure some options for the XML file that will be generated.

  • Output File: Specify the location of the file that is created when the song changes. This file will be uploaded to your FTP/SFTP server if configured to do so. You may use date/time formatting codes, such as %Y, in the filename.
  • Encoding: Select which type of encoding your want for the XML. UTF-8 is the recommended choice.
  • XSL URL: This URL will be insert into your XML. You may leave the it empty if you do not use that functionality.
  • Wrap XML tag values with CDATA: Some song properties have odd characters inside of them and you may need to safely encode the XML depending on your parser.
  • Playlist Length: Enter the total number of songs that you want to publish in the XML file.
Now Playing Options - XML

Upload: Enter your server information to configure FTP/SFTP. Be sure that you have permission on your server to upload the file.

  • Filename: You may use date/time formatting codes, such as %Y, in the filename.
Now Playing Options - Upload

Ping: The plugin can send an HTTP POST request when the song changes. The request is sent after the upload of the XML file, if configured. Each of the XML tag names for the track are posted as fields.

  • URL: Enter a URL that will receive the POST request.
  • Extra Info: Enter a value that will be sent as a HTTP header called X-NowPlaying. You can use this to set a secret value that your script looks for to prevent unauthorized use.
Now Playing Options

Amazon: The plugin will query for additional information about your song, such as a link and the album image cover.

  • Enabled: Turn the lookup on or off.
  • Locale: Choose “us” for Amazon in the US, “ca” for Amazon in Canada, “uk” for Amazon in the United Kingdom, “de” for Amazon in Germany, or “jp” for Amazon in Japan.
  • Associate ID: Amazon allows you to collect referral fees on items sold when users click-through from your site. Enter your associate ID here.
Now Playing Options - Amazon

Apple: The plugin will query Apple’s iTunes Music Store for additional information about your song, such as a link.

  • Enabled: Turn the lookup on or off.
  • Affiliate ID: Want to receive a commission when users click-through and buy songs from your site at the iTunes Music Store? Join the Apple iTunes Affiliate program. Once you join, find out what your ID is by using the LinkShare link generator for any song and extract the ID parameter from the URL generated.
Now Playing Options - Apple

Twitter: The plugin can send an update to Twitter when the song changes.

  • Enabled: On or off.
  • Username: Your Twitter login.
  • Password: Your Twitter password.
  • Message: What you want the message to Twitter to say. You can enter a variety of tags that will be substituted into your message. Remember, Twitter takes a max of 140 characters.
Now Playing Options - Twitter

License: If and when you purchase a license, you will enter your registration information on the license tab. Enter the e-mail address you used for the PayPal transaction and the license key I sent you after the purchase.

Now Playing Options - License


The XML has the following format for a single song playlist. If you configure the playlist for more than 1 entry, there will be multiple song tags.

<?xml version="1.0" encoding="UTF-8"?>

<now_playing playing="1" timestamp="2004-05-24T23:12:46-07:00">

<song timestamp="2004-05-24T23:12:46-07:00">


<artist>Linkin Park</artist>



<kind>MPEG audio file</kind>


<comments>I like it.</comments>










<composer>Brandon Fuller</composer>





Frequently Asked Questions

  • Q: I lost my registration key. Can you resend it?
    A: You can retrieve it yourself here.
  • Q: How do I uninstall the plugin?
    A: Go to the Windows Control Panel, choose Add/Remove Programs, and then select Now Playing.
  • Q: How can I get back to the configuration screen?
    A: To configure, simplly select the “Now Playing Plugin” entry along the left side of the main window, then right-click in the larger right hand side window where the cover art is displayed.
  • Q: Why aren’t my Amazon or Apple links populated in the XML?
    A: It is because the Amazon or Apple search engine cannot find the album. These engines can be picky at times.
  • Q: Can you show me how to parse the XML file on my server?

    A: Sure. This sample will work for a single song or multiple songs.

    $file = "now_playing.xml";
    $xml_parser = xml_parser_create();
    if ( is_file( $file ) )
    $fp = fopen( $file, "r" );
    $data = fread( $fp, filesize( $file ) );
    fclose( $fp );
    xml_parse_into_struct( $xml_parser, $data, $vals, $index );
    xml_parser_free( $xml_parser );
    if ( $debug )
    echo "<pre>";
    echo "Index array\n";
    echo "\nVals array\n";
    echo "</pre>\n\n";
    if ( $vals[ $index["NOW_PLAYING"][0] ]["attributes"]["PLAYING"] == 1 )
    foreach ( $index["TITLE"] as $i => $j )
    $title = $vals[ $index["TITLE"][$i] ]["value"];
    if ( strlen( $title ) > 0 )
    $artist = $vals[ $index["ARTIST"][$i] ]["value"];
    $album = $vals[ $index["ALBUM"][$i] ]["value"];
    $genre = $vals[ $index["GENRE"][$i] ]["value"];
    $kind = $vals[ $index["KIND"][$i] ]["value"];
    $track = $vals[ $index["TRACK"][$i] ]["value"];
    $comments = $vals[ $index["COMMENTS"][$i] ]["value"];
    $time = $vals[ $index["TIME"][$i] ]["value"];
    $bitrate = $vals[ $index["BITRATE"][$i] ]["value"];
    $playcount = $vals[ $index["PLAYCOUNT"][$i] ]["value"];
    $compilation = $vals[ $index["COMPILATION"][$i] ]["value"];
    $urlamazon = $vals[ $index["URLAMAZON"][$i] ]["value"];
    $urlapple = $vals[ $index["URLAPPLE"][$i] ]["value"];
    $imagesmallurl = $vals[ $index["IMAGESMALL"][$i] ]["value"];
    $imageurl = $vals[ $index["IMAGE"][$i] ]["value"];
    $imagelargeurl = $vals[ $index["IMAGELARGE"][$i] ]["value"];
    $composer = $vals[ $index["COMPOSER"][$i] ]["value"];
    $grouping = $vals[ $index["GROUPING"][$i] ]["value"];
    $urlsource = $vals[ $index["URLSOURCE"][$i] ]["value"];
    echo "Now Playing is " . $title . " by " . $artist;
    echo "Now Playing is stopped.";
  • Q: I don’t understand all of this PHP stuff but I still want to do all these cool things. Can you help?
    A: Ok, I have zipped up the actual code I use on my own web site. You can download it and use it for your site or as a starter. Please don’t mail me to customize it for you. I don’t have time. So to use this: 1) Take the zip file and extract and place the files on your PHP-enabled web server. 2) Put the images into /images on your server. 3) Insert the following code in the web page that you want to display the music.
    <script type="text/javascript" src=""></script>
  • Q: How about a WordPress widget to display the output?
    A: Josh Blake wrote one. Check it out.
  • Q: Why can’t the year and rating be displayed?
    A: The year and rating are not available metadata items available to Yahoo! plugins. Ask Yahoo! because I don’t know why they didn’t make them available. Here is the list to prove.


I have done my fair share of free plugins lately. This one took a little more work so I decided to release it as shareware. So download the plugin and test it out. Make sure it does what you want. Once you are happy, order the licensed version for $15. You will receive a registration key via e-mail once I receive your purchase confirmation from PayPal. Oh yeah — be cool and keep your registration to yourself.

Also, if you would, you can put the Now Playing badge on your web site with a link back to this page. The more people that donate, the more I will be asked to develop new and interesting features that you will be able to take advantage of!

Now Playing

Here is the code for your site:


<a href="">

<img src="" alt="Now Playing" />




Download the current version from the link below. Past versions are not archived.

Version History

v3.6.4.2 — 2008-11-17
  • Added support for new Facebook profile.
  • Added file permission checks in installer for log and XML files.
v3.6.4.1 — 2008-07-08
  • Stopped URL encoding Facebook image URLs because Facebook does not like them anymore.
  • Added urlAmazon as a Facebook tag.
v3.6.4.0 — 2008-02-20
  • Migrating to Amazon Associates Web Service 4.0.
v3.6.3.0 — 2007-08-18
  • Removed FTP and SFTP warning dialog boxes. All errors are logged in the log instead.
v3.6.1.0 — 2007-08-03
  • Added Amazon image tags to Facebook output tags.
  • Adjusted list of Facebook output tags based on plugin edition.
v3.6.0.1 — 2007-07-17
  • Added Facebook “Add Application” button.
  • Fixed incorrect error message on Facebook authorize.
v3.6.0.0 — 2007-07-05
  • Added Facebook support.
v3.5.0.0 — 2007-03-22
  • Added Twitter support.
v3.4.1.1 — 2007-01-14
  • Fixed artwork ID value in XML to use UTF-8 characters before MD5 hashing.
v3.4.1.0 — 2006-12-19
  • Added UTF-8 encoding for ping data.
v3.4.0.3 — 2006-09-14
  • Apple broke the music store links — again.
  • Support for pinging SSL sites.
v3.4.0.2 — 2006-07-27
  • Update software version check.
v3.4.0.0 — 2006-06-29
  • Overhauled the ping functionality to support POST of all data elements to URL.
  • Added extra info field to ping.
  • Fixed Apple iTunes Music Store links. Apple changed format of link maker again.
  • Removed choice of Amazon image size from configuration.
  • Added all Amazon images sizes to the XML and ping.
v3.3.1.6 — 2006-03-31
  • Fixed issue with Amazon lookups when colons or apostrophes were in album or artist name.
v3.3.1.5 — 2006-02-13
  • Changed duplicate track detection mechanism.
  • Fixed issue with log file path which caused log not to generate.
v3.3.1.4 — 2005-11-13
  • Fixed iTunes Music Store lookups after Apple changed the link generator.
v3.3.1.3 — 2005-10-31
  • Better detection for duplicate tracks in playlist.
v3.3.1.2 — 2005-10-12
  • File uploads were causing problems when full path was not specified for the local XML file. Configuration now requires full path for local XML file.
  • Revised the Internet upload error dialog messages.
v3.3.1.1 — 2005-10-10
  • Fixed file upload issue when configuration did not have a path for the upload filename.
v3.3.1.0 — 2005-09-15
  • Added option to disable Amazon and Apple lookups.
v3.3.0.5 — 2005-09-08
  • Fixed uninstaller issues.
v3.3.0.4 — 2005-08-05
  • Prevent installation when media player is running.
v3.3.0.1 — 2005-07-25
  • Fixed FTP defect introduced in
v3.3.0.0 — 2005-07-24
  • Various UI tweaks.
  • Synchronize code with other media player editions.
v3.2.8.4 — 2005-07-14
  • First release!


For questions, suggestions, bug reports, and anything else, please e-mail or leave a comment. Please be sure to review the FAQ above before asking a question. Requests from those who have donated receive higher priority.