mirror of
https://github.com/morpheus65535/bazarr
synced 2025-02-21 13:37:34 +00:00
Embedded Subtitles provider: fix language error (fix #1653)
This commit is contained in:
parent
117c894052
commit
e65d643fae
2 changed files with 17 additions and 7 deletions
|
@ -148,6 +148,7 @@ class FFprobeSubtitleStream:
|
||||||
|
|
||||||
def _language(self) -> Language:
|
def _language(self) -> Language:
|
||||||
og_lang = self.tags.get("language")
|
og_lang = self.tags.get("language")
|
||||||
|
last_exc = None
|
||||||
|
|
||||||
if og_lang is not None:
|
if og_lang is not None:
|
||||||
if og_lang in _extra_languages:
|
if og_lang in _extra_languages:
|
||||||
|
@ -158,19 +159,23 @@ class FFprobeSubtitleStream:
|
||||||
return Language(*extra["language_args"])
|
return Language(*extra["language_args"])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return Language.fromalpha3b(og_lang)
|
lang = Language.fromalpha3b(og_lang)
|
||||||
|
# Test for suffix
|
||||||
|
assert lang.alpha2
|
||||||
|
|
||||||
|
return lang
|
||||||
except LanguageError as error:
|
except LanguageError as error:
|
||||||
|
last_exc = error
|
||||||
logger.debug("Error with '%s' language: %s", og_lang, error)
|
logger.debug("Error with '%s' language: %s", og_lang, error)
|
||||||
|
|
||||||
raise LanguageNotFound(f"Couldn't detect language for stream: {self.tags}")
|
raise LanguageNotFound(
|
||||||
|
f"Couldn't detect language for stream: {self.tags}"
|
||||||
|
) from last_exc
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f"<{self.codec_name.upper()}: {self.language}@{self.disposition}>"
|
return f"<{self.codec_name.upper()}: {self.language}@{self.disposition}>"
|
||||||
|
|
||||||
|
|
||||||
# Helpers
|
|
||||||
|
|
||||||
|
|
||||||
class FFprobeVideoContainer:
|
class FFprobeVideoContainer:
|
||||||
def __init__(self, path: str):
|
def __init__(self, path: str):
|
||||||
self.path = path
|
self.path = path
|
||||||
|
@ -361,7 +366,12 @@ def to_srt(
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
_subtitle_extensions = {"subrip": "srt", "ass": "ass"}
|
_subtitle_extensions = {
|
||||||
|
"subrip": "srt",
|
||||||
|
"ass": "ass",
|
||||||
|
"hdmv_pgs_subtitle": "sup",
|
||||||
|
"pgs": "sup",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_content_types = {
|
_content_types = {
|
||||||
|
|
|
@ -12,7 +12,7 @@ deep-translator=1.5.4
|
||||||
dogpile.cache=0.6.5
|
dogpile.cache=0.6.5
|
||||||
engineio=4.3.0
|
engineio=4.3.0
|
||||||
enzyme=0.4.1
|
enzyme=0.4.1
|
||||||
fese=0.1.0
|
fese=0.1.1
|
||||||
ffsubsync=0.4.11
|
ffsubsync=0.4.11
|
||||||
Flask=1.1.1
|
Flask=1.1.1
|
||||||
flask-restful=0.3.8
|
flask-restful=0.3.8
|
||||||
|
|
Loading…
Reference in a new issue