[mythtv-users] Easier way to reset live tv start channel?

Alan Young ayoung at teleport.com
Tue Jan 3 17:01:51 UTC 2012


On 01/02/2012 07:02 PM, R. G. Newbury wrote:
> On 01/02/2012 03:45 PM, Nick Rout wrote:
>
>>> Does anyone have a better way to deal with this problem (and no,
>>> avoiding live tv isn't a valid answer)? About the only thing I can
>>> think of is to create a new menu entry in my menu theme (I use a
>>> custom menu theme, so that's not an issue) which executes an external
>>> script that modifies the database settings table directly and then
>>> restarts the frontend. Not very elegant, but is there another option?
>>>
>> How about putting the SQL to do this in a script and tie the script to
>> a menu item.
>> _______________________________________________
> This script works for me:
> ***********************************
> #!/bin/bash
> #reset-channel: to poke a good value into startchan
> #Two inputs: tuner to be re-set and channel to set to, defaults are allowed
> if [ $1 = '' ];
> then
>     Tuner='5'
>     Channel='43.1';
> fi
>
> if [ $1 = "-h" ];
> then
>     echo "With no command line arguments, will poke the mythconverg"
>     echo "database to set digital tuner 5 to channel 43.1."
>     echo "Or use two arguments<tuner>  <channel>"
> elif [ $1 != '' ];
> then
>     Tuner=$1;
> fi
>
> if [ $2 = '' ];
> then
>     Channel='43.1';
> elif [ $2 != '' ];
> then
>     Channel=$2;
> fi
>
> #echo "     Tuner is set to Number "$Tuner
> #echo "     Channel is set to "$Channel
> echo "update cardinput set startchan = $Channel where cardid = $Tuner;"
>   >  tempfile
> echo "exit">>  tempfile
> mysql -u mythtv -pmythtv mythconverg<  tempfile
>
> rm -f tempfile
>
> **********************************
>
> I use the following stanza in my lircrc to stop/start mythfrontend if it
> locks up. Call the above script something and amend the stanza.
>
> Note that you will need to start irexec.
> I use "/usr/bin/irexec -d /etc/lirc/lircrc" in /etc/rc.d/rc.local, which
> is run (still) by systemd on startup.
>
> Lircrc stanza:
>
> begin
>       prog = irexec
>       button = KEY_EXIT
>       repeat = 5
>       config = /usr/local/sbin/startfrontend.sh
> end
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://www.mythtv.org/mailman/listinfo/mythtv-users
>

You can avoid the use of a tempfile and code the SQL statement as part of the 
mysql command.  I use line like this in my channel change script to make my 
start channel the same as the last channel on a HDPVR.

mysql mythconverg -u mythtv -pmythtv -e 'update cardinput set startchan='$*' 
where inputname="Component";'

Alan


More information about the mythtv-users mailing list