WordPress Plugin – Playlist217

Description

Playlist 217 allows a radio station to maintain a live “now playing” list of tracks played on their station. It accepts an artist name and track title via a URL, stores it, and when possible matches it to the appropriate album art for display. Playlists can be displayed as “most recent” or from a specified date/time range.


Download

WordPress Repo: http://wordpress.org/extend/plugins/playlist-217/

Direct Downloads:

Version 2.0.25/25/2011
Version 2.0.15/17/2011
Version 2.05/13/2011
Version 1.04/2/2011


Screenshots


Contributors: Nikki Blight
Tags: playlist, music, radio
Donate link: http://nlb-creations.com/donate/
Requires at least: 3.1
Tested up to: 3.1.2
Stable tag: trunk


Installation

  1. Upload playlist217.zip to the /wp-content/plugins/ directory and unzip.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Under the new Albums menu, click on Playlist217 Settings, and add your AudioScrobbler API keys.
  4. Send track information to the plugin via the ingest.php script.
    Example: http://www.example.com/wp-content/plugins/playlist-217/ingest.php?&artist=Weird%20Al%20Yankovic&track=Jurassic%20Park
  5. See the output.php file in the zip archive for examples of template functions.

Frequently Asked Questions

What’s the point of this plugin?

It was originally written to take the place of similar code written for a custom CMS when the217.com was migrated to WordPress. At the time, the217.com was the online home of WPGU 107.1 FM, a commercial radio station that streamed live on the internet. They needed a real-time now playing playlist on the site, and the217.com’s CMS accommodated that need by working in conjunction with a Cocoa application that fed it GET requests containing the current artist and track (the Cocoa application, in turn, was fed by the Scott Studios software that ran the station). When the decision was made to migrate, the site code responsible for this feature was reworked into a WordPress plugin.

I don’t like the default album artwork for unmatched songs. Can I change it?

Sure. Just replace the no-album-art.gif file in the playlist217 director with your own image file, keeping the same filename.


Changelog

2.0.2

  • Added an optional setting to restrict the ability to insert a new playlist entry to a single IP address.
  • Fixed a formatting issue in the playlist_most_played() theme function.

2.0.1

  • Removal of some debug code

2.0

  • Upgraded the plugin to use the AudioScrobbler 2.0 service instead of the old 1.0 service.
  • Added the ability to optionally import or update an artist’s discography manually instead of relying on the ingest script to do it.
  • Fiddled around with the menus in the backend so they’re all grouped together.

1.5

  • Fixed bug wherein songs that didn’t match an artist were sometimes being rejected

1.0

  • Initial release

Upgrade Notice

2.0.2
Security update. Added an optional setting to restrict the ability to insert a new playlist entry to a single IP address.
2.0.1
Debug code that could cause some issues was removed.
2.0
This version gives site admins more backend options and makes managing your playlist easier.
1.5
This version fixes a very annoying bug.

Tags: , ,

