Fixed mediainfo integration issues. #2007

pull/2025/head v1.1.4-beta.8
morpheus65535 2 years ago
parent c4b8345e65
commit 0970f19d96

@ -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 data['ffprobe'] or data['mediainfo']:
logging.debug("No FFprobe available in cache for this file: {}".format(path))
if not any([data['ffprobe'], data['mediainfo'], data['enzyme']]):
logging.error("No cache available for this file: {}".format(path))
return video
if data['ffprobe']:
@ -42,6 +42,9 @@ 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 = {}

@ -93,6 +93,8 @@ def parse_video_metadata(file, file_size, episode_file_id=None, movie_file_id=No
"file_size": file_size,
}
embedded_subs_parser = settings.general.embedded_subtitles_parser
if use_cache:
# Get the actual cache value form database
if episode_file_id:
@ -115,17 +117,23 @@ def parse_video_metadata(file, file_size, episode_file_id=None, movie_file_id=No
except Exception:
pass
else:
# Check if file size and file id matches and if so, we return the cached value
# 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]:
return cached_value
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'])):
return cached_value
# if not, we retrieve the metadata from the file
from utilities.binaries import get_binary
ffprobe_path = mediainfo_path = None
if settings.general.embedded_subtitles_parser == 'ffprobe':
if embedded_subs_parser == 'ffprobe':
ffprobe_path = get_binary("ffprobe")
elif settings.general.embedded_subtitles_parser == 'mediainfo':
elif embedded_subs_parser == 'mediainfo':
mediainfo_path = get_binary("mediainfo")
# if we have ffprobe available

@ -78,12 +78,13 @@ const SettingsSchedulerView: FunctionComponent = () => {
</CollapseBox>
<Check
label="Use cached ffprobe results"
label="Use cached embedded subtitles parser results"
settingKey="settings-sonarr-use_ffprobe_cache"
></Check>
<Message>
If disabled, Bazarr will use ffprobe to index video file properties on
each run. This will result in higher disk I/O.
If disabled, Bazarr will use the embedded subtitles parser to index
episodes file properties on each run. This will result in higher disk
I/O.
</Message>
<Selector
@ -114,12 +115,12 @@ const SettingsSchedulerView: FunctionComponent = () => {
</CollapseBox>
<Check
label="Use cached ffprobe results"
label="Use cached embedded subtitles parser results"
settingKey="settings-radarr-use_ffprobe_cache"
></Check>
<Message>
If disabled, Bazarr will use ffprobe to index video file properties on
each run. This will result in higher disk I/O.
If disabled, Bazarr will use embedded subtitles parser to index movies
file properties on each run. This will result in higher disk I/O.
</Message>
</Section>
<Section header="Search and Upgrade Subtitles">

Loading…
Cancel
Save