About My Setup

I use Netjuke to organize my modest (but growing) MP3 collection. Everything from cataloging my tracks, creating and organizing playlists, to storing and tagging track metadata. I have used this software for a very long time and I (as well as my roomates) have become very used to using it to 'spin' tracks at parties.

We have our home stereo system hooked up to the soundcard on a Linux server, and it sounds great and can be controlled from any computer in the place (we have 6, included 2 wireless laptops).

For a while, I was using the only software I could find for managing playlists. It was called MMMpg123 (website taken down), but it is software that has appeared to be dead for quite some time (last update: 2001), so I had hacked the code a little to provide the queuing of individual songs. About 6 months later I coded a PHP script to enqueue a whole Netjuke playlist. It worked well, but MMMpg123 was unreliable and was not flexible. I started looking for other programs to integrate.

I found irmp3d. This was kinda what I was looking for, but (in my opinion) the code was not written very efficiently, and they made it hard to interface using sockets (can we say PLEASE send a EOF at the end of your transmission!!!) I hacked up their code for a while, but soon found another program, so I didn't get very far...


Along comes MPD

MPD was exactly what I was looking for. Easy to use, a boatload of features, and most importantly (to me) it could be easily talked at using sockets. Spent some time looking at phpMp from the MPD guys, but I had spent so much time cataloging my songs in Netjuke, and I find it to be a more powerful interface. So I integrated the two.

Just a few clicks of a song in the file list of Netjuke, and it's queued in MPD. Click the button next to any playlist, and it is queued. Here's what it looks like:

Netjuke-MPD Thumbnail - click to enlarge
Netjuke/MPD Integration - click to enlarge


My custom MPD interface (using my MPD-Class) is on the left panel, and it is in a frame that refreshes every 20 seconds to provide up-to-date playing info. Netjuke is on the right, and occupies most of the space on the screen.

It works well, and it is what I am currently using now for my home audio player.


Look Cool? Patch the Easy Way!

You can have the same setup!! I've created a patch release for Netjuke v1.0-pre2 that will use my MPD PHP Object class to integrate the functionality of Netjuke and MPD. With this, you will have the same configuration as I do. The only thing you will need to do is apply the patch, and then maybe change some configuration variables.

Download the patch by clicking here. Instructions for applying the patch are contained in the README file in the distribution.


Patching Manaully

After quite a few requests, I've put together a guide for setting up your own jukebox...

Note: The steps below require a moderate knowlege of the PHP and HTML languages. I do not provide modified code of other people's work for licensing reasons, and I do not intend to write your code for you. I will provide you with as much information as I can, but I cannot guarantee that doing these things will work; it may even render your Netjuke setup unusable. On a lighter note, clowns.

Another Note: The code below refers to Netjuke v1.0-pre1. I do not guarantee results using other versions of Netjuke, however versions close to this should work OK.

Yet Another Note: You sure you don't want to just Patch? :)

What you're gonna need:
  • A working Linux setup running Apache and PHP (this class has not been tested on Windows, but I do not anticipate issues.).
  • If you haven't already, go snag Netjuke and get it working on your network.
  • The latest version of MPD. You will not need any MP3/Ogg decoder, as MPD has got all that packed in.


    The basic idea:
    I used my MPD-Class to create a jukebox-only panel for the left side of screen. This is done through a HTML Frameset in order to be able to independantly control both the Jukebox and Netjuke. I merged in some Netjuke functions to maintain the look-and-feel of NJ, plus I used it for some DB query access. I also created my own 'Play on Jukebox' icon similar to the Orbit icon set that is distributed with Netjuke.


    What you're gonna do:
  • The first step is to point Netjuke and MPD to the same music directory. This means modifying your mpd.conf file and configuring the "Music Directory" setting of Netjuke to refer to the same path. This can be through symbolic link or through absolute paths.
  • Download and install v1.1 of my PHP Class. (link) See the INSTALL file included for instructions on where to put it, etc.
  • Download my Netjuke Integration Pack. Unpack the file in your Netjuke install directory. For my own sanity, I do not support this software. But I use and update it regularly.
       This package contains three files:
        - index.html : This will provide the HTML Frameset. Place this file in your Netjuke root directory.
        - icon.serverplay.gif : The icon I used to queue songs in the Jukebox. Place this file in your Netjuke Icons directory (NETJUKE_ROOT/var/html/icons/orbit). If you wish to use this icon, you must be using the Orbit Icon theme that comes with Netjuke. I did not create icons for any other theme, you're on your own for that.
        - nj-jukebox.php : The source code for the Jukebox. Place this file in your Netjuke root directory.

  • Modify your the buildButton() function to accept an additional (sixth) parameter, $frameTarget. This function is located in the NETJUKE_ROOT/lib/inc-html.php file. The modified function declaration call should look something like this:
    
           function buildButton($link = "", $title = "", $icon = "", $target = "", 
    	                          $in_header = false, $frameTarget = "")
  • Futher modify this function to actually use this additional parameter. The code modified should look like:
    
            if ($link) {
                    $output = "<a href=\"$link\" target=\"".$frameTarget."\" 
    				     title=\"$title\"$remote>$output</a>";
            }
    
  • Modify the NETJUKE_ROOT/search.php file to be able to queue the files in the Jukebox. You'll want add an additional button before each track that will do this. The code for doing this looks like:
    
            $queueButton = buildButton(WEB_PATH."/nj-jukebox.php?m=add&filename=".$fields[4], 
      		    "Click here to queue track in Jukebox",'serverplay','',false,'playlist');
    
    You'll want to place the $queueButton variable into the table where the other buttons (Play, Download, etc) are.
  • Do the same with NETJUKE_ROOT/pl-list.php, NETJUKE_ROOT/pl-edit.php, NETJUKE_ROOT/community.php, NETJUKE_ROOT/pl-shrd-list.php, but instead you'll want the nj-jukebox.php program to queue a Playlist instead of an individual track:
    
            $queueButton = buildButton(WEB_PATH."/nj-jukebox.php?m=pladd&pl_id=".$dbrs->fields[0],
                "Click here to queue playlist in Jukebox",'serverplay', false,'playlist');
    
    Place the $queueButton variable next to the other Button variables (Play, etc...).
  • Try it out! If you load up your page, you should get Netjuke in the right pane of the Frameset, and the MPD Jukebox in the left pane. Clicking on the newly-added buttons will add songs/playlists to the Jukebox queue.

    In case you haven't guessed yet , I offer no guarantees. This stuff worked for me. I am not really prepared to debug your specific setup.

    GOOD LUCK! HAPPY TUNING!