1 from Components.Converter.Converter import Converter
2 from Components.Element import cached
3 from enigma import iServiceInformation
4 from ServiceReference import ServiceReference
6 class MovieInfo(Converter, object):
7 MOVIE_SHORT_DESCRIPTION = 0 # meta description when available.. when not .eit short description
8 MOVIE_META_DESCRIPTION = 1 # just meta description when available
9 MOVIE_REC_SERVICE_NAME = 2 # name of recording service
11 def __init__(self, type):
12 if type == "ShortDescription":
13 self.type = self.MOVIE_SHORT_DESCRIPTION
14 elif type == "MetaDescription":
15 self.type = self.MOVIE_META_DESCRIPTION
16 elif type == "RecordServiceName":
17 self.type = self.MOVIE_REC_SERVICE_NAME
19 raise str("'%s' is not <ShortDescription|MetaDescription|RecordServiceName> for MovieInfo converter" % type)
20 Converter.__init__(self, type)
24 service = self.source.service
25 info = self.source.info
27 if self.type == self.MOVIE_SHORT_DESCRIPTION:
28 event = self.source.event
30 descr = info.getInfoString(service, iServiceInformation.sDescription)
32 return event.getShortDescription()
35 elif self.type == self.MOVIE_META_DESCRIPTION:
36 return info.getInfoString(service, iServiceInformation.sDescription)
37 elif self.type == self.MOVIE_REC_SERVICE_NAME:
38 rec_ref_str = info.getInfoString(service, iServiceInformation.sServiceref)
39 return ServiceReference(rec_ref_str).getServiceName()
42 text = property(getText)