[mythtv] [PATCH] Mythtv: Create XML menus dynamically

joel at tamkin.net joel at tamkin.net
Sat Jul 10 14:50:24 EDT 2004


I think including script-ability of any kind is a step in the right
direction.  My motivation for this change is that ANY language
(perl/python/sh/C++/wget-from-a-remote-server-cgi) can be used to
generate the menus.

I assume that QSA is QT script for applications - In that case, one
essentially has to build a C++/QT app anyway (from what I've seen of the
examples on the QT website).  It does look powerful, and by all means,
go for it ;)  At some point, I'll learn the QT and mythtv plugin API,
and I'll do what I want with that (how about a tutorial on creating your
own mythtv plugin?).  At any rate, let me give you a usage example which
is enabled by the change I made:

The Asterisk PBX stores voicemails as files of the format
.../vm/mailbox/INBOX/msgXXXX.txt (and msgXXXX.wav). These represent the
plain text description of the phone call (callerid, incoming line, etc),
and the audio data.  I manually added a "voicemail" button to
mainmenu.xml:
   
<button>
	<type>Voicemail</type>
	<action>EXEC /home/mythtv/mythastvm/gen_review.py</action>
	<action>MENU VMreview.xml</action>
</button>

The gen_review.py python script builds VMreview.xml.  VMreview.xml is a
menu of all the vm/mailbox's on the server, with buttons such as:

<button>
	<type>VMBOX</type>
	<text>1234</text>
	<action>EXEC /home/mythtv/mythastvm/gen_MB.py 1234</action>
	<action>MENU VMmb1234.xml</action>
</button>

Note that I want to do this dynamically, because the mailboxes
configured on the system could change...it becomes even more obvious as
we go deeper.  gen_MB generates a list of the messages in the 1234
mailbox and outputs them as VMmb1234.xml, with entries like (replace
path/to...):

<button>
	<type>VMMESSAGE</type>
	<text>MSG 0000</text>
	<action>EXEC mplayer path/to/vm/1234/INBOX/msg0000.wav</action>
	<action>EXEC gen_VMmessage.py 1234 0000</action>
	<action>MENU VMmessage1234_0000.xml</action>
</button>

Obviously, without dynamically checking INBOX and building these
buttons, I never could have created this menu.

Finally, gen_VMmessage1234_0000.xml (thanks to gen_VMmessage.py) is
simply a menu with two entries:

<button>
	<type>VMMSGDELETE</type>
	<text>Delete</text>
	<action>EXEC deleteVM.py 1234 0000</action>
</button>

<button>
	<type>VMMSGREPLAY</type>
	<text>Replay</text>
	<action>EXEC mplayer path/to/vm/1234/INBOX/msg0000.wav</action>
</button>

Does that make sense?  Of course, displaying things like callerID and
message length info would be nice - I can accept that a full-fledged
mythtv plugin could be developed for this purpose....of course, if the
xml menu structure could be modified to accommodate text fields, along
with buttons, it would be very simple using this method ;)

Make sense?

Another cool trick using multiple <action>s in menu files:  play a sound
before navigating to the next menu - instant bells & whistles!

Joel

-----Original Message-----
From: Kenneth Aafl°y [mailto:lists at kenneth.aafloy.net] 
Sent: Friday, July 09, 2004 3:32 PM
To: joel at tamkin.net
Cc: Development of mythtv
Subject: Re: [mythtv] [PATCH] Mythtv: Create XML menus dynamically

On Thursday 08 July 2004 21:26, joel at tamkin.net wrote:
> Attached is a patch (works against both the 4/04 and latest CVS
version
> of the file).  It allows for multiple <action> definitions in xml menu
> files.  Please consider for introduction into CVS.

Would it be a possibility to use QSA for this? It might give more
options to 
play with..

Kenneth



More information about the mythtv-dev mailing list