diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-02-13 17:03:18 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-02-13 17:03:18 +0000 |
| commit | 24dab815808d6be2758f3e63f93b7c171190059e (patch) | |
| tree | b12cb49c163b7cce59accf6e5c4ec8cdfa9f7c7d /lib/python/Components/EventInfo.py | |
| parent | 05626c8692bb0775f993ee23494926b21c266eac (diff) | |
| download | enigma2-24dab815808d6be2758f3e63f93b7c171190059e.tar.gz enigma2-24dab815808d6be2758f3e63f93b7c171190059e.zip | |
display remaining time for next event
Diffstat (limited to 'lib/python/Components/EventInfo.py')
| -rw-r--r-- | lib/python/Components/EventInfo.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/python/Components/EventInfo.py b/lib/python/Components/EventInfo.py index de16a173..69487b5f 100644 --- a/lib/python/Components/EventInfo.py +++ b/lib/python/Components/EventInfo.py @@ -11,6 +11,7 @@ class EventInfo(PerServiceDisplay): Next_Duration = 3 Now_StartTime = 4 Next_StartTime = 5 + Now_Remaining = 6 def __init__(self, navcore, now_or_next): # listen to evUpdatedEventInfo and evEnd @@ -21,6 +22,9 @@ class EventInfo(PerServiceDisplay): iPlayableService.evUpdatedEventInfo: self.ourEvent, iPlayableService.evEnd: self.stopEvent }) + + if now_or_next in [self.Now_Remaining]: + self.enablePolling() def ourEvent(self): info = iServiceInformationPtr() @@ -33,20 +37,22 @@ class EventInfo(PerServiceDisplay): if ev is not None: self.update(ev) - def update(self, ev): - if (self.Now_Duration <= self.now_or_next <= self.Next_Duration): + if self.now_or_next == self.Now_Remaining and ev.getBeginTime() <= time() <= (ev.getBeginTime() + ev.getDuration()): + self.setText("+%d min" % ((ev.getBeginTime() + ev.getDuration() - time()) / 60)) + elif self.now_or_next in [self.Now_Duration, self.Next_Duration, self.Now_Remaining]: self.setText("%d min" % (ev.getDuration() / 60)) - if (self.Now_StartTime <= self.now_or_next <= self.Next_StartTime): + elif self.now_or_next in [self.Now_StartTime, self.Next_StartTime]: self.setText(strftime("%H:%M", localtime(ev.getBeginTime()))) - if (self.Now <= self.now_or_next <= self.Next): + elif self.now_or_next in [self.Now, self.Next]: self.setText(ev.getEventName()) def stopEvent(self): self.setText( - #(_("waiting for event data..."), "", "--:--", "--:--", "--:--", "--:--")[self.now_or_next]); - ("", "", "--:--", "--:--", "--:--", "--:--")[self.now_or_next]); + ("", "", "", "", "--:--", "--:--", "")[self.now_or_next]); + def poll(self): + self.ourEvent() class EventInfoProgress(PerServiceDisplayProgress, EventInfo): def __init__(self, navcore, now_or_next): |
