[mythtv] Format of new post-0.25 config.xml

Michael T. Dean mtdean at thirdcontact.com
Sun Jun 3 11:25:57 UTC 2012


On 06/03/2012 02:13 AM, Jean-Yves Avenard wrote:
> On Sunday, 3 June 2012, Raymond Wagner wrote:
>> ------
>> #!/usr/bin/env python
>> import MythTV
>> import functools
>> import datetime
>>
>> @functools.total_ordering
>> class MySort( object ):
>>     def __lt__(self, other):
>>         if self.starttime == other.starttime:
>>             return self.title<  other.title
>>         return self.starttime<  other.starttime
>>     def __eq__(self, other):
>>         if (self.starttime == other.starttime) and \
>>                 (self.title == other.title):
>>             return True
>>         return False
>>
>> class MyGuide( MySort, MythTV.Guide ):
>>     def pprint(self):
>>         chan = MythTV.Channel(self.chanid)
>>         print "{0}/{1:<8} {2.title:<40} {2.subtitle:<30}
>> {2.starttime}".format("A" if chan.sourceid==1 else "D", chan.callsign, self)
>>
>> MythTV.MythDB.searchGuide.**handler = MyGuide
>>
>> now = datetime.datetime.now()
>> past = now - datetime.timedelta(days=60)
>>
>> db = MythTV.MythDB()
>> for prog in sorted(db.searchGuide(first=**True, startafter=now,
>> custom=(("programid LIKE ?","EP%0001"),("**originalairdate>?", past)))):
>>     prog.pprint()
>> ------
>>
> To be honest, this doesn't look any easier to me, and from a glance I can't
> tell what it is doing.

But we've since determined that's not doing what he wants (as neither 
Raymond nor I could tell what Brian's "one liner" was doing).  Instead, 
he wants something like Raymond's simplified version of the code (that 
you've trimmed) that Raymond provided as a "what you want, rather than 
what you're doing"--basically like the script in 
http://www.gossamer-threads.com/lists/mythtv/dev/519225#519225 .

> It also seems that you need need to have a fairly good knowledge on the
> internal MySQL structure in order to use the bindings or at least make
> sense of the database access. Which kind of defeat the purpose of having an
> abstraction layer IMHO.

Well, that's one purpose of an abstraction layer--and, yeah, none of the 
bindings provide that--but another is to provide a single code base that 
can be updated after changes to MythTV, rather than forcing every single 
script author to update every single script after changes to MythTV.  
This will become a much more visible benefit, before long, when I 
completely change the schema on everyone.  :)

Mike


More information about the mythtv-dev mailing list