[mythtvnz] Finding a gap in the MythTV Scheduler

Steven Ellis mythtvnz@lists.linuxnut.co.nz
Sat, 19 May 2007 12:09:57 +1200


Hadley Rich wrote:
> On Sat, 19 May 2007 10:51:09 Steven Ellis wrote:
>   
>> Finally have a chance to try your code out, and sadly we base our build
>> of 0.20-fixes. Any tips on getting it running?
>>
>> I created a file test.py as follows
>>
>> #!/usr/bin/python
>> import MythTV
>> m = MythTV.MythTV()
>>
>> upcoming = m.getUpcomingRecordings()
>>
>> print upcoming[0].title, upcoming[0].recstartts
>>
>>
>> Then running it produces
>>
>> mythtv@mythtv:~$ ./test.py
>> Traceback (most recent call last):
>>   File "./test.py", line 3, in ?
>>     m = MythTV.MythTV()
>>   File "/home/mythtv/MythTV.py", line 135, in __init__
>>     self.db = get_database_connection()
>> NameError: global name 'get_database_connection' is not defined
>>
>>
>> Got any pointers?
>>
>> Steve
>>     
>
> Hmm, the guy that created find_meta.py adjusted it just the other day and 
> unfortunately it looks like it broke the MythTV class. I'll get it fixed in 
> SVN shortly. In the mean time I've attached a fixed version to this mail (I 
> hope a text attachment is OK). Ironically the adjustment that he made was to 
> make it work with .20-fixes :)
>
> hads
>
>   
Ok still going to borrow your brains if I may :)

Not coded python before and wondered if there is an easy way to do
something like

if ( upcoming[0].recstartts > NOW + 30mins )
  print "TRUE";
else
  print "FALSE";
fi

IE I only want to run epgsnoop if there is a window of 30 mins between now and the next scheduled recording.

The whole idea is to run epgsnoop for Sky + analogue channels in the middle of the night without locking the DVB tuner and causing backend issues.

Steve




-- 
Steven Ellis - Technical Director
OpenMedia Limited
email   - steven@openmedia.co.nz
sales   - sales@openmedia.co.nz
support - support@openmedia.co.nz
website - http://www.openmedia.co.nz