mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Added some ffprobe error handling
This commit is contained in:
parent
bbbe6164dc
commit
37dd0c8bdd
@ -35,8 +35,11 @@ namespace MediaBrowser.Controller.FFMpeg
|
|||||||
|
|
||||||
FFProbeResult result = Run(item.Path);
|
FFProbeResult result = Run(item.Path);
|
||||||
|
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
// Fire and forget
|
// Fire and forget
|
||||||
CacheResult(result, cachePath);
|
CacheResult(result, cachePath);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,6 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
|
|
||||||
protected override void Fetch(Audio audio, FFProbeResult data)
|
protected override void Fetch(Audio audio, FFProbeResult data)
|
||||||
{
|
{
|
||||||
if (data == null)
|
|
||||||
{
|
|
||||||
Logger.LogInfo("Null FFProbeResult for {0} {1}", audio.Id, audio.Name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MediaStream stream = data.streams.First(s => s.codec_type.Equals("audio", StringComparison.OrdinalIgnoreCase));
|
MediaStream stream = data.streams.First(s => s.codec_type.Equals("audio", StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
string bitrate = null;
|
string bitrate = null;
|
||||||
@ -176,11 +170,19 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
|
|
||||||
FFProbeResult result = FFProbe.Run(myItem, CacheDirectory);
|
FFProbeResult result = FFProbe.Run(myItem, CacheDirectory);
|
||||||
|
|
||||||
if (result.format.tags != null)
|
if (result == null)
|
||||||
|
{
|
||||||
|
Logger.LogInfo("Null FFProbeResult for {0} {1}", item.Id, item.Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.format != null && result.format.tags != null)
|
||||||
{
|
{
|
||||||
result.format.tags = ConvertDictionaryToCaseInSensitive(result.format.tags);
|
result.format.tags = ConvertDictionaryToCaseInSensitive(result.format.tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result.streams != null)
|
||||||
|
{
|
||||||
foreach (MediaStream stream in result.streams)
|
foreach (MediaStream stream in result.streams)
|
||||||
{
|
{
|
||||||
if (stream.tags != null)
|
if (stream.tags != null)
|
||||||
@ -188,6 +190,7 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
stream.tags = ConvertDictionaryToCaseInSensitive(stream.tags);
|
stream.tags = ConvertDictionaryToCaseInSensitive(stream.tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Fetch(myItem, result);
|
Fetch(myItem, result);
|
||||||
});
|
});
|
||||||
|
@ -27,12 +27,8 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
|
|
||||||
protected override void Fetch(Video video, FFProbeResult data)
|
protected override void Fetch(Video video, FFProbeResult data)
|
||||||
{
|
{
|
||||||
if (data == null)
|
if (data.format != null)
|
||||||
{
|
{
|
||||||
Logger.LogInfo("Null FFProbeResult for {0} {1}", video.Id, video.Name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(data.format.duration))
|
if (!string.IsNullOrEmpty(data.format.duration))
|
||||||
{
|
{
|
||||||
video.RunTimeTicks = TimeSpan.FromSeconds(double.Parse(data.format.duration)).Ticks;
|
video.RunTimeTicks = TimeSpan.FromSeconds(double.Parse(data.format.duration)).Ticks;
|
||||||
@ -42,7 +38,10 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
{
|
{
|
||||||
video.BitRate = int.Parse(data.format.bit_rate);
|
video.BitRate = int.Parse(data.format.bit_rate);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.streams != null)
|
||||||
|
{
|
||||||
// For now, only read info about first video stream
|
// For now, only read info about first video stream
|
||||||
// Files with multiple video streams are possible, but extremely rare
|
// Files with multiple video streams are possible, but extremely rare
|
||||||
bool foundVideo = false;
|
bool foundVideo = false;
|
||||||
@ -64,6 +63,7 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void FetchFromVideoStream(Video video, MediaStream stream)
|
private void FetchFromVideoStream(Video video, MediaStream stream)
|
||||||
{
|
{
|
||||||
@ -112,6 +112,17 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
video.AudioStreams = streams;
|
video.AudioStreams = streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FetchFromSubtitleStream(Video video, MediaStream stream)
|
||||||
|
{
|
||||||
|
SubtitleStream subtitle = new SubtitleStream();
|
||||||
|
|
||||||
|
subtitle.Language = GetDictionaryValue(stream.tags, "language");
|
||||||
|
|
||||||
|
List<SubtitleStream> streams = video.Subtitles ?? new List<SubtitleStream>();
|
||||||
|
streams.Add(subtitle);
|
||||||
|
video.Subtitles = streams;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if there's already enough info in the Video object to allow us to skip running ffprobe
|
/// Determines if there's already enough info in the Video object to allow us to skip running ffprobe
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user