sort_keys=True

This commit is contained in:
j 2017-06-17 18:03:13 +02:00
parent 26a90dfd6e
commit 3b10328e65

View file

@ -116,7 +116,7 @@ def render_subtitles(item_json, output_json, output_srt, lang=None):
with open(output_srt, 'wb') as fd: with open(output_srt, 'wb') as fd:
fd.write(ox.srt.encode(subtitles)) fd.write(ox.srt.encode(subtitles))
with open(output_json, 'w') as fd: with open(output_json, 'w') as fd:
json.dump(subtitles, fd, indent=4, ensure_ascii=False) json.dump(subtitles, fd, indent=4, ensure_ascii=False, sort_keys=True)
if __name__ == '__main__': if __name__ == '__main__':
@ -125,7 +125,7 @@ if __name__ == '__main__':
else: else:
items = update_subtitles() items = update_subtitles()
with open('subtitles.json', 'w') as fd: with open('subtitles.json', 'w') as fd:
json.dump(items, fd, indent=4, ensure_ascii=False) json.dump(items, fd, indent=4, ensure_ascii=False, sort_keys=True)
if len(sys.argv) > 1: if len(sys.argv) > 1:
files = sys.argv[1:] files = sys.argv[1:]