From b40f0f91ef672183d19bf7f0bbc6b5306ce68a04 Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Sun, 23 Sep 2018 21:26:57 +0200 Subject: [PATCH] Added subtitle_path function which finds the dirpath based on video sibling and subtitle name. --- src/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core.py b/src/core.py index b7da6ca..014cdb5 100755 --- a/src/core.py +++ b/src/core.py @@ -58,7 +58,6 @@ def search_external_subtitles(path, directory=None): filecontent = pattern.sub('', f.read()) filecontent = filecontent[0:1000] language = langdetect.detect(filecontent) - print(language) f.close() subtitles[p] = language @@ -121,6 +120,10 @@ def scan_subtitle(path): return subtitle +def subtitle_path(sibling, subtitle): + parent_path = os.path.dirname(sibling) + return os.path.join(parent_path, subtitle) + def scan_videos(path): """Scan `path` for videos and their subtitles.