From LedHed's Wiki
Revision as of 23:55, 19 July 2014 by Ledhed (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

MythTV supports Parental Controls (Levels 1-4).
MythTV only supports Parental Controls at the file level.

After some googling I found this thread: http://www.mythtv.org/pipermail/mythtv-users/2012-December/344698.html

This thread suggests the use of MySQL Triggers to set the Parental Controls on files that reside in a particular folder. This approach works well because it doesn't require someone to manually run a script. The only real drawback I see to this approach is that you would have to create two triggers for every folder. This could end up being a lot of work, so if you go this route I suggest you keep the folder count to a minimum.


The Trigger

Run the following commands within MySQL

USE mythconverg;

DELIMITER $$

CREATE TRIGGER videometadata_insert
BEFORE INSERT ON videometadata
FOR EACH ROW BEGIN
  IF NEW.filename LIKE '%/<<FOLDER_NAME>>/%' THEN
    SET NEW.showlevel=4;
  END IF;
END;

$$
DELIMITER $$

CREATE TRIGGER videometadata_update
BEFORE UPDATE ON videometadata
FOR EACH ROW BEGIN
  IF NEW.filename LIKE '%/<<FOLDER_NAME>>/%' THEN
    SET NEW.showlevel=4;
  END IF;
END;

$$