Added subtitle_path function which finds the dirpath based on video sibling and subtitle name.
This commit is contained in:
@@ -58,7 +58,6 @@ def search_external_subtitles(path, directory=None):
|
|||||||
filecontent = pattern.sub('', f.read())
|
filecontent = pattern.sub('', f.read())
|
||||||
filecontent = filecontent[0:1000]
|
filecontent = filecontent[0:1000]
|
||||||
language = langdetect.detect(filecontent)
|
language = langdetect.detect(filecontent)
|
||||||
print(language)
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
subtitles[p] = language
|
subtitles[p] = language
|
||||||
@@ -121,6 +120,10 @@ def scan_subtitle(path):
|
|||||||
|
|
||||||
return subtitle
|
return subtitle
|
||||||
|
|
||||||
|
def subtitle_path(sibling, subtitle):
|
||||||
|
parent_path = os.path.dirname(sibling)
|
||||||
|
return os.path.join(parent_path, subtitle)
|
||||||
|
|
||||||
def scan_videos(path):
|
def scan_videos(path):
|
||||||
"""Scan `path` for videos and their subtitles.
|
"""Scan `path` for videos and their subtitles.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user