def updatePartsSub(parts): for part in parts: try: file_path = os.path.splitext(part.file)[0] sub_path = file_path + '.srt' if (False == os.path.exists(sub_path)): Log('No subtitle file found') continue Log('Found subtitle file: ' + sub_path) encoding = ltrsubs.get_hebrew_encoding(sub_path) if (None == encoding): Log('Subtitle file does not seem to be in hebrew, skipping file.') continue Log('Subtitle seems to be in hebrew (' + encoding + '), processing subtitle file.') subData = ltrsubs.writeHebSubs(sub_path, encoding) processedSub = Proxy.Media(subData, codec = 'srt', format='srt') part.subtitles[Locale.Language.Hebrew][sub_path] = processedSub except Exception as e: Log('Error: ' + str(e))
def saveHeb(inputFile): result = ltrsubs.writeHebSubs(inputFile) file = open(inputFile + '.heb', 'w') file.write(str(result)) file.close()