[mythtv-users] User-definable Menu Option?

R. G. Newbury newbury at mandamus.org
Fri Aug 12 19:42:08 UTC 2011

On 08/12/2011 01:56 PM, Raymond Wagner wrote:
> On 8/12/2011 13:43, James MacKenzie wrote:
>> Is there any way that a user-definable menu option could be added to MythTV?
> If you're talking about the main menu, yes.  The first two levels of
> menu are defined in XML.  There are a couple packaged "menu themes" to
> choose from, or you can write your own with an EXEC option that calls an
> external command.
>> Reason:  I'm using wireless networking, and with the location of things, every
>> once in a while I lose connectivity.

The menu files are in 
/usr/|local/|share/mythtv/themes/classic/tvmenu.xml  or /default/tvmenu.xml

But these just describe the layout of items, and do not control their 
functionality. You would have to delve into the code to add the button 

A far easier method requires only a free button on your remotea and a 
script tied to the button. Lirc and your lircrc file make that 
button/script combo available through lirc and irexec.

Since you can ssh into the box, the box is not locking up, so lirc is 
available and so would irexec if it was running. I use a button on my 
remote, to restart mythfrontend when it freezes.

(Gee life was soooo hard when we had to get up and actually walk across 
the room to change channels! </sarc>

Here is the stanza for your lircrc file:

# -------------- Begin section for irexec ------------------
# Red button, starts mythfrontend
     prog = irexec
     button = KEY_POWER
     repeat = 5
     config = /usr/local/sbin/mythpowerbutton.sh
# -------------- End section for irexec --------------------

My imon remote uses the devinput conf. You will have to figure out what 
your chosen button maps to in your configuration.

This is the mythpowerbutton script:


# check for running mythfrontend
STATUS=`ps -ae | grep mythfrontend | grep -v grep | wc -l | awk '{print 
#echo "Running status = " $STATUS

# check for proper Display
count=`echo $DISPLAY | grep ":0" | wc -l `

if [ $count -ge 1 ] ; then
        # echo "Starting Mythfrontend"
        # if no mythfrontend, then start one
     if [ $STATUS -eq 0 ] ; then
         echo "Starting Mythfrontend"
         /usr/local/bin/mythfrontend -v playback,extra -l 
/var/log/mythfrontend.log &
         # kill all running mythfrontends
         # echo "Killing Mythfrontend"
         pid=`ps -ae | grep mythfrontend | awk '{print $1}'`
         #echo "Running process is   "$pid
         kill -9 $pid;

And you need to run 'irexec --daemon' on each boot (etc/rc.d/rc.local is 
a good spot). irexec reads ~/.lircrc and reacts only to its own entries.

Just looking at the mythpowerbutton.sh script above, I realize that the 
version which is on the mythbox has a couple of sound effects lines for 
feedback at the end of each branch of the if-else-fi.

IIRC I used 'mplayer /usr/share/sounds/KDE-Sys-App-Positive.ogg'   and 
although .../sounds/kapman/levelup.ogg could work for both.


              R. Geoffrey Newbury			

More information about the mythtv-users mailing list