Configuring YAMJ for Multiple Libraries



NOTE: This page contains information used to configure YAMJ in various configurations but assumes a basic knowledge of YAMJ configuration, skill in PCH operation and familiarity with network shares. If you are just getting started with YAMJ, this page is highly recommended as a starting point.


Flattr this

Customizing YAMJ For Special Library Locations and Multiple Network Shares

Using Yet Another Movie Jukebox (YAMJ) with a simple library on the media player's internal drive is pretty straight forward but there are times when this won't be good enough. Invariably, after you use your YAMJ'd media player for a while you will want to use YAMJ to serve up media from other sources because: (a) you've run out of free space on the internal hard drive, (b) you've already got a ton of media files on NAS drives, USB drives or network servers and don't want to copy them over, or (c) you don't have an internal drive in the media player and want to pull everything across the network.

As a bit of preliminary clarification, I will refer to the media player as the PCH (Popcorn Hour, Networked Media Tank) but as we've explained elsewhere in these pages, you can apply this to numerous commercial or custom-built media players/servers.

There are an infinite number of possibilities here but we will look at a few common ones and you should be able to extrapolate these to your particular application. Although we are obviously only focusing on one or two libraries, I hope it will also become obvious that two is not the limit. Got an internal drive, a SMB share, an NFS share and two USB drives? Not a problem.


Let's look at:


Basic Principles

In holding to our keep-the-big-picture-in-mind paradigm here, there are a couple things you should remember about what follows:

  1. The only changes you need to make to YAMJ reside in the libraries.xml file.
  2. To utilize network shares (NFS or SMB) with the PCH, you will need to do some basic configurations
     on the PCH itself.
  3. The physical drive/host/share configuration DURING THE JUKEBOX BUILD has almost nothing to do 
     with the configuration FOR DAILY USE OF THE JUKEBOX.  They are two separate steps.
  4. There is a quirk with the NFS shares on the PCH -- you need to read those sections completely.


Two Libraries -- Internal Hard Drive and External USB Drive

This is a very common configuration and will require no (soft) configuration to the PCH. It does, however, require you to do a little shifting of the USB drive to build the jukebox.

We will be using the same network and host configuration we used for the internal-only jukebox build with one exception: The USB drive needs to be accessible to the YAMJ PC. Let me say there is a way to make a USB drive visible (via FTP) to a remote host while it is connected to the PCH. It is ugly and requires work well beyond the scope of what we are doing here. Besides, an FTP share is really not what you need.

Anyway, the easiest way to get the USB drive accessible to the YAMJ PC is to simply disconnect it from the PCH and connect it to a USB port on the PC. I suppose you could connect it to a tertiary server and then mount it there, whatever. The point is, the host running YAMJ needs to be able to interrogate the USB drive for files. It can't do this while it is connected to the PCH.

  1. Physically move the USB drive and connect it to the YAMJ PC
  2. Mount/map both the PCH internal drive and the USB drive on the YAMJ PC
  3. Modify the libraries.xml file to include the USB drive and the internal drive
  4. Run YAMJ
  5. Return the USB drive to the PCH and confirm that it mounts it to the correct USB path
  6. Browse to the YAMJ index.htm file and enjoy your multi-drive jukebox

===> Connect the USB drive to the YAMJ PC

Disconnect your USB drive from the PCH and connect it to the YAMJ PC. Note the drive letter that Windows maps for the USB. We will need that in the next step. For our examples, we will assume it has mapped it as our "F: drive" and we have our movie files in the Movies directory on the drive.


===> Map the PCH internal drive to the YAMJ PC

This should be nothing new. You do this every time you run YAMJ against your PCH internal drive. In our example we will map it as our "Z: drive" and we want to look in the Video directory for media files.


===> Modify the libraries.xml file

If you've followed the general process for establishing a library file (generally titled libraries.xml) we are simply going to modify that to include an extra xml cascade for the USB drive, almost identical to the one we did for the internal drive. Almost.

