From 7c75ae7615aa010cc3efb3eb6ca3f523e8be4abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Mon, 7 Oct 2019 14:50:16 -0400 Subject: [PATCH] Fix for invalid language code. --- libs/subliminal_patch/core.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/subliminal_patch/core.py b/libs/subliminal_patch/core.py index bcfef632b..a4976efc4 100644 --- a/libs/subliminal_patch/core.py +++ b/libs/subliminal_patch/core.py @@ -614,6 +614,10 @@ def _search_external_subtitles(path, languages=None, only_one=False, scandir_gen # extract the potential language code try: language_code = p_root.rsplit(".", 1)[1].replace('_', '-') + try: + language_code = Language.fromietf(language_code) + except ValueError: + language_code = None except IndexError: language_code = None