Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def buildMenu(self):
menuList = []
menuList.append(getConfigListEntry(__("Preferred Language") + ' 1', subtitles_settings.search.lang1))
menuList.append(getConfigListEntry(__("Preferred Language") + ' 2', subtitles_settings.search.lang2))
menuList.append(getConfigListEntry(__("Preferred Language") + ' 3', subtitles_settings.search.lang3))
menuList.append(getConfigListEntry(__("Sort by"), subtitles_settings.search.defaultSort))
if self.streamed:
subtitles_settings.search.downloadToMovieDir.value = False
else:
menuList.append(getConfigListEntry(__("Download to movie directory"), subtitles_settings.search.downloadToMovieDir))
if subtitles_settings.search.downloadToMovieDir.value:
menuList.append(getConfigListEntry(__("Save as movie name"), subtitles_settings.search.saveAsMovieName))
menuList.append(getConfigListEntry(__("Ask when overriding existing subtitles"), subtitles_settings.search.askOverrideExistingSubs))
else:
menuList.append(getConfigListEntry(__("Download Path"), subtitles_settings.search.downloadPath))
menuList.append(getConfigListEntry(__("Temp Path"), subtitles_settings.search.tmpPath))
self["config"].list = menuList
self["config"].setList(menuList)
self.list.append(getConfigListEntry(__("Parsing/Rendering"), subtitles_settings.engine))
self.list.append(getConfigListEntry(__("Font type"), subtitles_settings.fontType))
self.list.append(getConfigListEntry(__("Font size"), subtitles_settings.fontSize))
self.list.append(getConfigListEntry(__("Position"), subtitles_settings.position))
self.list.append(getConfigListEntry(__("Color"), subtitles_settings.color))
self.list.append(getConfigListEntry(__("Shadow type"), subtitles_settings.shadow.type))
if shadowType == 'offset':
self.list.append(getConfigListEntry(__("Shadow X-offset"), subtitles_settings.shadow.xOffset))
self.list.append(getConfigListEntry(__("Shadow Y-offset"), subtitles_settings.shadow.yOffset))
else:
self.list.append(getConfigListEntry(__("Shadow size"), subtitles_settings.shadow.size))
self.list.append(getConfigListEntry(__("Shadow color"), subtitles_settings.shadow.color))
self.list.append(getConfigListEntry(__("Encoding"), subtitles_settings.encodingsGroup))
self.list.append(getConfigListEntry(__("Show expert settings"), subtitles_settings.expert.show))
if showExpert:
self.list.append(getConfigListEntry(__("Hide delay"), subtitles_settings.expert.hideDelay))
self.list.append(getConfigListEntry(__("Sync delay"), subtitles_settings.expert.syncDelay))
self.list.append(getConfigListEntry(__("Player delay"), subtitles_settings.expert.playerDelay))
self.list.append(getConfigListEntry(__("Refresh delay"), subtitles_settings.expert.refreshDelay))
self.list.append(getConfigListEntry(__("PTS check delay"), subtitles_settings.expert.ptsDelayCheck))
self["config"].list = self.list
self["config"].setList(self.list)
def getMovieSizeStr(self):
if os.path.isfile(self.filepath):
return "%.2f MB" % float(os.path.getsize(self.filepath) / (1024 * 1024))
elif self.filepath.startswith('http://'):
try:
resp = urllib2.urlopen(HeadRequest(self.filepath))
return "%.2f MB" % float(long(resp.info().get('Content-Length')) / (1024 * 1024))
except (urllib2.URLError, urllib2.HTTPError):
return __("N/A")
finally:
if 'resp' in locals():
locals()['resp'].close()
return __("N/A")
def buildMenu(self):
del self.list[:]
shadowType = subtitles_settings.shadow.type.getValue()
showExpert = subtitles_settings.expert.show.getValue()
# self.list.append(getConfigListEntry(__("Show subtitles"), subtitles_settings.showSubtitles))
self.list.append(getConfigListEntry(__("Parsing/Rendering"), subtitles_settings.engine))
self.list.append(getConfigListEntry(__("Font type"), subtitles_settings.fontType))
self.list.append(getConfigListEntry(__("Font size"), subtitles_settings.fontSize))
self.list.append(getConfigListEntry(__("Position"), subtitles_settings.position))
self.list.append(getConfigListEntry(__("Color"), subtitles_settings.color))
self.list.append(getConfigListEntry(__("Shadow type"), subtitles_settings.shadow.type))
if shadowType == 'offset':
self.list.append(getConfigListEntry(__("Shadow X-offset"), subtitles_settings.shadow.xOffset))
self.list.append(getConfigListEntry(__("Shadow Y-offset"), subtitles_settings.shadow.yOffset))
else:
self.list.append(getConfigListEntry(__("Shadow size"), subtitles_settings.shadow.size))
self.list.append(getConfigListEntry(__("Shadow color"), subtitles_settings.shadow.color))
self.list.append(getConfigListEntry(__("Encoding"), subtitles_settings.encodingsGroup))
self.list.append(getConfigListEntry(__("Show expert settings"), subtitles_settings.expert.show))
if showExpert:
self.list.append(getConfigListEntry(__("Hide delay"), subtitles_settings.expert.hideDelay))
self.list.append(getConfigListEntry(__("Sync delay"), subtitles_settings.expert.syncDelay))
self.list.append(getConfigListEntry(__("Player delay"), subtitles_settings.expert.playerDelay))
self.list.append(getConfigListEntry(__("Refresh delay"), subtitles_settings.expert.refreshDelay))
self.list.append(getConfigListEntry(__("PTS check delay"), subtitles_settings.expert.ptsDelayCheck))
self["config"].list = self.list
self["config"].setList(self.list)
def delayCb(self, seconds):
delay(self.session, seconds, __("Subtitles will be downloaded in") + " " + str(seconds) + " " + __("seconds"))
self.list.append(getConfigListEntry(__("Position"), subtitles_settings.position))
self.list.append(getConfigListEntry(__("Color"), subtitles_settings.color))
self.list.append(getConfigListEntry(__("Shadow type"), subtitles_settings.shadow.type))
if shadowType == 'offset':
self.list.append(getConfigListEntry(__("Shadow X-offset"), subtitles_settings.shadow.xOffset))
self.list.append(getConfigListEntry(__("Shadow Y-offset"), subtitles_settings.shadow.yOffset))
else:
self.list.append(getConfigListEntry(__("Shadow size"), subtitles_settings.shadow.size))
self.list.append(getConfigListEntry(__("Shadow color"), subtitles_settings.shadow.color))
self.list.append(getConfigListEntry(__("Encoding"), subtitles_settings.encodingsGroup))
self.list.append(getConfigListEntry(__("Show expert settings"), subtitles_settings.expert.show))
if showExpert:
self.list.append(getConfigListEntry(__("Hide delay"), subtitles_settings.expert.hideDelay))
self.list.append(getConfigListEntry(__("Sync delay"), subtitles_settings.expert.syncDelay))
self.list.append(getConfigListEntry(__("Player delay"), subtitles_settings.expert.playerDelay))
self.list.append(getConfigListEntry(__("Refresh delay"), subtitles_settings.expert.refreshDelay))
self.list.append(getConfigListEntry(__("PTS check delay"), subtitles_settings.expert.ptsDelayCheck))
self["config"].list = self.list
self["config"].setList(self.list)
def getMovieSizeStr(self):
if os.path.isfile(self.filepath):
return "%.2f MB" % float(os.path.getsize(self.filepath) / (1024 * 1024))
elif self.filepath.startswith('http://'):
try:
resp = urllib2.urlopen(HeadRequest(self.filepath))
return "%.2f MB" % float(long(resp.info().get('Content-Length')) / (1024 * 1024))
except (urllib2.URLError, urllib2.HTTPError):
return __("N/A")
finally:
if 'resp' in locals():
locals()['resp'].close()
return __("N/A")
def buildMenu(self):
menuList = []
menuList.append(getConfigListEntry(__("Preferred Language") + ' 1', subtitles_settings.search.lang1))
menuList.append(getConfigListEntry(__("Preferred Language") + ' 2', subtitles_settings.search.lang2))
menuList.append(getConfigListEntry(__("Preferred Language") + ' 3', subtitles_settings.search.lang3))
menuList.append(getConfigListEntry(__("Sort by"), subtitles_settings.search.defaultSort))
if self.streamed:
subtitles_settings.search.downloadToMovieDir.value = False
else:
menuList.append(getConfigListEntry(__("Download to movie directory"), subtitles_settings.search.downloadToMovieDir))
if subtitles_settings.search.downloadToMovieDir.value:
menuList.append(getConfigListEntry(__("Save as movie name"), subtitles_settings.search.saveAsMovieName))
menuList.append(getConfigListEntry(__("Ask when overriding existing subtitles"), subtitles_settings.search.askOverrideExistingSubs))
else:
menuList.append(getConfigListEntry(__("Download Path"), subtitles_settings.search.downloadPath))
menuList.append(getConfigListEntry(__("Temp Path"), subtitles_settings.search.tmpPath))
self["config"].list = menuList
self["config"].setList(menuList)
return self.__subsLoader.load(subsPath, subsEnc)
except LoadError:
if showMessages:
warningMessage(self.session, __("Cannot load subtitles. Invalid path"))
return None, None
except DecodeError:
if showMessages:
warningMessage(self.session, __("Cannot decode subtitles. Try another encoding group"))
return None, None
except ParserNotFoundError:
if showMessages:
warningMessage(self.session, __("Cannot parse subtitles. Not supported subtitles format"))
return None, None
except ParseError:
if showMessages:
warningMessage(self.session, __("Cannot parse subtitles. Invalid subtitles format"))
return None, None
finally:
self.__firstStart = False
def buildMenu(self):
del self.list[:]
shadowType = subtitles_settings.shadow.type.getValue()
showExpert = subtitles_settings.expert.show.getValue()
# self.list.append(getConfigListEntry(__("Show subtitles"), subtitles_settings.showSubtitles))
self.list.append(getConfigListEntry(__("Parsing/Rendering"), subtitles_settings.engine))
self.list.append(getConfigListEntry(__("Font type"), subtitles_settings.fontType))
self.list.append(getConfigListEntry(__("Font size"), subtitles_settings.fontSize))
self.list.append(getConfigListEntry(__("Position"), subtitles_settings.position))
self.list.append(getConfigListEntry(__("Color"), subtitles_settings.color))
self.list.append(getConfigListEntry(__("Shadow type"), subtitles_settings.shadow.type))
if shadowType == 'offset':
self.list.append(getConfigListEntry(__("Shadow X-offset"), subtitles_settings.shadow.xOffset))
self.list.append(getConfigListEntry(__("Shadow Y-offset"), subtitles_settings.shadow.yOffset))
else:
self.list.append(getConfigListEntry(__("Shadow size"), subtitles_settings.shadow.size))
self.list.append(getConfigListEntry(__("Shadow color"), subtitles_settings.shadow.color))
self.list.append(getConfigListEntry(__("Encoding"), subtitles_settings.encodingsGroup))
self.list.append(getConfigListEntry(__("Show expert settings"), subtitles_settings.expert.show))
if showExpert:
self.list.append(getConfigListEntry(__("Hide delay"), subtitles_settings.expert.hideDelay))
self.list.append(getConfigListEntry(__("Sync delay"), subtitles_settings.expert.syncDelay))
self.list.append(getConfigListEntry(__("Player delay"), subtitles_settings.expert.playerDelay))