mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-30 11:35:50 +00:00
Merge remote-tracking branch 'origin/development' into development
This commit is contained in:
commit
1e4ffe9c60
5 changed files with 1135 additions and 2 deletions
|
@ -4,4 +4,4 @@
|
||||||
from .container import FFprobeVideoContainer
|
from .container import FFprobeVideoContainer
|
||||||
from .stream import FFprobeSubtitleStream
|
from .stream import FFprobeSubtitleStream
|
||||||
|
|
||||||
__version__ = "0.2.3"
|
__version__ = "0.2.5"
|
||||||
|
|
|
@ -55,6 +55,12 @@ class FFprobeSubtitleDisposition:
|
||||||
def suffix(self):
|
def suffix(self):
|
||||||
return self._content_type or ""
|
return self._content_type or ""
|
||||||
|
|
||||||
|
def language_kwargs(self):
|
||||||
|
return {
|
||||||
|
"hi": self._content_type == "hearing_impaired",
|
||||||
|
"forced": self._content_type == "forced",
|
||||||
|
}
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.suffix.upper() or "GENERIC"
|
return self.suffix.upper() or "GENERIC"
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ from __future__ import annotations
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from babelfish import Language
|
||||||
|
|
||||||
from .disposition import FFprobeSubtitleDisposition
|
from .disposition import FFprobeSubtitleDisposition
|
||||||
from .exceptions import UnsupportedCodec
|
from .exceptions import UnsupportedCodec
|
||||||
from .tags import FFprobeGenericSubtitleTags
|
from .tags import FFprobeGenericSubtitleTags
|
||||||
|
@ -85,6 +87,10 @@ class FFprobeSubtitleStream:
|
||||||
# Legacy
|
# Legacy
|
||||||
return self.tags.language
|
return self.tags.language
|
||||||
|
|
||||||
|
@language.setter
|
||||||
|
def language(self, value: Language):
|
||||||
|
self.tags.language = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extension(self):
|
def extension(self):
|
||||||
return self._codec["copy_format"] or self._codec["convert_default_format"] or ""
|
return self._codec["copy_format"] or self._codec["convert_default_format"] or ""
|
||||||
|
|
|
@ -297,8 +297,13 @@ def _discard_possible_incomplete_subtitles(streams):
|
||||||
valid_streams = []
|
valid_streams = []
|
||||||
|
|
||||||
for stream in streams:
|
for stream in streams:
|
||||||
|
# Make sure to update stream's language to reflect disposition
|
||||||
|
stream.language = Language.rebuild(
|
||||||
|
stream.language, **stream.disposition.language_kwargs()
|
||||||
|
)
|
||||||
|
|
||||||
# 500 < 1200
|
# 500 < 1200
|
||||||
if stream.tags.frames < max_frames // 2:
|
if not stream.language.forced and stream.tags.frames < max_frames // 2:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Possible bad subtitle found: %s (%s frames - %s frames)",
|
"Possible bad subtitle found: %s (%s frames - %s frames)",
|
||||||
stream,
|
stream,
|
||||||
|
|
1116
tests/subliminal_patch/data/subs.ass
Normal file
1116
tests/subliminal_patch/data/subs.ass
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue