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

Drew Tomlinson drew at mykitchentable.net
Mon Feb 16 19:09:54 UTC 2009


Drew Tomlinson wrote:
> 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?
>   

<snip lots of helpful suggestions>

Thanks for all the ideas.  I'll begin investigating.

Cheers,

Drew

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

http://www.alchemistswarehouse.com



More information about the mythtv-users mailing list