mirror of https://github.com/morpheus65535/bazarr
Fixed mediainfo integration issues. #2007
This commit is contained in:
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'],
|
data = parse_video_metadata(file=path, file_size=file_id['file_size'],
|
||||||
episode_file_id=file_id['episode_file_id'])
|
episode_file_id=file_id['episode_file_id'])
|
||||||
|
|
||||||
if not data['ffprobe'] or data['mediainfo']:
|
if not any([data['ffprobe'], data['mediainfo'], data['enzyme']]):
|
||||||
logging.debug("No FFprobe available in cache for this file: {}".format(path))
|
logging.error("No cache available for this file: {}".format(path))
|
||||||
return video
|
return video
|
||||||
|
|
||||||
if data['ffprobe']:
|
if data['ffprobe']:
|
||||||
|
@ -42,6 +42,9 @@ def refine_from_ffprobe(path, video):
|
||||||
elif data['mediainfo']:
|
elif data['mediainfo']:
|
||||||
logging.debug('Mediainfo found: %s', data['mediainfo'])
|
logging.debug('Mediainfo found: %s', data['mediainfo'])
|
||||||
parser_data = data['mediainfo']
|
parser_data = data['mediainfo']
|
||||||
|
elif data['enzyme']:
|
||||||
|
logging.debug('Enzyme found: %s', data['enzyme'])
|
||||||
|
parser_data = data['enzyme']
|
||||||
else:
|
else:
|
||||||
parser_data = {}
|
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,
|
"file_size": file_size,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
embedded_subs_parser = settings.general.embedded_subtitles_parser
|
||||||
|
|
||||||
if use_cache:
|
if use_cache:
|
||||||
# Get the actual cache value form database
|
# Get the actual cache value form database
|
||||||
if episode_file_id:
|
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:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
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]:
|
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
|
# if not, we retrieve the metadata from the file
|
||||||
from utilities.binaries import get_binary
|
from utilities.binaries import get_binary
|
||||||
|
|
||||||
ffprobe_path = mediainfo_path = None
|
ffprobe_path = mediainfo_path = None
|
||||||
if settings.general.embedded_subtitles_parser == 'ffprobe':
|
if embedded_subs_parser == 'ffprobe':
|
||||||
ffprobe_path = get_binary("ffprobe")
|
ffprobe_path = get_binary("ffprobe")
|
||||||
elif settings.general.embedded_subtitles_parser == 'mediainfo':
|
elif embedded_subs_parser == 'mediainfo':
|
||||||
mediainfo_path = get_binary("mediainfo")
|
mediainfo_path = get_binary("mediainfo")
|
||||||
|
|
||||||
# if we have ffprobe available
|
# if we have ffprobe available
|
||||||
|
|
|
@ -78,12 +78,13 @@ const SettingsSchedulerView: FunctionComponent = () => {
|
||||||
</CollapseBox>
|
</CollapseBox>
|
||||||
|
|
||||||
<Check
|
<Check
|
||||||
label="Use cached ffprobe results"
|
label="Use cached embedded subtitles parser results"
|
||||||
settingKey="settings-sonarr-use_ffprobe_cache"
|
settingKey="settings-sonarr-use_ffprobe_cache"
|
||||||
></Check>
|
></Check>
|
||||||
<Message>
|
<Message>
|
||||||
If disabled, Bazarr will use ffprobe to index video file properties on
|
If disabled, Bazarr will use the embedded subtitles parser to index
|
||||||
each run. This will result in higher disk I/O.
|
episodes file properties on each run. This will result in higher disk
|
||||||
|
I/O.
|
||||||
</Message>
|
</Message>
|
||||||
|
|
||||||
<Selector
|
<Selector
|
||||||
|
@ -114,12 +115,12 @@ const SettingsSchedulerView: FunctionComponent = () => {
|
||||||
</CollapseBox>
|
</CollapseBox>
|
||||||
|
|
||||||
<Check
|
<Check
|
||||||
label="Use cached ffprobe results"
|
label="Use cached embedded subtitles parser results"
|
||||||
settingKey="settings-radarr-use_ffprobe_cache"
|
settingKey="settings-radarr-use_ffprobe_cache"
|
||||||
></Check>
|
></Check>
|
||||||
<Message>
|
<Message>
|
||||||
If disabled, Bazarr will use ffprobe to index video file properties on
|
If disabled, Bazarr will use embedded subtitles parser to index movies
|
||||||
each run. This will result in higher disk I/O.
|
file properties on each run. This will result in higher disk I/O.
|
||||||
</Message>
|
</Message>
|
||||||
</Section>
|
</Section>
|
||||||
<Section header="Search and Upgrade Subtitles">
|
<Section header="Search and Upgrade Subtitles">
|
||||||
|
|
Loading…
Reference in New Issue