<libraries>
   <library>
       <path>Z:\Video\</path>
       <nmtpath>file:///opt/sybhttpd/localhost.drives/HARD_DISK/Video/</nmtpath>
       <exclude name="sample,tmp/,temp/,RECYCLE.BIN/"/>
       <description></description>
       <prebuf></prebuf>
       <scrapeLibrary>true</scrapeLibrary>
   </library>
   <library>
       <path>F:\Movies\</path>
       <nmtpath>file:///opt/sybhttpd/localhost.drives/USB_DRIVE_A-1/Movies/</nmtpath>
       <exclude name="sample,tmp/,temp/,RECYCLE.BIN/"/>
       <description></description>
       <prebuf></prebuf>
       <scrapeLibrary>true</scrapeLibrary>
   </library>
</libraries>

As always with libraries.xml files, our two important (new) lines here are the

<path>F:\Movies\</path>

and the

<nmtpath>file:///opt/sybhttpd/localhost.drives/USB_DRIVE_A-1/Movies/</nmtpath>

There are some things you need to confirm here. While we've used the F: drive and told it to look in the Movies directory, you need to make that correct for your USB drive as it is mounted to your YAMJ PC. Point that to wherever your movies are relative to the YAMJ PC. We've also used the USB "A-1" drive on the PCH. This will generally be correct but we will confirm that in a later step.

As always, you need to confirm that your PCH is mounted as an SMB share and that is correctly reflected in the first <library> section. We've used Z:\Video\ here.


===> Run YAMJ

Run YAMJ as you always do and you should see it grabbing files from both your USB drive and the PCH drive. Remember to include your run-time switches to point YAMJ to your libraries.xml file and your destination drive for the jukebox files.


===> Return the USB drive to the PCH

Reconnect your USB drive to the PCH. It should not matter whether you use the front USB port or the rear port. You should see it report USB_device_loaded (in the upper left, white font) indicating that it mounted the USB drive. If you then check your available sources by pressing the Source button on the remote, you should see it mounted as USB_DRIVE_A-1. Hmmmm... Where have we seen that before?

===> Browse to index.htm

You should now be able to select the local hard drive (HARD_DISK) as the source, browse to the right-most icon which is Other Media (as opposed to video or pictures or music), browse to the Video folder and click on the index.htm file. You should see all your files, from both the internal hard drive and the external USB. Of course when using the YAMJ GUI, the specific location of the files is transparent to the user -- as it should be.


A Single Library With No Internal Hard Drive -- A Single NFS Share

You can of course host YAMJ on a remote share and can even use the same YAMJ files simultaneously on multiple media players throughout the network. Here we will be using an NFS share (such as that provided by many commercial NAS boxes) without an internal hard drive in the PCH. You don't have to use NFS, the process is almost identical for SMB (CIFS) shares. The process is the same except mapping the SMB drive on the PCH is slightly different than mapping the NFS drive.

[We will not be discussing setting up NFS servers, NAS boxes, Windows Shares, etc. We assume you already have that network asset configured and live on the network.]

  1. Map the NFS drive to the YAMJ PC
  2. Modify the libraries.xml file accordingly
  3. Run YAMJ
  4. Map the NFS share on the PCH
  5. Browse to the YAMJ index.htm file and enjoy your network-hosted jukebox

===> Map the NFS share on the YAMJ PC

There is an assumption that the network share is accessible to the PC running YAMJ. It will need to be accessible to interrogate the media files. It is important to note that it doesn't really matter how you connect to this drive for this portion. You can connect to it via NFS or SMB (Windows Share) or however you like. It just needs to map as a drive to the PC.

For our example here, we will map it to the PC as our "N: drive". N for Network! Ha! Get it!?! ahem.... o.k. Moving on. We will assume our media files are in the Movies directory on our N: drive.


===> Modify the libraries.xml file

If you've followed the general process for establishing a library file (generally libraries.xml) we are simply going to modify that to look at the network share drive instead of the PCH internal drive.