16 Comments to "WordPress Plugin – Playlist217"

  1. Sakis D. says:

    Could you be more specific please on how to use it.. if we run an icecast server for example could we get the track info from the m3u playlist for example? or from winamp with a plugin maybe ?

    Thanks in advance

  2. Nikki Blight says:

    For the site this was originally designed for, we had a small script running on a server which pulled the information from the Scotts Studios software that ran the station. All the script did was look at the log files from Scotts Studios to check for new songs, and then send a GET request with the URL-encoded artist and track name to the plugin on the website. We had a cron job running it every 2 minutes.

    Icecast, I believe, has the option to keep a similar log. I’m not sure about WinAMP.

  3. Sakis D. says:

    First of all thanks a lot for the quick reply….
    I have a similar software and it creates me a file.txt with the file currently playing…
    Is it possible to help me out on how to set his up for you plugin to work???
    I dont have any coding skills sorry…

    Btw i’ve seen your plug on action on the radio website and it really rocks !

    Ps : The player you use is custom made or is it the default 360 provides ?
    i liked that too..

    • Nikki Blight says:

      I would probably do something like this:


      < ?php //read in the log file $logFile = "/var/www/logfile.txt"; $fh = fopen($logFile, 'r'); $theData = fread($fh, filesize($logFile)); fclose($fh); //extract the artist and track //the code for this would depend on the format of your log file //here I'm assuming that $theData is a string in the format "artist:title" $info = explode(":",$theData); $artist = $info[0]; $track = $info[1]; //send the request to the plugin $ch = curl_init('h ttp://mysite.com/wp-content/plugins/playlist-217/ingest.php?&artist='.urlencode($artist)'.&track='.urlencode($track); curl_exec ($ch); curl_close ($ch); ?>

      But the specifics of the code would depend on what your log file actually looks like.

      The player is the one from Live365, with a custom skin on it. I believe the designer just modified one of their templates to match the site.

      • Sakis D. says:

        Sorry nikki for disturbing you again but i need some more help 🙂
        my output file from the software is the rdssong.txt and the syntax of the output is : “Artist” – “tittle” it doesnt output album info jst those 2.

        My question is where do i put the code you provide me earlier in your post ??? Sorry but i can’t undestand am new at wordpress and php… 🙁

        If i undestand correctly i need to make an active ftp connection and always take the rdssong.txt and upload it every minute at the server right ? Any idea on how to do that???

        But the script you provide me earlier where do i put it ???

        Thanks for your support…

        • Nikki Blight says:

          Artist and title is all you need. The plugin handles finding the album via Last.FM’s API whenever possible. 🙂

          You shouldn’t need to FTP anything, so long as the machine on which the log file exists has PHP installed (alternatively you could use a shell script, if PHP isn’t available, but I’m not so great at shell scripting myself, so I tend to stick to PHP). Here’s the basic idea:

          On the same server that’s running Icecast, you would have your log file, and something like the example PHP script from my previous post (it will probably need a little more work done to avoid posting duplicates, but it’s a start). You would just save it as it’s own file (name it playlistparser.php or something so you can remember what it is), somewhere on the server.

          Also on that same server, you would have a cron job that runs the PHP script every couple of minutes ( if you’re not familiar with cron, Wikipedia has a pretty good run-down of the basics: http://en.wikipedia.org/wiki/Cron ).

          Cron runs the script, and the script looks at the log file and sends a request to the Playlist 217 plugin on your website. From there, the plugin would take care of the rest.

  4. Sakis D. says:

    Niki i did what you said renamed the example to script.php but when i open it it simply appears its contents(the code i mean) on the page…
    I aslo run it on the server that the site is and i have the same results 🙁

    Has this something to do with the example code??

    • Nikki Blight says:

      If you’re trying to run it just off your own computer, my guess would be that you don’t have any kind Apache/PHP environment set up and running.

      If it’s not running on your server, double check that you’ve got opening and closing php tags (< ?php and ?>) surrounding the rest of the code. Also there shouldn’t be any spaces in those tags… WordPress apparently reformats them slightly when I post them in a comment.

  5. Sakis D. says:

    Niki you were right my bad it had to do with the php open and close it had spaces between them…

    But now i’ve got another one… i’ve got this :

    “Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content/52/7934852/html/icecast.php on line 14”

    Any idea???

    • Nikki Blight says:

      Whoops… that was my bad. Had a period in the wrong spot.

      Try changing line 14 to this:

      $ch = curl_init('http://mysite.com/wp-content/plugins/playlist-217/ingest.php?&artist=' . urlencode($artist) . '&track=' . urlencode($track);

      • Sakis D. says:

        Nikki New one…. lol

        Parse error: syntax error, unexpected ‘;’ in C:\wamp\www\playlist.php on line 14

        It just dont want to work 🙂

        I aslo removed the spaces in line 14 and i’ve got the same error..

        • Nikki Blight says:

          That’ll teach me to post code without running it first. 🙂


          < ?php //read in the log file $logFile = "logfile.txt"; $fh = fopen($logFile, 'r'); $theData = fread($fh, filesize($logFile)); fclose($fh); //extract the artist and track //the code for this would depend on the format of your log file //here I'm assuming that $theData is a string in the format "artist:title" $info = explode(":",$theData); $artist = $info[0]; $track = $info[1]; $url = "http://mysite.com/wp-content/plugins/playlist-217/ingest.php?&artist=" . urlencode($artist) . "&track=" . urlencode($track); //send the request to the plugin $ch = curl_init($url); curl_exec ($ch); curl_close ($ch); ?>

          • Sakis D. says:

            nikki first of all i would like to thank you for the great support here..

            Second that code must have worked (when i run the file i see an emply page) but i cant see the now playing on the site or any other info actually…

            From what i undestand i just open output.php then i simply copy and paste the code on the site or on a widget… Right ?

            I tested it with 2 (example) logfile.txt i uploaded.
            At the first one it gave me a php error in audioscrobler…(i think i couldnt find any album info) and on the second it just didnt show anything (i imagine this is the default if everything works ok)

            So why doesn’t it show anything !@???

            What else does it need ???

            (ps : when i insert it as a text widget the theme breaks down i beleive it has smthing to do with the width of the widget cause in my theme the max sidebar width is 300 px)

  6. Nikki Blight says:

    If you’re not seeing anything in the output, I would start by verifying that tracks are being inserted into the wp_playlist table. I don’t know the format of your logfile, and if it’s different from my example, it may not be processed correctly.

    Not sure on the audioscrobbler error… Double check that you’ve added your keys correctly, as described in the ReadMe file. Otherwise, if you could copy and paste the actual error, that would tell me more.

  7. zach says:

    i am trying to use your plugin and i have a liquid compass .pls file that it can pull the song infor form but have no idea wher to go form here.

    • Nikki Blight says:

      You will need to write a script that reads the .pls file and then sends a request to my plugin via the ingest.php script. See previous comments for an example.

      You would then need to call that script on a regular basis (for example, by using a cron job).

Leave a Reply

Your email address will not be published. Required fields are marked *

Nikki Blight – Web/PHP Developer