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

Michael T. Dean mtdean at thirdcontact.com
Sat Jun 2 21:05:28 UTC 2012


On 06/02/2012 04:33 PM, Michael T. Dean wrote:
> On 06/02/2012 04:07 PM, Brian J. Murrell wrote:
>> In any case, the whole thing is supposed to find "pilots and premieres"
>> but only those that are not already scheduled to be recorded.
>>
>>> ------
>>> #!/usr/bin/env python
>>> import MythTV
>>> rules = [r.recordid for r in MythTV.Record.getAllEntries() if 
>>> r.title is
>>> None]
>>> for prog in MythTV.MythBE().getUpcomingRecordings():
>>>      if prog.recordid not in rules:
>>>          continue
>>>      chan = MythTV.Channel(prog.chanid)
>>>      print "{0}/{1.callsign:<8} {1.title:<40} {1.subtitle:<30}
>>> {1.starttime}".format("A" if chan.sourceid==1 else "D", prog)
>>> ------
>> This returns nothing.  Probably because of the requirement of r.title
>> being None.  But when I remove that, I'm not getting the results I am
>> looking for which is "pilots and premieres" not already scheduled for
>> recording.
>>
>> Cheers, and thanks much!
>
> If you set up an inactive recording rule to catch "first episodes" 
> and/or pilots and/or premieres, then MythTV.Record.getAllEntries()

er, I meant MythTV.MythBE().getUpcomingRecordings() (but it turns out 
that's wrong, too--based on what I've since learned at 
http://www.mythtv.org/wiki/0.25_Python_Bindings/Connection_Handlers#MythBE )

> would actually return entries for them, then you just filter for the 
> appropriate ones/filter out the rest.
>
> The other benefit of this approach is that you could also see the 
> output in, for example, the MythWeb or mythfrontend Upcoming 
> Recordings sections or the EPG--MythTV would actually mark shows 
> everywhere so you could see them and choose whether to record them or 
> not.  Because an inactive rule always has lower priority than an 
> active rule, you wouldn't even have to worry about the "if it's not 
> already scheduled to record" part--that would be handled automatically.
>
> Similar to:  
> http://www.gossamer-threads.com/lists/mythtv/users/188789#188789 .  
> Note, however, that due to the fact that some networks (yes, I'm 
> looking at you, Fox), love to air episodes of a series out of order, 
> the example rule may not work "out of the box".  Because of that, I've 
> set up my inactive First Episodes rule to include any program with the 
> subtitle "Pilot" (though you could easily look for the word pilot in 
> the subtitle or description with an appropriate LIKE clause).  I use:
>
> program.previouslyshown = 0
> AND program.first > 0
> AND (program.programid LIKE 'EP%0001' OR program.subtitle = 'Pilot')
> AND DAYOFYEAR(program.originalairdate) =
>     DAYOFYEAR(program.starttime)

Just to prove to myself that a non-Python-enabled person could write 
such a script using the fragment Raymond posted as a started, I went to 
http://www.mythtv.org/wiki/0.25_Python_Bindings and used some of the 
scripts at http://www.mythtv.org/wiki/Category:Python_Scripts as 
examples and came up with:

#!/usr/bin/env python
import MythTV
for prog in MythTV.MythBE().getPendingRecordings():
      if prog.recstatus != MythTV.Program.rsInactive:
          continue
      print "{0.callsign:<8} {0.title:<40} {0.subtitle:<30} 
{0.starttime}".format(prog)

(Note that I took out the channel/chanid stuff since I wasn't sure what 
you were doing with that.)

Mike


More information about the mythtv-dev mailing list