[mythtv-users] parental controls based on video folder

Michael mythtv at blandford.net
Tue Dec 18 22:46:10 UTC 2012


On 12/16/2012 06:29 PM, Zach C wrote:
> Is it possible to set parental controls based on the folder a given video is in?
>
> For example i'd like to have one access level for
> /path/to/videos/family and another one for /path/to/videos/grown-ups.
>
> Thanks.
>
> Zach
>

Here is the script I use to set the access levels.

it isn't automatic but I run it out of cron nightly.  Obviously, you can 
run it by hand if you need to sooner :)

I am sure this isn't the new fancy way of interacting with the DB and 
could potentially break things in the future.  If someone wants to show 
me the right way of updating this script using the various bindings I 
would give it a stab.

# Source mysql.txt to find out db information
if [ -f $HOME/.mythtv/mysql.txt ]; then
         . $HOME/.mythtv/mysql.txt
elif [ -f /etc/mythtv/mysql.txt ]; then
         . /etc/mythtv/mysql.txt
else
         echo "Couldn't locate mysql.txt"
         exit 1
fi

function update_dir {
         RATED_DIR="$1"
         SHOWLEVEL="$2"
         if [ ! -d "/mythtv/video/$RATED_DIR" ]; then
                 echo "No such directory: $RATED_DIR"
                 exit 1
         fi
         echo "UPDATE  videometadata SET showlevel=$SHOWLEVEL  WHERE 
filename LIK
E '$RATED_DIR/%' ;" | mysql -u $DBUserName --password=$DBPassword -D 
$DBName -h
$DBHostName
}
update_dir "Brand New" 1
update_dir family 1
update_dir grown-ups 4
update_dir Movies 1


Then just add the update_dir calls at the bottom as necessary. Also, 
update the path referenced in front of RATED_DIR.

Michael






More information about the mythtv-users mailing list