Upload a Graphic of Your Currently Playing Song

With Now Playing, you can upload to your web site a .png file that shows which track you are currently listening to in iTunes.

Blogs are great. Blogs that have graphics that update automatically to show which song you are listening to are even better! With this hack you will be able to post a graphic (automatically updated every 15 seconds) that will show the song you are currently playing in iTunes. You can use any number of template graphics or design your own.

This hack uses a program called Now Playing (http://www.big.or.jp/~crane/soft/nowPlaying/; free). Yes, that is .jp; most of the site is in Japanese, and there is only one help file in English. Don’t worry, though; Now Playing spits out titles in English, and if you read this hack closely, you’ll have all the knowledge you need to get the most out of the application.

Now Playing has a one-window interface with four tabs: Theme, Network, Filter, and Etc (shown in Figure 4-41).

Now Playing’s interface

Figure 4-41. Now Playing’s interface

The Theme panel is where you select the look of your graphic. You can select any of the more than 10 available themes. A preview loads in the window below. Within any particular theme, you can adjust the display font used by clicking on the Define button. Select any font you want and preview how it looks within the window.

Now that you have determined the look and feel of your graphic, it’s time to tell Now Playing your server settings. You do this in the Network panel. Now Playing will play nicely with three server protocols: FTP, .Mac, and WebDav. If you want to post your image on your web site, enter your FTP server name, your username, and your password. In the Path field, enter where you want the .png file that Now Playing creates to reside. On a typical server setup, this location would be your Images folder.

If you want to host the .png on your .Mac site, enter your .Mac username and password. Now Playing will only work with .Mac if you don’t provide a path (i.e., don’t put the .png within a folder on your server; just keep it at the uppermost level). WebDav settings are similar to FTP settings; you’ll need to provide a server and a username and password.

The final button on the Network panel is the Automatic Uploading button. This is where the fun begins. Sure, you could keep Now Playing open and hit Upload Now every five seconds, but that isn’t fun, is it? Turn on Automatic Uploading, and Now Playing does your grunt work for you. Every 15 seconds, Now Playing will check what is playing in iTunes, pass on that data to create a .png file on the fly, and upload it to your server. Very cool.

The Filter tab allows you to exclude certain items. Don’t want your friends to know that you listen to Milli Vanilli all day? Just exclude them in the Artist field. You can also exclude whole genres.

The final tab, Etc, allows you to adjust the transparency of the widget that Now Playing displays on your desktop.

To display your image on your web page, use a regular old HTML image tag. Place the tag in your HTML code in the spot where you want the .png to show up. That’s it! Every time your visitors come to your web page, they will be able to see what you are enjoying in iTunes at that very moment!

Get iPod and iTunes Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.