Skip to content

Commit 3af3710

Browse files
committed
[MovieInfo]
* add FullDescription
1 parent d6179ae commit 3af3710

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lib/python/Components/Converter/MovieInfo.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ class MovieInfo(Converter):
1313
MOVIE_REC_SERVICE_REF = 3 # referance of recording service
1414
MOVIE_REC_FILESIZE = 4 # filesize of recording
1515
MOVIE_NAME = 5 # recording name or directory name
16+
MOVIE_FULL_DESCRIPTION = 6 # full description of the movie
1617

1718
def __init__(self, type):
1819
if type == "ShortDescription":
1920
self.type = self.MOVIE_SHORT_DESCRIPTION
2021
elif type == "MetaDescription":
2122
self.type = self.MOVIE_META_DESCRIPTION
23+
elif type == "FullDescription":
24+
self.type = self.MOVIE_FULL_DESCRIPTION
2225
elif type == "RecordServiceName":
2326
self.type = self.MOVIE_REC_SERVICE_NAME
2427
elif type == "FileSize":
@@ -28,11 +31,19 @@ def __init__(self, type):
2831
elif type == "Name":
2932
self.type = self.MOVIE_NAME
3033
else:
31-
raise ElementError("'%s' is not <ShortDescription|MetaDescription|RecordServiceName|FileSize> for MovieInfo converter" % type)
34+
raise ElementError("'%s' is not <ShortDescription|MetaDescription|FullDescription|RecordServiceName|FileSize> for MovieInfo converter" % type)
3235
Converter.__init__(self, type)
3336

3437
@cached
3538
def getText(self):
39+
40+
def formatDescription(description, extended):
41+
if description[:20] == extended[:20]:
42+
return extended
43+
if description and extended:
44+
description = f"{description}\n"
45+
return f"{description}{extended}"
46+
3647
service = self.source.service
3748
info = self.source.info
3849
event = self.source.event
@@ -49,6 +60,13 @@ def getText(self):
4960
return ((event and (event.getExtendedDescription() or event.getShortDescription()))
5061
or info.getInfoString(service, iServiceInformation.sDescription)
5162
or service.getPath())
63+
elif self.type == self.MOVIE_FULL_DESCRIPTION:
64+
shortDesc = ""
65+
if event:
66+
shortDesc = formatDescription(event.getShortDescription(), event.getExtendedDescription())
67+
if not shortDesc:
68+
shortDesc = info.getInfoString(service, iServiceInformation.sDescription) or service.getPath()
69+
return shortDesc
5270
elif self.type == self.MOVIE_REC_SERVICE_NAME:
5371
rec_ref_str = info.getInfoString(service, iServiceInformation.sServiceref)
5472
return ServiceReference(rec_ref_str).getServiceName()

0 commit comments

Comments
 (0)