update scrollbar in timerlist when a entry is removed
[enigma2.git] / lib / python / Components / Converter / MovieInfo.py
1 from Components.Converter.Converter import Converter
2 from Components.Element import cached
3 from enigma import iServiceInformation
4 from ServiceReference import ServiceReference
5
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
10
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
18                 else:
19                         raise str("'%s' is not <ShortDescription|MetaDescription|RecordServiceName> for MovieInfo converter" % type)
20                 Converter.__init__(self, type)
21
22         @cached
23         def getText(self):
24                 service = self.source.service
25                 info = self.source.info
26                 if info and service:
27                         if self.type == self.MOVIE_SHORT_DESCRIPTION:
28                                 event = self.source.event
29                                 if event:
30                                         descr = info.getInfoString(service, iServiceInformation.sDescription)
31                                         if descr == "":
32                                                 return event.getShortDescription()
33                                         else:
34                                                 return descr
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()
40                 return ""
41
42         text = property(getText)