From 591bd323b1c47689fbc16a2ae6cd067750f12352 Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Wed, 5 Apr 2017 18:54:25 +0200 Subject: [PATCH] The script showing how to get a language of a subtitle file by reading through and finding the closest matching language. --- modules/subLangfinder.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 modules/subLangfinder.py diff --git a/modules/subLangfinder.py b/modules/subLangfinder.py new file mode 100755 index 0000000..df3bf15 --- /dev/null +++ b/modules/subLangfinder.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +from langdetect import detect + +def main(): + f = open('/Volumes/media/movies/The Man from UNCLE (2015)/The.Man.from.U.N.C.L.E.2015.1080p.nl.srt', 'r', encoding = "ISO-8859-15") + print(detect(f.read())) + f.close() + print(f.close()) + +if __name__ == '__main__': + main() \ No newline at end of file