Skip to content

Commit

Permalink
Optimization in converter SG_ServiceInfo
Browse files Browse the repository at this point in the history
Move static method add_str in insatnce method.
  • Loading branch information
Taapat committed Nov 21, 2023
1 parent 533e369 commit da580e1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions usr/lib/enigma2/python/Components/Converter/SG_ServiceInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ class SG_ServiceInfo(Converter):
def __init__(self, type):
Converter.__init__(self, type)

@staticmethod
def add_str(ret, text):
return "%s %s" % (ret, text) if ret else text

@cached
def get_text(self):

def add_str(ret, text):
return "%s %s" % (ret, text) if ret else text

service = self.source.service
info = service and service.info()
if not info:
Expand All @@ -27,18 +27,18 @@ def get_text(self):
ret = "DOLBY"
break
if info.getInfo(iServiceInformation.sTXTPID) != -1:
ret = self.add_str(ret, _("TEXT"))
ret = add_str(ret, _("TEXT"))
if service.subtitle().getSubtitleList():
ret = self.add_str(ret, "SUB")
ret = add_str(ret, "SUB")
video_height = info.getInfo(iServiceInformation.sVideoHeight)
if video_height > 0:
if video_height < 720:
ret = self.add_str(ret, "SD")
ret = add_str(ret, "SD")
elif video_height >= 1500:
ret = self.add_str(ret, "4K")
ret = add_str(ret, "4K")
else:
ret = self.add_str(ret, "HD")
ret = self.add_str(ret, "%sx%s" % (str(info.getInfo(iServiceInformation.sVideoWidth)), str(video_height)))
ret = add_str(ret, "HD")
ret = add_str(ret, "%sx%s" % (str(info.getInfo(iServiceInformation.sVideoWidth)), str(video_height)))
return ret

text = property(get_text)
Expand Down

0 comments on commit da580e1

Please sign in to comment.