<libraries>
   <library>
       <path>N:\Movies\</path>
       <nmtpath>file:///opt/sybhttpd/localhost.drives/NETWORK_SHARE/NFSVideo/</nmtpath>
       <exclude name="sample,tmp/,temp/,RECYCLE.BIN/"/>
       <description></description>
       <prebuf></prebuf>
       <scrapeLibrary>true</scrapeLibrary>
   </library>
</libraries>

As always with libraries.xml files, our two important (new) lines here are the

<path>N:\Movies\</path>

and the

<nmtpath>file:///opt/sybhttpd/localhost.drives/NETWORK_SHARE/NFSVideo/</nmtpath>

There are some important (and not so obvious) things to note here. You'll notice we've used our N: drive and told it to look in the Movies directory. This is going to look at our NFS drive mounted on the YAMJ PC. As always, this is relative to the YAMJ PC and will have no bearing after the YAMJ files are created.

We've also used the NETWORK_SHARE "NFSVideo" drive on the PCH. You certainly do not have to use "NFSVideo" and can call this anything you want, it is just a label. Just be sure you remember what you called it because we will need it in a later step to configure the PCH. You do have to use the /NETWORK_SHARE/ part of that path though. That tells the PCH to look at at the network instead of the internal drive or an attached USB drive.


===> Run YAMJ

Run YAMJ as you always do and you should see it grabbing files from your remote "N: drive". Remember to include your run-time switches to point YAMJ to your libraries.xml file and your destination drive for the jukebox files. In this case, you want to save your jukebox files back to the NFS drive. The N: drive.


===> Map the share on the PCH

We need to tell the PCH how to find the NFS share so it can find not only the media files but also our jukebox files we just built.

Select the SETUP button on the remote or navigate there from the on-screen menus. On the left side, select NETWORK SHARE.

You should now have the option to [ADD] or [BROWSE]. Let's browse the network to find our network drive. Select [BROWSE] and give it a second. You should then be presented with a menu showing the types of shares visible to the PCH. Generally there will be a Workgroup icon and a NFS Server icon.

[At this point you can choose SMB (Windows share) servers if you like. For the purposes of our demo, we are going to pick the NFS servers but mapping either service type is very similar. Regardless of what you select, remember to map the share as "NFSVideo" or whatever <nmtpath> you selected in the libraries.xml file]

Select the NFS Server icon. You should now see your NFS servers that reside on the network identified by IP address or name. Select the correct server. You should then see all the shares for that server.

Select the shared directory corresponding to where your media files reside. Above we were assuming the media files were in the Movies directory. The PCH should then drop you to a menu giving you options for [Server Name], [URL], [User Name] and [Password].

