[mythtv-users] Simple perl/python script to query recorder status via services API

Jack Perveiler perveilerj at gmail.com
Sun Aug 10 17:28:23 UTC 2014


I'd like to write a python or perl script that uses the services api to see
if my HDPVR is idle.  I've looked at the services API documentation on the
wiki and have a few questions:

1) Did someone write this script already? :)
2) I see that the GetEncoderList call returns XML with a per-encoder
"State." I looked quickly through the source and I think this is the enum
associated with that value:

typedef enum
 55 {
 58
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a55220ace48e9150e838809d9bc3d5265>
kState_Error
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a55220ace48e9150e838809d9bc3d5265>
= -1,
 62
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a25c190b370284234d46230a6162aa90b>
kState_None
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a25c190b370284234d46230a6162aa90b>
= 0,
 67
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a434dcbff97e6374afe6b17173af6e68a>
kState_WatchingLiveTV
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a434dcbff97e6374afe6b17173af6e68a>
,
 71
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a5ad7a748c63e26a796818ecfa96d35cb>
kState_WatchingPreRecorded
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a5ad7a748c63e26a796818ecfa96d35cb>
,
 75
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4ad59fe6e9423e9e3ff962bea2af69616f>
kState_WatchingVideo
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4ad59fe6e9423e9e3ff962bea2af69616f>
,
 77
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a07a8afa693960d9ec1b5256f8c4d4222>
kState_WatchingDVD
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a07a8afa693960d9ec1b5256f8c4d4222>
,
 79
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a93a0e764d01b10ff45fa6ae706e249a9>
kState_WatchingBD
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a93a0e764d01b10ff45fa6ae706e249a9>
,
 84
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a72f99e92cc5a586a94b71b37763b8b67>
kState_WatchingRecording
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a72f99e92cc5a586a94b71b37763b8b67>
,
 88
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a2da766bc9a0d7765e1b6d17229a4fef5>
kState_RecordingOnly
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a2da766bc9a0d7765e1b6d17229a4fef5>
,
 93
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a93beb97f6b058bb35db96e160826f4a7>
kState_ChangingState
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4a93beb97f6b058bb35db96e160826f4a7>
,
 94 } TVState
<https://code.mythtv.org/doxygen/tv_8h.html#ac907a21c7c6ff3247119ce16d34fd1e4>
;

Many of those enumerations don't seem to have anything to do with an
encoder though (kState_WatchingDVD for example) so it's possible I'm
looking at the wrong thing.  If not, it looks like getEncoderList returning
State == 0 is what I want.  Do I have that right?  Is there a perl/python
package with those enumerations so I can insulate myself against future
changes to the enum encodings?


Thanks,

--Jack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20140810/914e69b0/attachment.html>


More information about the mythtv-users mailing list