summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2022-12-22 11:37:37 -0500
committermorpheus65535 <[email protected]>2022-12-22 11:37:37 -0500
commit5d36b80c0753cff951d3198a197cf709f43efca2 (patch)
tree0dfd26cd2f8bd5f822165061de28362ae5dda0eb
parent0970f19d96443401b92099ceaa1e8b654258b077 (diff)
downloadbazarr-5d36b80c0753cff951d3198a197cf709f43efca2.tar.gz
bazarr-5d36b80c0753cff951d3198a197cf709f43efca2.zip
Removed Enzyme for embedded subtitles indexing and fixed mediainfo integration issues. #2007v1.1.4-beta.9
-rw-r--r--bazarr/subtitles/refiners/ffprobe.py7
-rw-r--r--bazarr/subtitles/tools/embedded_subs_reader.py47
-rw-r--r--libs/version.txt2
3 files changed, 14 insertions, 42 deletions
diff --git a/bazarr/subtitles/refiners/ffprobe.py b/bazarr/subtitles/refiners/ffprobe.py
index 9751814e6..9e080ae51 100644
--- a/bazarr/subtitles/refiners/ffprobe.py
+++ b/bazarr/subtitles/refiners/ffprobe.py
@@ -32,8 +32,8 @@ def refine_from_ffprobe(path, video):
data = parse_video_metadata(file=path, file_size=file_id['file_size'],
episode_file_id=file_id['episode_file_id'])
- if not any([data['ffprobe'], data['mediainfo'], data['enzyme']]):
- logging.error("No cache available for this file: {}".format(path))
+ if 'ffprobe' not in data and 'mediainfo' not in data:
+ logging.debug("No cache available for this file: {}".format(path))
return video
if data['ffprobe']:
@@ -42,9 +42,6 @@ def refine_from_ffprobe(path, video):
elif data['mediainfo']:
logging.debug('Mediainfo found: %s', data['mediainfo'])
parser_data = data['mediainfo']
- elif data['enzyme']:
- logging.debug('Enzyme found: %s', data['enzyme'])
- parser_data = data['enzyme']
else:
parser_data = {}
diff --git a/bazarr/subtitles/tools/embedded_subs_reader.py b/bazarr/subtitles/tools/embedded_subs_reader.py
index 94860ffb7..b4153ead1 100644
--- a/bazarr/subtitles/tools/embedded_subs_reader.py
+++ b/bazarr/subtitles/tools/embedded_subs_reader.py
@@ -1,12 +1,9 @@
# coding=utf-8
import logging
-import os
import pickle
-import enzyme
from knowit.api import know
-from enzyme.exceptions import MalformedMKVError
from languages.custom_lang import CustomLanguage
from app.database import TableEpisodes, TableMovies
@@ -65,21 +62,6 @@ def embedded_subs_reader(file, file_size, episode_file_id=None, movie_file_id=No
codec = detected_language.get("format") # or None
subtitles_list.append([language, forced, hearing_impaired, codec])
- elif data["enzyme"]:
- for subtitle_track in data["enzyme"].subtitle_tracks:
- hearing_impaired = (
- subtitle_track.name and "sdh" in subtitle_track.name.lower()
- )
-
- subtitles_list.append(
- [
- subtitle_track.language,
- subtitle_track.forced,
- hearing_impaired,
- subtitle_track.codec_id,
- ]
- )
-
return subtitles_list
@@ -88,7 +70,6 @@ def parse_video_metadata(file, file_size, episode_file_id=None, movie_file_id=No
data = {
"ffprobe": {},
"mediainfo": {},
- "enzyme": {},
"file_id": episode_file_id or movie_file_id,
"file_size": file_size,
}
@@ -120,12 +101,14 @@ def parse_video_metadata(file, file_size, episode_file_id=None, movie_file_id=No
# Check if file size and file id matches and if so, we return the cached value if available for the
# desired parser
if cached_value['file_size'] == file_size and cached_value['file_id'] in [episode_file_id, movie_file_id]:
- if ((embedded_subs_parser == 'ffprobe' and 'ffprobe' in cached_value and cached_value['ffprobe']) or
- (embedded_subs_parser == 'mediainfo' and 'mediainfo' in cached_value and
- cached_value['mediainfo']) or
- (all(['ffprobe', 'mediainfo']) not in cached_value and 'enzyme' in cached_value and
- cached_value['enzyme'])):
+ if embedded_subs_parser in cached_value and cached_value[embedded_subs_parser]:
return cached_value
+ else:
+ # no valid cache
+ pass
+ else:
+ # cache mut be renewed
+ pass
# if not, we retrieve the metadata from the file
from utilities.binaries import get_binary
@@ -142,19 +125,11 @@ def parse_video_metadata(file, file_size, episode_file_id=None, movie_file_id=No
# or if we have mediainfo available
elif mediainfo_path:
data["mediainfo"] = know(video_path=file, context={"provider": "mediainfo", "mediainfo": mediainfo_path})
- # else, we use enzyme for mkv files
+ # else, we warn user of missing binary
else:
- if os.path.splitext(file)[1] == ".mkv":
- with open(file, "rb") as f:
- try:
- mkv = enzyme.MKV(f)
- except MalformedMKVError:
- logging.error(
- "BAZARR cannot analyze this MKV with our built-in MKV parser, you should install "
- "ffmpeg/ffprobe or mediainfo: " + file
- )
- else:
- data["enzyme"] = mkv
+ logging.error("BAZARR require ffmpeg/ffprobe or mediainfo, please install it and make sure to choose it in "
+ "Settings-->Subtitles.")
+ return
# we write to db the result and return the newly cached ffprobe dict
if episode_file_id:
diff --git a/libs/version.txt b/libs/version.txt
index 54977eaaa..8316736be 100644
--- a/libs/version.txt
+++ b/libs/version.txt
@@ -7,7 +7,6 @@ attrs==22.1.0
charamel==1.0.0
deep-translator==1.9.1
dogpile.cache==1.1.8
-enzyme==0.4.1
fese==0.1.2
ffsubsync==0.4.20
flask-cors==3.0.10
@@ -110,6 +109,7 @@ cloudscraper==1.2.58
#deathbycaptcha # unknown version, only found on gist
decorator==5.1.1
dnspython==2.2.1
+enzyme==0.4.1
ftfy==6.1.1
html5lib==1.1
Js2Py==0.74