SuperSatellite ||

Subscribe (?) Subscribe to RSS

Advanced kPlaylist

Published on April 1st, 2008 in Tools: Print This Post

The following information is accurate as of the latest development build of kPlaylist, which is v1.7 rev479 that was released on the 1st of April, 2008. Get the most current version from kPlaylist’s download page. Revisions are issued pretty regularly, while the 1.7 base came out in 2006. I’m really not sure why he uses that kind of setup for versioning.

UPDATE (08.04.02): I just got word that version 1.8 of kPlaylist will be coming out once the current development code is deemed stable. This will be sometime after revision 480. Following that release, they will probably begin making regular development revisions based on the 1.8 code base, similar to what they are doing now on 1.7.

kPlaylist logoThis was surprisingly well timed, given that a year ago I published my little review in which I endorsed a piece of media streaming software called kPlaylist that I selected over a couple others when I was looking for a way to listen to my music when I wasn’t at home. It is by sheer coincidence that I decided now to go back and touch more on that software, giving a slightly more in depth look, and sharing some tricks and one of my tweaks that aren’t so well documented. Feel free to comment below and add your own advice, or correct any mistakes I might make (not that I ever make mistakes, who are we kidding?).

For those that are unfamiliar, kPlaylist is a PHP based script that allows you to store audio and video files on a web server, and output playlists that allow you to stream said files to the computer you are at. This is very handy if you have encoded a lot of CDs, and prefer to listen to them at work or at a friends house, without lugging the discs all over. You could also use it to share podcasts, or to create a band site where people can listen to and download your garage recordings, and anything along those lines. This does require you have access to a web server with ample storage space of course. I prefer to run my own from home, using No-IP.com to attach a domain name to my box on my internet connection. Just be sure you run a firewall, and that you have permission to share what you are with who you are. I won’t discuss the setup side of this. I assume you can set up your own MySQL database and connect to it and upload files and all that jazz. If you can’t, there’s support forums to help you out with that.

kPlaylist runs off one single file in its simplest form. We can refer to the kPlaylist site for a few of the software’s features:

  • Supports multiple music sources (drives, directories, nmb, smbfs, nfs, etc)
  • Multiuser based, includes automatic sign-up tool and user editor
  • Secure and safe, used daily in hundreds of installations worldwide
  • Upload, multiple upload, download and multi download support.
  • Inbuilt bulletin board to communicate with users
  • Randomizer function to find new and popular music and common music between users
  • Balance network load with the inbuilt streaming engine during streams and download.
  • Supports LAME to re-encode streams on-the-fly (transcoding)
  • History of activity, including detailed track use.
  • Mail functionality for attaching and sending a music file instantly.
  • Easy to get started; automatic upgrade and install.
  • International; supports 29 languages
  • Runs on all operating systems that support PHP and MySQL.
  • Audio support including, but not limited to mp3, ogg, wma, rma, wav, etc.
  • Tested with RealPlayer, XMMS, Windows Media Player, iTunes and Winamp.
  • Plus much, much more.

kPlaylist Screenshot 1So, let’s assume that you get everything set up and running. If so, you probably see something like what we have at the left (granted, I’ve already dug down into an album). If you are running off of the default install you probably notice that my setup looks a little different from yours. I’ve taken advantage some of the features that allow custom theming of kPlaylist. It also supports custom icon packs, so you can really get into how things display. The theme capabilities aren’t necessarily as robust as other applications, but you can still get in enough to have fun with it. Look at the left bar, and click on the button for Admin Control > Settings. This will get you into the settings console where you can start tweaking some of this stuff. Specifically, we want to look at the Customize tab.

kPlaylist Screenshot 2That would be this baby right here. First, if you’d like to embed kPlaylist into another app, like a CMS (Content Management System), you can turn off the Include Headers feature. This is useful if you want to integrate it with a community running on something like Drupal, Joomla, e107, or others. Otherwise, leave it on (which you normally will). The External Images path allows you to tell kPlaylist where to find alternative icons that you want to use. This is relative to the install root of kPlaylist. So, if you installed kPlaylist in a folder called /media, then theme/images/ would translate to http://www.yoursite.com/media/themes/images/. The best thing to do is download the default icon pack, and just start changing the ones you want. I do this, and rename the originals with a .bak extension, just in case I ever need to revert. Likewise, the External CSS (Cascading Style Sheets) File path works the same, allowing you to override default colors and layout settings for kPlaylist. Download the original at the link I just mentioned for images, and start tweaking, then upload it (probably near your custom images), and tell it to find it. You can do the same with Javascript and AJAX (Asynchronous Javascript And XML) frameworks for other options.

