SageTV is a very powerful system, but it can be difficult to catch up to the advanced users sometimes. The most powerful functions are often in plugins or XMl files.

I wanted to create an area for videos and ripped DVDs that was protected with a password or other mechanism. The stock SageTv comes with parental Controls but these have numerous limitations:

  • Apply only to recordings or imported elements with a rating. None of mine had that
    • There is a way using properties files to add a rating to a video or DEVE, but it is a bit tedious.
  • Prevent playback, but do not prevent viewing the titles. I wanted more security than that.
  • Prompts for a code on every video, I preferred a prompt once for a directory style approach.

A solution to my problem was found in SageMC. I am using the latest pre-release as of the date of this post which resolves some squashed menu artifacts present in the 6.3.9 release. if you have a 2009 release of SageMC already installed it should work fine. Otherwise see below for installing the pre-release.

CAUTION: If the terms notepad, XML or editing a file cause your eyes to gloss over, your body to convulse or make absolutely no sense, then this is NOT for you. Find a local technical person to help, buy them a beer, pizza, etc and point them to the page you are reading. This is a summary of my steps and by no means complete, but it should get you started. So check out the various SageTV forum links provided as they contain many more details.

NOTE: This does not address recorded shows, I suspect the same mechanism can be used but have not tested. Pictures did not previously work, but may be working now. I only needed imported videos, so that is what this entry covers.

The basic theory for adding a menu is super easy, you create a new menu item with exclusions, and add a pin code. In practice it is a little trickier. There are two way sot edit the menu. The first way is by editing the sagemc_menu.xml file using notepad or another text editor. This is best done for advanced users since it tends to require a restart of SageTV to work. There is a reload-menu option in SageMC but I never found it to be reliable. The second method is done by creating and editing menus within SageTV using notepad to write small fragments of XML for the menus. In either case the basic process is identical.

  1. First you need to know the exact path your files were imported as. This is critical because case is important in the next steps.
    1. Using SageMC navigate to the SageTV core settings, usually via: My menu / Settings / Detailed Setup
    2. Then General / Media Center Import Directories / Modify
    3. Make a note of the exact paths for the videos you have imported
  1. If you private videos are not in a sub-directory then create an appropriate directory and move them there. This technique works by paths, not specific files.

For my structure the basic import directory is V:\Imported-Video, and yes that ‘V’ is case sensitive for our menu changes. If you have multiple directories the process is identical, it just gets a little more complex building the filters.

V:\Imported-Video
  DVD
  Others
  Restricted (this is what I will protect)
    ....

Press the [HOME] key to return to the SageMC menu (you may need to press it twice). once there highlight on your Video menu and right click on the background to bring up the edit menu. Here is where the fun starts.

Choose the Edit Menu Item and make sure the Current Menu Item near the top of the screen says your Video menu name. Then select Copy menu item to clipboard, open notepad and paste. You should see some basic XML that represents the video menu.

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE sageMenu PUBLIC "-//NIELM//DTD SAGEMENU XML 1.4//EN" "http://sageplugins.sourceforge.net/nielm_modules/dynamic_menu/sagemenu_1_3.dtd">
<sageMenu version="1.4">
    <internalScreenMenuItem icon="hover_my videos.png" screen="Video Library Folder View" title="Videos">
        <evalExpression></evalExpression>
    </internalScreenMenuItem>
</sageMenu>

All that need be done is add some exclusions to this so that this menu does not reveal the restricted area. The forum topic covers this fairly well, but here is a summary.

Each menu that will have a partial video list needs the following to trigger the logic for path handling.

<evalExpression>AddStaticContext("PathFilterExprs", new_java_util_ArrayList())</evalExpression&gt

No you need to decide if you will provide a list of paths to include or a list to exclude. You may be able to do both in a single menu, but I have not needed that. For my example I can allow all videos except for a specific path so I will specify the path I wish to exclude. Note I use the entire path name, including the drive (or UNC server) and it must exactly match the settings determined above in the media import directory settings.

NOTE: The ‘\\’ is required for each path separator, using a single ‘\’ will fail to match properly.

<evalExpression>java_util_List_add(PathFilterExprs, "V:\\Imported-Video\\Restricted")</evalExpression&gt

Finally the type of operation, include or exclude is needed. For this menu I wanted to exclude the path so the following will work.

<evalExpression>AddStaticContext("PathFilterExcludes", true)</evalExpression>

