Pandora Feeds for WordPress

Important notice: As of 3-May-2007 Pandora is blocking users living outside the U.S. from using the service, which affects me also. Therefore, I can only offer limited support for this plugin.

  1. Description
  2. Download
  3. Requirements
  4. Installation and Setup
    1. What is my account-name?
  5. Adapt your Theme
    1. Display Stations
    2. Display Songs
    3. Display Artists
    4. Using Stylesheets
  6. WordPress Pandora Widget
  7. Need Help?
  8. Found a bug? Feature request?
  9. License

Description

Inspired by and building upon the great work of Jean-Paul Franssen, who developed a wordpress-sidebar-widget to display feeds coming from Pandora, I have now finished programming a WordPress plugin, which can help you to place Pandora-feeds freely anywhere in your theme-templates.

You can see it in action here.

The plugin receives the feeds from Pandora and transforms the data into xHTML that can be integrated into your WordPress themes. To retrieve the feeds, the MagpieRSS-library which is integrated into WordPress is used. WP’s MagpieRSS is configured to cache the retrieved data in your database. This will limit the requests sent to Pandora and increase the performance of this plugin and your site.

This is the first plugin I wrote, so I cannot guarantee it to be 100% error-free. However, I have tested it with WordPress 2.1 and it should work fine. It might also work with WordPress 2.0, but this is untested. I can’t help you, if there should be problems connected to WP 2.0 or older.

Please don’t post comments, if you need help! Use the forum instead! Thank you.

I’m developing this plugin in my spare time, so I cannot reply to every request at once. But I’m willing to help you as quickly as possible.

This page you are currently reading should answer all your questions regarding installation, setup and usage of this plugin. If not, please feel free to contact me!

Pandora and the Music Genome Project are registered trademarks of Pandora Media, Inc.

There is a support-forum for this plugin.

Download

The current version 0.5.0.3 can be downloaded here:
zip archive at wordpress.org.

The plugin’s sourcecode is available via subversion repository

Requirements

All you need:

Installation and Setup

Complete these steps to install the plugin:

  1. Download the archive and extract the files
  2. Copy the file pandorafeeds.php into your plugin-directory: www.yourblog.com/wp-content/plugins/
  3. Go to the plugin-section of your blog’s admin-area, scroll down to Pandora Feeds for WordPress Plugin and press activate.
  4. Now go to the Options section and klick on ‘Pandora Feeds’
  5. Insert your Pandora-account name into the input-field. You register at Pandora with your E-Mail-address. Your account-name is the local-part of the address. For example, if you have registered with john.doe@example.com, you should enter john.doe into the textfield.
  6. Congratulations, you’re done! Now you can adapt your theme.

What is my account-name?

To find out, open your pandora-player and view your profile:

Screenshot of Pandora-Player

When you click on View your Profile, a new browser-window or -tab will open. Take a look at the new URL:

The address-bar

The part of the URL right from people/ is your account-name (jan.weinschenker in this example).

Adapt your Theme

The plugin provides three tags that can be used inside WordPress-themes. They are further explained in the following subsections. It is not needed to place these tags inside the WordPress Loop.

The tags will deliver lists of xHTML-1.1-listitems (<li> … </li>). That should make it easy to insert them into a static page for example.

Display Stations

<?php pandorafeeds_display_user_stations(NUMBER_OF_ITEMS); ?>

This tag creates a list of your stations. It should be enclosed inside an <ul>-tag.

The parameter NUMBER_OF_ITEMS will be the maximium number of stations to be displayed. For example …

<ul>
<?php pandorafeeds_display_user_stations(15); ?>
</ul>

… would display the 15 most recent of your Pandora-stations. If you only have 8 stations, the list will only consist of these 8 stations. If you want all of your stations to be displayed, set the parameter to -1:

<ul>
<?php pandorafeeds_display_user_stations(-1); ?>
</ul>

Each listitem represents one of your pandora-stations and will look like this:

<li class="pandorafeeds-stations">
<a href="%URL_TO_STATION%" class="pandorafeeds-stations" title="%STATION_NAME%">
%STATION_NAME%
</a>
</li>

  • %URL_TO_STATION% will be the URL pointing to your station at pandora
  • %STATION_NAME% will be the name of you station

Notice the CSS-class ‘pandorafeeds-stations’. You can use it to adapt the look of the listitem to your theme.

Display Bookmarked Songs

