X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/6c2d3fc303542b7f77f4350974acf781a1b91c30..8b8c11e65013f13d8178c20a7eb301bf179306c8:/lib/python/Screens/EventView.py?ds=inline diff --git a/lib/python/Screens/EventView.py b/lib/python/Screens/EventView.py index ef3786c5..86947461 100644 --- a/lib/python/Screens/EventView.py +++ b/lib/python/Screens/EventView.py @@ -3,10 +3,11 @@ from Components.ActionMap import ActionMap from Components.Button import Button from Components.Label import Label from Components.ScrollLabel import ScrollLabel -from enigma import eServiceEventPtr +from enigma import eServiceEventPtr, eEPGCachePtr, eEPGCache from ServiceReference import ServiceReference from RecordTimer import RecordTimerEntry, parseEvent from TimerEntry import TimerEntry +from time import localtime, asctime class EventViewBase: def __init__(self, Event, Ref, callback=None): @@ -38,8 +39,8 @@ class EventViewBase: self.onShown.append(self.onCreate) def onCreate(self): - self.setEvent(self.event) self.setService(self.currentService) + self.setEvent(self.event) def prevEvent(self): if self.cbFunc is not None: @@ -61,6 +62,7 @@ class EventViewBase: print "Timeredit aborted" def setService(self, service): + self.currentService=service if self.isRecording: self["channel"].setText(_("Recording")) @@ -71,8 +73,20 @@ class EventViewBase: else: self["channel"].setText(_("unknown service")) + def sort_func(self,x,y): + if x[1] < y[1]: + return -1 + elif x[1] == y[1]: + return 0 + else: + return 1 + def setEvent(self, event): self.event = event + id = event.getEventId() + + refstr = str(self.currentService) + epgcache = eEPGCache.getInstance() text = event.getEventName() short = event.getShortDescription() ext = event.getExtendedDescription() @@ -82,6 +96,16 @@ class EventViewBase: if len(text) > 0: text = text + '\n\n' text = text + ext + + # search similar broadcastings + ret = epgcache.search(('NB', 100, eEPGCache.SIMILAR_BROADCASTINGS_SEARCH, refstr, id)) + if ret is not None: + text += '\n\n' + _('Similar broadcasts:') + ret.sort(self.sort_func) + for x in ret: + t = localtime(x[1]) + text += '\n%d.%d.%d, %02d:%02d - %s'%(t[2], t[1], t[0], t[3], t[4], x[0]) + self.setTitle(event.getEventName()) self["epg_description"].setText(text) self["datetime"].setText(event.getBeginTimeString())