[mythtvnz] Finding a gap in the MythTV Scheduler
Hadley Rich
mythtvnz@lists.linuxnut.co.nz
Sat, 19 May 2007 12:40:25 +1200
On Sat, 19 May 2007 12:09:57 Steven Ellis wrote:
> Ok still going to borrow your brains if I may :)
You may borrow the 30% of it that's working this morning.
> Not coded python before and wondered if there is an easy way to do
> something like
Python is lurverly :)
> 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.
I think this should do what you want;
#!/usr/bin/python
from datetime import datetime, timedelta
from MythTV import MythTV
m = MythTV()
upcoming = m.getUpcomingRecordings()
print upcoming[0].title, upcoming[0].recstartts
if upcoming[0].recstartts > (datetime.now() + timedelta(minutes=30)):
print True
else:
print False
> 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
hads
--
http://nicegear.co.nz
New Zealand's VoIP Supplier