<?php pandorafeeds_display_bookmarked_songs(NUMBER_OF_ITEMS, SHOW_COVER); ?>

This tag creates a list of your bookmarked songs. It should be enclosed inside an <ul>-tag.

The parameter NUMBER_OF_ITEMS will be the maximium number of songs to be displayed. You can set it to -1 to display all of your favorites. The parameter SHOW_COVER lets you decide, if images of the CD-covers should be displayed. For example …

<ul>
<?php pandorafeeds_display_bookmarked_songs(15, true);?>
</ul>

Will show the 15 most recent bookmarked songs together with their CD-cover.

<ul>
<?php pandorafeeds_display_bookmarked_songs(15, false); ?>
</ul>

Will show the same list, but with no CD-covers.

Each listitem represents one of your pandora-stations and will look like this:

<li class="pandorafeeds-favorites">
<img src="%URL_TO_COVER%" class="pandorafeeds-favorites" title="%TITLE% - %ARTIST%" alt="%TITLE% - %ARTIST%" />
<a href="%URL_TO_SONG_AT_PANDORA%" class="pandorafeeds-favorites" title="%SOME_DESCRIPTION%">
%TITLE%
</a> by %ARTIST%
</li>

  • %URL_TO_COVER% will be the URL pointing to the image of the cover at Pandora.
  • %TITLE% will be the title of the song.
  • %ARTIST% will be the name of the artist.
  • %URL_TO_SONG_AT_PANDORA% will be the URL pointing to more information about the song.
  • %SOME_DESCRIPTION% will be a short description of the song.

Notice the CSS-class ‘pandorafeeds-favorites’. You can use it to adapt the look of the listitem to your theme.

Display Bookmarked Artists

<?php pandorafeeds_display_bookmarked_artists(NUMBER_OF_ITEMS); ?>

This tag creates a list of your bookmarked artists. It should be enclosed inside an <ul>-tag.

The parameter NUMBER_OF_ITEMS will be the maximium number of artists to be displayed. For example …

<ul>
<?php pandorafeeds_display_bookmarked_artists(15); ?>
</ul>

… would display the 15 most recent of your bookmarked artists. If you only have 8 artists, the list will only consist of these 8 artists. If you want all of your artists to be displayed, set the parameter to -1:

<ul>
<?php pandorafeeds_display_bookmarked_artists(-1); ?>
</ul>

Each listitem represents one of your pbookmarked artists and will look like this:

<li class="pandorafeeds-favoriteartists">
<a href="%URL_TO_ARTIST_AT_PANDORA%" class="pandorafeeds-favoriteartists" title="%ARTIST%">
%ARTIST%
</a></li>

  • %URL_TO_ARTIST_AT_PANDORA% will be the URL pointing to more information about the artist
  • %ARTIST% will be the name of the artist.

Using Stylesheets

You can use CSS to design the look of the lists. The following code shows the relevant style-classes, which you can adapt to your theme.

/*
* Style-classes for your stations
*/

li.pandorafeeds-stations {
/* define the look of listitem here*/
}

li.pandorafeeds-stations a {
/* define the look of an enclosed link here*/
}

/*
* Style-classes for your bookmarked songs
*/

li.pandorafeeds-favorites {
/* define the look of listitem here*/
}

img.pandorafeeds-favorites {
/* define the look of an enclosed image here*/
vertical-align: text-top;
}

li.pandorafeeds-favorites a {
/* define the look of an enclosed link here*/
}

/*
* Style-classes for your bookmarked artists
*/

li.pandorafeeds-favoriteartists {
/* define the look of listitem here*/
}

li.pandorafeeds-favoriteartists a {
/* define the look of an enclosed link here*/
}

WordPress Pandora Widget

If you plan to insert the feeds into your sidebar, the WordPress Pandora Widget from Jean-Paul Franssen will be your friend!

Need Help?

There is a support-forum for this plugin.

Found a bug? Feature request?

This plugin is hosted at WordPress.org, which is the right place for these matters. Of course, you can also send me an e-mail.

If you want to report a bug or submit a feature request, I would be delighted to hear from you! Please use this form to get in touch with me. Fill out the form and remember to select my plugin at the Component-section (choose “pandora-feeds-for-wordpress”):

Submit a ticket at WordPress.org

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Pandora and the Music Genome Project are registered trademarks of Pandora Media, Inc.

Google PageRank 5 5

53 thoughts on “Pandora Feeds for WordPress”

Leave a Reply