mirror of
https://github.com/morpheus65535/bazarr.git
synced 2024-11-10 09:02:44 +08: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:
|
||||
og_lang = self.tags.get("language")
|
||||
last_exc = None
|
||||
|
||||
if og_lang is not None:
|
||||
if og_lang in _extra_languages:
|
||||
|
@ -158,19 +159,23 @@ class FFprobeSubtitleStream:
|
|||
return Language(*extra["language_args"])
|
||||
|
||||
try:
|
||||
return Language.fromalpha3b(og_lang)
|
||||
lang = Language.fromalpha3b(og_lang)
|
||||
# Test for suffix
|
||||
assert lang.alpha2
|
||||
|
||||
return lang
|
||||
except LanguageError as error:
|
||||
last_exc = 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:
|
||||
return f"<{self.codec_name.upper()}: {self.language}@{self.disposition}>"
|
||||
|
||||
|
||||
# Helpers
|
||||
|
||||
|
||||
class FFprobeVideoContainer:
|
||||
def __init__(self, path: str):
|
||||
self.path = path
|
||||
|
@ -361,7 +366,12 @@ def to_srt(
|
|||
return output
|
||||
|
||||
|
||||
_subtitle_extensions = {"subrip": "srt", "ass": "ass"}
|
||||
_subtitle_extensions = {
|
||||
"subrip": "srt",
|
||||
"ass": "ass",
|
||||
"hdmv_pgs_subtitle": "sup",
|
||||
"pgs": "sup",
|
||||
}
|
||||
|
||||
|
||||
_content_types = {
|
||||
|
|
|
@ -12,7 +12,7 @@ deep-translator=1.5.4
|
|||
dogpile.cache=0.6.5
|
||||
engineio=4.3.0
|
||||
enzyme=0.4.1
|
||||
fese=0.1.0
|
||||
fese=0.1.1
|
||||
ffsubsync=0.4.11
|
||||
Flask=1.1.1
|
||||
flask-restful=0.3.8
|
||||
|
|
Loading…
Reference in a new issue