[mythtv-users] Python Bindings - Snooping MythTV System Events

Raymond Wagner raymond at wagnerrp.com
Thu Sep 5 11:23:14 UTC 2013


On Sep 5, 2013, at 3:09, David Whyte <david.whyte at gmail.com> wrote:

> Hi All,
> 
> I have been looking at MythTV System Events ( http://www.mythtv.org/wiki/MythTV_System_Events ) since I would like to monitor what is happening and where in my mythtv environment (i.e., which FEs are playing what recordings, where do recordings get deleted, etc).
> 
> I realise I could configure each of the event handlers in mythTV backend to perform an action (i.e. log the event) but I was hoping I could just use the python bindings to write a script which snoops for such events and them performs an action (i.e. log the event).
> 
> The benefit here is that I leave the actual event handlers free to configure in the future should I need to use them locally for that FE.  Another benefit is that I can configure many actions to perform for specific events.  And I also get to play with the bindings. :)
> 
> I didn't get very far with the Python bindings though.  I could make it so I saw all internal system events which was way more than I needed.
> 
> Has anyone here tried to do anything similar?  Any pointers on what I should be looking at?  Is the dev list a better audience for this question?
> 
> I am currently running 0.26-fixes.

There is a BEEventMonitor class that does almost what you're looking for.

http://code.mythtv.org/cgit/mythtv/tree/mythtv/bindings/python/MythTV/methodheap.py#n386

You'll need to subclass it and have the _neweventconn method use a level of 3, which it is not currently set up to do.  Note that this is really only intended for debugging and developmental purposes.  I only wrote it in the first place so I could watch what events fired at different times to figure out how to use them.  Also note that System Events are unlike most other BACKEND_MESSAGES in that it only gets sent to one application per host.  If you already have another MythTV application listening from that host, you'll need to get your script to report a different profile name, by feeding it a different config.xml with a custom LocalHostName.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20130905/6abf3df2/attachment.html>


More information about the mythtv-users mailing list