kPlaylist Screenshot 3In this case, if you use something like Prototype for AJAX functionality, you can enable additional features like the live Last Streams feed in the system. This can keep you apprised, live, of what people are listening too without the need to refresh the page. Hopefully, we’ll see more AJAX functionality like live-edit playlists soon. My fingers are crossed, and tempted to start coding such functionality myself…we’ll see. There’s a lot of room for growth of AJAX functionality in kPlaylist.

If you are anything like me, you’ve noticed that there are some pitfalls to the fact that kPlaylist is just a single file script. This is handy for simple setups, but can make upgrading tedious if you are using a lot of custom settings. This is because most of the more advanced settings are hardcoded into the script, rather than stored in the database (I’d love to see this change soon…). Actually, there’s a clever tool for simplifying upgrades without a lot of work remembering which variables you changed. You can create your own file, call it kpconfig.php, put it in with you kplaylist install, and store all your custom settings there. Then, each time that you upgrade, all your settings are still right there. The standard kPlaylist install will load this file after all the default settings are loaded, overwriting anything that you want customized. Here’s a sample of my kpconfig.php file:

  1. <?php
  2. $cfg[‘frontbulletinchars’] = 120;
  3. $cfg[‘enablegetid3′] = 1;
  4. $cfg[‘uploadselections’] = 24;
  5. $cfg[‘numberlogins’] = 1;
  6. $cfg[‘livestreamajax’] = true;
  7. $cfg[‘window_x’] = 420;
  8. $cfg[‘window_y’] = 220;
  9. $cfg[‘xspf_x’] = $cfg[‘window_x’] - 20;
  10. $cfg[‘xspf_y’] = $cfg[‘window_y’] - 20;
  11. $cfg[‘xspf_url’] = ‘xspf_player.swf’;
  12. $cfg[‘xspf_opt’] = ;
  13. $cfg[‘xspf_enable’] = true;
  14.  
  15. $streamtypes_default = array(
  16. 0 => array   (‘mp3′,   ‘audio/mpeg’,               1, 1, 1, 1),
  17. 1 => array   (‘mp2′,   ‘audio/mpeg’,               1, 1, 1, 1),
  18. 2 => array   (‘ogg’,   ‘application/x-ogg’,        1, 2, 1, 1),
  19. 3 => array   (‘wav’,   ‘audio/wave’,               1, 0, 1, 1),
  20. 4 => array   (‘wma’,   ‘audio/x-ms-wma’,           1, 0, 1, 1),
  21. 5 => array   (‘mpg’,   ‘video/mpeg’,               0, 0, 1, 1),
  22. 6 => array   (‘mpeg’,  ‘video/mpeg’,               0, 0, 1, 1),
  23. 7 => array   (‘avi’,   ‘video/avi’,                0, 0, 1, 1),
  24. 8 => array   (‘wmv’,   ‘video/x-ms-wmv’,           0, 0, 1, 1),
  25. 9 => array   (‘asf’,   ‘application/vnd.ms-asf’,   0, 0, 1, 1),
  26. 10 => array  (‘m3u’,   ‘audio/x-mpegurl’,          0, 0, 0, 0),
  27. 11 => array  (‘flac’,  ‘audio/x-flac’,             1, 0, 1, 1),
  28. 12 => array  (‘jpg’,   ‘image/jpeg’,               0, 0, 0, 0),
  29. 13 => array  (‘gif’,   ‘image/gif’,                0, 0, 0, 0),
  30. 14 => array  (‘png’,   ‘image/png’,                0, 0, 0, 0)
  31. );
  32. ?>

