def saveSubtitle(self, content, lang, convert=True):
codePageDict = {'ara': 'cp1256', 'ar': 'cp1256', 'cs': 'cp1250', 'ell': 'cp1253',
'el': 'cp1253', 'heb': 'cp1255', 'he': 'cp1255', 'sk': 'cp1250', 'tur': 'cp1254',
'tr': 'cp1254', 'rus': 'cp1251', 'ru': 'cp1251'}
subtitle = xbmc.validatePath(xbmc.translatePath('special://temp/'))
subtitle = os.path.join(subtitle, 'AutomatickeTitulky.%s.srt' % lang)
codepage = codePageDict.get(lang, '')
if codepage and self.getSetting('subtitles.utf') == 'true':
try:
content_encoded = codecs.decode(content, codepage)
content = codecs.encode(content_encoded, 'utf-8')
except Exception, e:
util.debug("[SC] chyba ukladania titulkov....")
pass
file = xbmcvfs.File(subtitle, 'w')
file.write(str(content))
file.close()
return subtitle
评论列表
文章目录