[mythtv] Myth Protocol Command to List Programs
Michael T. Dean
mtdean at thirdcontact.com
Fri Mar 14 21:45:06 UTC 2008
On 03/14/2008 11:34 AM, Roger Heflin wrote:
> Michael T. Dean wrote:
>
>> On 03/14/2008 05:50 AM, Ian Barton wrote:
>>
>>> I want to be able to get a list of programs from the database for a
>>> particular channel. Rather than query the database directly, I was
>>> hoping that there was a Myth Protocol command do it. However, I can't
>>> seem to find one. Does one exist?
>>>
>> I was actually just discussing this on IRC with Chris Petersen
>> (MythWeb/Perl bindings guy) who wanted the same. I was planning to make
>> a couple of changes to allow testing whether this would actually work
>> and scale. Once I get the modifications done, I'll post the patch so
>> you can test it, too.
After getting a good start on the patch today, I'm putting this on hold
for now. When discussing the patch on IRC, we've begun to consider
making this information available only through the XML server or through
the Myth protocol, but not both (though no decisions have been made,
yet--or, at least, I haven't been informed if they have :).
Since the code to make the information available through XML is already
available, it's quite likely to "win" if the devs decide to go with a
single interface.
You can play with the XML stuff using:
wget
'http://localhost:6544/Myth/GetProgramGuide?StartTime=2008-03-15T12:00:00&EndTime=2008-03-15T14:00:00&NumOfChannels=1&StartChanId=1021&Details=0'
-O listings.xml
to get a "summary" version or
wget
'http://localhost:6544/Myth/GetProgramGuide?StartTime=2008-03-15T20:00:00&EndTime=2008-03-15T23:00:00&NumOfChannels=1&StartChanId=1021&Details=1'
-O listings-detail.xml
to get all program details.
Ian, if you're hoping to get it through the Python bindings, you may
need to add bindings support for querying/parsing the XML data.
See also contrib/development/MythXMLTest/ (I'm pretty sure in
0.21-fixes, it's just under the contrib directory) for more details on
the XML interface. David Blain (and a few others) has put a /lot/ of
good stuff in there that's not really being used, yet, though doing so
would be a /very/ good thing. Much better than direct DB queries, at
least. :)
> Would this interface allow getting details for a single program that you already
> had some limited amount of information on (say title and subtitle)?
>
Looks like you can with the XML interface.
> The mvpmc device has limited ram, and has memory issues when attempting to cache
> all of the details for 500+ recorded programs, so if we could just keep a much
> smaller amount of details for all of the 500 and then query to fill in the other
> information as needed for a single program that would solve the memory issue and
> allow it to deal with large numbers of programs.
>
> We cannot really query all and just take the one we need because the query all
> really takes too long when you have a large number of programs.
>
Using GetProgramGuide and specifying a single channel ID and appropriate
start/end time*** you can limit the info you're dealing with. And, with
the "summary" info, you can really cut back on memory usage. There's also:
wget
'http://localhost:6544/Myth/GetProgramDetails?StartTime=2008-03-15T20:00:00&ChanId=1021'
-O program_details.xml
if you want to start with the summary and then fill in details on an
as-needed basis.
Now, whether XML parsing will work sufficiently fast for the mvpmc is a
whole different question. I'll leave it to you to figure that one out.
Mike
***I just posted a ticket (#4956 -
http://svn.mythtv.org/trac/ticket/4956 ) with a patch that modifies
GetProgramGuide to return any show that overlaps the StartTime and
EndTime. For example, Lost was on from 21:00 to 22:02. Before the
patch, a query for ProgramGuide with between 21:00 and 22:00 would not
return info for Lost. With the patch, the info would be returned. And,
before the patch, a query with StartTime = EndTime would return
nothing. After the patch, a query with StartTime = EndTime =
2008-03-13T21:00:00 would give 2 episodes of Lost--the previous week's
episode that ended at 21:00 and the current week's episode that starts
at 21:00. Therefore, the patch gives all the info you might need and
allows you to trim, rather than giving most of the information and
making you continue querying to get the rest.
More information about the mythtv-dev
mailing list