You might notice two things there. One, I’ve opted to enable a Flash based media player (by turning on xspf_enable and setting xspf_url), so that I can play my music right through a web page (if you can’t figure out how to get it to work after setting it up, go into My > Options > Playlist, and set it as XSPF). You can upload any Flash media player that accepts XSPF playlists (Try out Lacy Morrow’s player, or the JW FLV Media Player for instance). kPlaylist recommends the XSPF Web Music Player, but it’s just awfully lightweight for my tastes. That leads me to the second thing you might notice about my config file. I have two variables that aren’t in the original product. This is for a mod that allows me to control the size of my Flash player in the popup window. The variable window_x and window_y let you control the window’s size, but the players themselves don’t always cooperate with that.

My solution takes two steps. First, create the two additional parameters:

  1. $cfg[‘xspf_x’] = $cfg[‘window_x’] - 20;
  2. $cfg[‘xspf_y’] = $cfg[‘window_y’] - 20;

Then, look around line 14,651 for the flashhtml() function. I comment it out, and right after it place this modified version:

  1. function flashhtml()
  2.   {
  3.     global $setctl, $phpenv, $u_cookieid, $u_id, $cfg;
  4.     kprintheader(, 0, 0);
  5.     $playlist = $setctl->get(’streamurl’).$phpenv[’streamlocation’];
  6.     $playlist .= ‘?templist=’.$u_id.‘&amp;c=’.$u_cookieid.‘&amp;file=’.lzero(getrand(1,999999),6).‘.xml’;
  7.     $link = $cfg[‘xspf_url’].‘?’.$cfg[‘xspf_opt’].‘autoplay=true&amp;autoload=true&amp;playlist_url=’.urlencode($playlist);
  8. ?>
  9.     <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="<?php echo $cfg['xspf_x']; ?>" height="<?php echo $cfg['xspf_y']; ?>" id="xspf_player" align="middle">
  10.       <param name="allowScriptAccess" value="always" />
  11.       <param name="movie" value="<?php echo $link; ?>" />
  12.       <param name="quality" value="high" />
  13.       <param name="bgcolor" value="#e6e6e6" />
  14.       <embed src="<?php echo $link; ?>" quality="high" bgcolor="#e6e6e6" width="<?php echo $cfg['xspf_x']; ?>" height="<?php echo $cfg['xspf_y']; ?>" name="xspf_player" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
  15.     </object>
  16. <?php
  17.     kprintend();
  18.   }

That allows the player size to be the full size of the window, minus a few pixels padding. So you can have full flexibility with both the player and its skin size.

There’s this thread in the support forums that you can look at for additional modifications as well, such as DNS (Domain Name Service) lookup on user IP addresses, showing the main directory in a scroll box, and a few others. These require a bit more editing, and will make future upgrades more involved though. You’ll find quite a bit of useful information in the forums that isn’t always available in the normal documentation. If you want to get really crazy, the source code is available too at Get Source page.

kPlaylist is getting increasingly more powerful lately. The enabling of XSPF is older, but still newish in general terms. Video support is being improved, there’s now built in zipping of multiple files (with PHP 5.2), virtual directory support, a network server mode, and more on the way. Still, it’s all around the most lightweight and useful streaming media server software that I’ve used. I do, however, think that there’s room for improvement, and I’m playing with the idea of forking the code and starting a new project based off it. If you’re interested in building a team to do that, contact me and we’ll talk.

Bookmark/Share:
  • Print this article!
  • E-mail this story to a friend!
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Slashdot
  • Digg
  • Reddit
  • Facebook
  • Fark
  • Google
  • Live
  • TwitThis
  • NewsVine
  • Pownce

0 comments ↓

Leave a Comment

Click to Download This Theme

Login/Register

Sign in with OpenID
Don't have OpenID? Get one here.
(What is OpenID?)
My Vidoop More secure than passwords.

My Tweets

Posting tweet...

Enjoying...

21 (Two-Disc Special Edition)The Nines (Special Edition)

The Sound Of Madness Limited Fan Club EditionIt's Not News, It's Fark: How Mass Media Tries to Pass Off Crap As News

My Stuff



Archives

My Zimbio Buddhist Blogs >