[mythtv-users] Ways to Query Database From sh Script?

Drew Tomlinson drew at mykitchentable.net
Sun Feb 15 23:51:47 UTC 2009


I'm working on my first UserJob script.  In this script, I want to test
if a recording has a cutlist before processing.  I've Googled and the
way found to query the database from /bin/sh goes like this:

CUTLIST=`cat << EOF | mysql -u mythtv -pmythtv mythconverg
        SELECT
                cutlist
        FROM
                recorded
        WHERE
                basename = '$FILENAME';
EOF`

Using the above, $CUTLIST will be set to either "cutlist 1" or "cutlist
0" depending upon whether a cutlist exists. (I suppose piping to awk
would remove "cutlist").  Is this the only way to query from /bin/sh? 
Is there a more practical way?

I'm pretty new to this stuff so if the answer is obvious, nudges to the
relevant links would be appreciated.

Thanks,

Drew

-- 
Be a Great Magician!
Visit The Alchemist's Warehouse

http://www.alchemistswarehouse.com



More information about the mythtv-users mailing list