mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-23 00:03:33 +00:00
parent
a13d69ddb2
commit
1c1caeb78b
1 changed files with 9 additions and 11 deletions
|
@ -14,7 +14,6 @@ from fese import FFprobeSubtitleStream
|
|||
from fese import FFprobeVideoContainer
|
||||
from fese import tags
|
||||
from fese.exceptions import InvalidSource
|
||||
from subliminal.subtitle import fix_line_ending
|
||||
from subliminal_patch.core import Episode
|
||||
from subliminal_patch.core import Movie
|
||||
from subliminal_patch.providers import Provider
|
||||
|
@ -187,19 +186,18 @@ class EmbeddedSubtitlesProvider(Provider):
|
|||
def download_subtitle(self, subtitle: EmbeddedSubtitle):
|
||||
path = self._get_subtitle_path(subtitle)
|
||||
|
||||
modifiers = _type_modifiers.get(subtitle.stream.codec_name)
|
||||
logger.debug(
|
||||
"Found modifiers for %s type: %s", subtitle.stream.codec_name, modifiers
|
||||
)
|
||||
modifiers = _type_modifiers.get(subtitle.stream.codec_name) or set()
|
||||
logger.debug("Found modifiers for %s type: %s", subtitle.stream, modifiers)
|
||||
|
||||
if modifiers is not None:
|
||||
for mod in modifiers:
|
||||
logger.debug("Running %s modifier for %s", mod, path)
|
||||
for mod in modifiers:
|
||||
logger.debug("Running %s modifier for %s", mod, path)
|
||||
try:
|
||||
mod(path, path)
|
||||
except Exception as error:
|
||||
logger.debug("'%s' raised running modifier", error)
|
||||
|
||||
with open(path, "rb") as sub:
|
||||
content = sub.read()
|
||||
subtitle.content = fix_line_ending(content)
|
||||
subtitle.content = sub.read()
|
||||
|
||||
def _get_subtitle_path(self, subtitle: EmbeddedSubtitle):
|
||||
container = subtitle.container
|
||||
|
@ -341,7 +339,7 @@ def _clean_ass_subtitles(path, output_path):
|
|||
|
||||
clean_lines = []
|
||||
|
||||
with open(path, "r") as f:
|
||||
with open(path, "r", encoding="utf-8", errors="ignore") as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
if _SIGNS_LINE_RE.search(line) is None:
|
||||
|
|
Loading…
Reference in a new issue