[mythtv] Mythcommflag -> Cutlist automatic script

Paul Greidanus paul at majestik.org
Mon Feb 21 00:15:11 UTC 2005


I was just playing with the new gencutlist feature to convert commflags 
to cutlists directly, which may or may not be perfect cuts.. but it's 
something, and I thought it would be nice to be able to convert ALL 
commflags to cutlists.

So, I played with the DB a little, and wrote up a little script.

It does make a few assumptions:
1) you have sudo setup for the user you're running it in
	- if you run it as root, just remove sudo from the top few lines
2) /etc/mythtv/mysql.txt has the DB config in it.
3) /usr/local/bin is where mythcommflag is located.
These work on my system, yours might not.. they're easy enough to change 
though

It might work, it might not.. you get to figure it out yourself.  It's 
mostly a proof of concept, and see if anyone likes it, maybe add it as a 
feature into mythcommflag propper if anyone likes it.
-------------- next part --------------
#!/bin/bash
USERNAME=`sudo cat /etc/mythtv/mysql.txt | grep ^DBUserName | awk -F\= '{print $2}'`
HOSTNAME=`sudo cat /etc/mythtv/mysql.txt | grep ^DBHostName | awk -F\= '{print $2}'`
PASSWORD=`sudo cat /etc/mythtv/mysql.txt | grep ^DBPassword | awk -F\= '{print $2}'`
DBNAME=`sudo cat /etc/mythtv/mysql.txt | grep ^DBName | awk -F\= '{print $2}'`
echo Automatically commflagging
echo "SELECT chanid, starttime  from recorded where commflagged = '1' and cutlist is null;" | mysql -u $USERNAME -p$PASSWORD -h $HOSTNAME $DBNAME | grep -v chanid | sed s/[-:]//g | awk '{printf "/usr/local/bin/mythcommflag --chanid "$1" --starttime "$2$3" --gencutlist\n"}' | bash
echo Commflagging done


More information about the mythtv-dev mailing list