Now the entire new menu looks like:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE sageMenu PUBLIC "-//NIELM//DTD SAGEMENU XML 1.4//EN" "http://sageplugins.sourceforge.net/nielm_modules/dynamic_menu/sagemenu_1_3.dtd">
<sageMenu version="1.4">
  <internalScreenMenuItem icon="hover_my videos.png" screen="Video Library Folder View" title="Videos">
    <evalExpression>AddStaticContext("PathFilterExprs", new_java_util_ArrayList())</evalExpression>
    <evalExpression>java_util_List_add(PathFilterExprs, "V:\\Imported-Video\\Restricted")</evalExpression>
    <evalExpression>AddStaticContext("PathFilterExcludes", true)</evalExpression>
  </internalScreenMenuItem>
</sageMenu>

Copy this to the clipboard, right click on the SageTV backgound, select New and Paste menu item from clipboard A new Video menu item should appear. Click on this new menu and verify the restricted videos are not shown. If they appear then double check the paths, getting the case wrong, or using only one ‘\’ is a common error. Once you are happy with this you can rename this menu using the menu editing facilities touched on above (there is a rename for menus in the interface), or delete the original Video menu and move the current one into it’s place. Again, all done with the SageMC menu UI (no additional XML editing needed).

Now the counter part to this menu, the one that allows us to see the restricted videos. This is done in nearly the same way. The only difference is to include the paths listed instead of excluding them using false instead of true for the parameter to the PathFilterExcludes, see bolded text below.

<pre>
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE sageMenu PUBLIC "-//NIELM//DTD SAGEMENU XML 1.4//EN" "http://sageplugins.sourceforge.net/nielm_modules/dynamic_menu/sagemenu_1_3.dtd">
<sageMenu version="1.4">
  <internalScreenMenuItem icon="hover_my videos.png" screen="Video Library Folder View" title="Videos">
    <evalExpression>AddStaticContext("PathFilterExprs", new_java_util_ArrayList())</evalExpression>
    <evalExpression>java_util_List_add(PathFilterExprs, "V:\\Imported-Video\\Restricted")</evalExpression>
    <evalExpression>AddStaticContext("PathFilterExcludes", <strong>false</strong>)</evalExpression>
  </internalScreenMenuItem>
</sageMenu>

Create a new menu using this, it will be called the same as the other but you can easily rename it later. Click on it an verify that your restricted videos are shown.

The final step is to add a pin code. Highlight this menu, Edit menu item, Set pin code. You may also wish to Rename and Move item up/down at this time.

Sub menus and other things

I chose to create a sub-menu (_Private_) with a pin code, and placed my restricted video menu within that. This gives me a way to add other private elements without confusing my partner with an every changing menu.

I also find editing the entire menu much easier and faster, even given the tedium of restarting SageTV. If you are using SageTV as a server/client then be sure you are not recording something before restarting! Edit _C:\Program Files\SgaeTV\SgaeTV\sagemc_menu.xml_ using notepad (or like me, share the directory to you Linux box and edit using VIM). If you understand XML a little then you will see exactly how to apply the above changes to the menu. I used the existing sub-menu example to build my Private menu. You can even adjust the pin code from the XML.

Another option is to leave the Private menu item without any restrictions, so it sees all videos providing a one menu solution for those that know that pin code. I choose not to do this to prevent accidents, such as leaving the menu open while walking away. It is easier for me to remember if all I see are the Private elements.

Security

This solution is only a deterrent. In my case against my friends small children or overnight guests. My SageTV box is modestly secured to prevent physical tampering, but if a guest wants to snoop bad enough, I really do not have an issue with it.

Anyone that can log into the box and edit files can find your pin code. If you do not have a mouse or keyboard readily available or the SageTV system is otherwise physically secured (which is should be if you are that concerned) then someone can easily learn and or change the pin code.

A fully secured solution could be developed using TrueCrypt and some manual processes. But that is just silly for my case and I expect most others. If you are that worried you may wish to consider a separate viewing station.

Installing pre-release SageMC

NOTE: This will soon be out of date and I will try to remove these instructions after the next (and it appears the final until Phoenix replaces it) release of SageMC.

To install it do the following:

  • Install the SageMC 6.3.9 release from the link above, using the instructions found there
  • Install the SageMC pre-release (scroll to the latest attached file) per those instructions
  • Make sure to grab and install the Phoenix API. This is installed just like SageMC (extract files to SageTV/SageTV) except an import is not needed.

Configure SageMC as desired, get a feel for it before altering menus …