From LedHed's Wiki
Jump to: navigation, search
(Created page with "== Overview == MythTV supports Parental Controls (Levels 1-4). <br> MythTV only supports Parental Controls at the file level. <br> After some googling I found this thread: ht...")
 
Line 13: Line 13:
 
Run the following commands within MySQL
 
Run the following commands within MySQL
 
  USE mythconverg;
 
  USE mythconverg;
 
+
 
  DELIMITER $$
 
  DELIMITER $$
 
+
 
  CREATE TRIGGER videometadata_insert
 
  CREATE TRIGGER videometadata_insert
 
  BEFORE INSERT ON videometadata
 
  BEFORE INSERT ON videometadata
Line 25: Line 25:
  
 
  $$
 
  $$
 
+
 
  DELIMITER $$
 
  DELIMITER $$
 
+
 
  CREATE TRIGGER videometadata_update
 
  CREATE TRIGGER videometadata_update
 
  BEFORE UPDATE ON videometadata
 
  BEFORE UPDATE ON videometadata
Line 35: Line 35:
 
   END IF;
 
   END IF;
 
  END;
 
  END;
 
+
 
  $$
 
  $$
  

Revision as of 23:54, 19 July 2014

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;

$$