We are going to map this server share as "NFSVideo" if you remember that from the <nmtpath> variable in our libraries.sml file. Whatever you called it there, that is what you need to insert in the [Server Name] field. The URL field should already be filled in (that's why we browsed). If you require username and password, fill in those two fields.

You should now drop back to the NETWORK SHARE screen and see your NFS server added as a permanent share, "NFSVideo". This is non-volatile and will survive a reboot.


===> Browse to index.htm

You should now be able to select SOURCE on the remote or by navigating there through the on-screen menus. You should see your network share (NFSVideo) available as a source. Select the share as the source, browse to the right-most icon which is Other Media (as opposed to video or pictures or music), browse to your "output" destination you chose when running YAMJ and click on the index.htm file. You should see all your files. Of course when using the YAMJ GUI, the specific location of the files is transparent to the user -- as it should be.




Two Libraries -- Internal Hard Drive and NFS Share

This is probably a common configuration for those of us with lots of files. This implementation requires some configuration of the PCH and also requires a step to overcome a quirk of the PCH. More on that below.

Here we will be using an NFS share (such as that provided by many commercial NAS boxes) in addition to the internal hard drive in the PCH. You don't have to use NFS, the process is almost identical for SMB (CIFS) shares. The process is the same except mapping the SMB drive on the PCH is slightly different than mapping the NFS drive.

[We will not be discussing setting up NFS servers, NAS boxes, Windows Shares, etc. We assume you already have that network asset configured and live on the network.]

YAMJ (actually the YAMJ PC) will need to access both the PCH internal hard drive and the NFS share. It only needs this access during the build, of course, but configure your network and hosts as necessary to get everyone on the same network.

  1. Mount/map both the PCH internal drive and the NFS drive on the YAMJ PC
  2. Modify the libraries.xml file to include the NFS share drive and the internal drive
  3. Run YAMJ
  4. Map the NFS share on the PCH
  5. Browse to the NFS share from within the PCH
  6. Browse to the YAMJ index.htm file and enjoy your multi-drive jukebox

===> Map the PCH internal drive and the NFS share to the YAMJ PC

Mounting the internal drive should be nothing new. You do this every time you run YAMJ against your PCH drive. Just mount it as a drive letter, for our example we will assume it is mounted as the "Z: drive" and our media files are stored in the Video directory.

Mount your NFS share as anything you like on the YAMJ PC. There is an assumption that the network share is accessible to the PC running YAMJ. It will need to be accessible to interrogate the media files. It is important to note that it doesn't really matter how you connect to this drive for this portion. You can connect to it via NFS or SMB (Windows Share) or however you like. It just needs to map as a drive to the PC. This connection/mount is only for building the database and has nothing to do with how the PCH will later mount this share.

For our example here, we will map it to the PC as our "N: drive". We will assume our media files are in the Movies directory on our N: drive.


===> Modify the libraries.xml file

If you've followed the general process for establishing a library file (generally titled libraries.xml) we are simply going to modify that to include an extra xml cascade for the NFS share, almost identical to the one we did for the internal drive. Almost.

<libraries>
   <library>
       <path>Z:\Video\</path>
       <nmtpath>file:///opt/sybhttpd/localhost.drives/HARD_DISK/Video/</nmtpath>
       <exclude name="sample,tmp/,temp/,RECYCLE.BIN/"/>
       <description></description>
       <prebuf></prebuf>
       <scrapeLibrary>true</scrapeLibrary>
   </library>
   <library>
       <path>N:\Movies\</path>
       <nmtpath>file:///opt/sybhttpd/localhost.drives/NETWORK_SHARE/NFSVideo/Movies/</nmtpath>
       <exclude name="sample,tmp/,temp/,RECYCLE.BIN/"/>
       <description></description>
       <prebuf></prebuf>
       <scrapeLibrary>true</scrapeLibrary>
   </library>
</libraries>

As always with libraries.xml files, our two important (new) lines here are the

<path>N:\Movies\</path>

and the

<nmtpath>file:///opt/sybhttpd/localhost.drives/NETWORK_SHARE/NFSVideo/</nmtpath>

There are some important (and not so obvious) things to note here. You'll notice we've used our N: drive and told it to look in the Movies directory. This is going to look at our NFS drive mounted on the YAMJ PC. As always, this is relative to the YAMJ PC and will have no bearing after the YAMJ files are created.

We've also used the NETWORK_SHARE "NFSVideo" drive on the PCH. You certainly do not have to use "NFSVideo" and can call this anything you want, it is just a label. Just be sure you remember what you called it because we will need it in a later step to configure the PCH. You do have to use the /NETWORK_SHARE/ part of that path though. That tells the PCH to look at at the network instead of the internal drive or an attached USB drive.


===> Run YAMJ

Run YAMJ as you always do and you should see it grabbing files from your NFS "N: drive" and the internal PCH drive. Remember to include your run-time switches to point YAMJ to your libraries.xml file and your destination drive for the jukebox files. In this case, we are going to assume we save our jukebox to the internal drive but you could save your jukebox files back to the NFS drive.


===> Map the share on the PCH

We need to tell the PCH how to find the NFS share so it can find the media files.

Select the SETUP button on the remote or navigate there from the on-screen menus. On the left side, select NETWORK SHARE.

You should now have the option to [ADD] or [BROWSE]. Let's browse the network to find our network server. Select [BROWSE] and give it a second. You should then be presented with a menu showing the types of shares visible to the PCH. Generally there will be a Workgroup icon and a NFS Server icon.

[Note: At this point you can choose SMB (Windows share) servers if you like. For the purposes of our demo, we are going to pick the NFS servers but mapping either service type is very similar. Regardless of what you select, remember to map the share as "NFSVideo" or whatever <nmtpath> you selected in the libraries.xml file]

Select the NFS Server icon. You should now see your NFS servers that reside on the network identified by IP address or name. Select the correct server. You should then see all the shares for that server.

Select the shared directory corresponding to where your media files reside. Above we were assuming the media files were in the Movies directory. The PCH should then drop you to a menu giving you options for [Server Name], [URL], [User Name] and [Password].

We are going to map this server share as "NFSVideo" if you remember that from the <nmtpath> variable in our libraries.xml file. Whatever you called it there, that is what you need to insert in the [Server Name] field. The URL field should already be filled in (that's why we browsed). If you require username and password, fill those two fields in.

You should now drop back to the NETWORK SHARE screen and see your NFS server added as a permanent share, "NFSVideo". This is non-volatile and will survive a reboot.


===> Browse to the NFS share from the PCH

[*** This step is extremely important. You need to do this now and every time you cold-boot the PCH ***] The PCH will not recognize (for the purposes of YAMJ) the share you just mapped unless you actually browse to the network share. You can confirm this if you like by going to your jukebox and selecting a media file stored on the NFS share. It will not play correctly.

Very simply, select SOURCE on the remote or by navigating there through the on-screen menus. You should see your network share (NFSVideo) available as a source. Select the share as the source. Go into the share and pick any media file and press play. As soon as the movie starts to play, you can exit out. That's it. You just need to prod the PCH to recognize the share.


===> Browse to index.htm

You should now be able to select the local hard drive (HARD_DISK) as the source, browse to the right-most icon which is Other Media (as opposed to video or pictures or music), browse to the Video folder and click on the index.htm file. You should see all your files, from both the internal hard drive and the network share. Of course when using the YAMJ GUI, the specific location of the files is transparent to the user -- as it should be.



Two libraries -- Two External USB Drive

I'm tired of typing! ;-)

You can figure this out though. Simply look at the PCH internal hard drive and single external USB drive section. Instead of (or even in addition to) using the internal hard drive, you can insert the second USB drive information into the libraries.xml file.

<libraries>
   <library>
       <path>F:\Movies\</path>
       <nmtpath>file:///opt/sybhttpd/localhost.drives/USB_DRIVE_A-1/Movies/</nmtpath>
       <exclude name="sample,tmp/,temp/,RECYCLE.BIN/"/>
       <description></description>
       <prebuf></prebuf>
       <scrapeLibrary>true</scrapeLibrary>
   </library>
   <library>
       <path>G:\TV_Shows\</path>
       <nmtpath>file:///opt/sybhttpd/localhost.drives/USB_DRIVE_B-1/TV_Shows/</nmtpath>
       <exclude name="sample,tmp/,temp/,RECYCLE.BIN/"/>
       <description></description>
       <prebuf></prebuf>
       <scrapeLibrary>true</scrapeLibrary>
   </library>
</libraries>

Here, just as an example, we've pointed YAMJ to the second USB drive and the directory /TV_Shows/. Of course you can modify that to whatever you need on the second drive.

What's important here is the

<path>G:\TV_Shows\</path>

which points it to the locally-mounted (relative to the YAMJ PC) second drive and the

<nmtpath>file:///opt/sybhttpd/localhost.drives/USB_DRIVE_B-1/TV_Shows/</nmtpath>

which you'll note uses the USB_DRIVE_B-1 which is the second USB drive. Be careful when plugging the drives back into the PCH, make sure the first drive it mounts (A-1) is the one you want. The second drive will mount as B-1.


Hope this helps!

Copyright 2009 Pettingers.org

Vectors at

pettingers.org