|
@@ -27,40 +27,40 @@ 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))
|
|
|
|
+ {
|
|
|
|
+ video.RunTimeTicks = TimeSpan.FromSeconds(double.Parse(data.format.duration)).Ticks;
|
|
|
|
+ }
|
|
|
|
|
|
- if (!string.IsNullOrEmpty(data.format.duration))
|
|
|
|
- {
|
|
|
|
- video.RunTimeTicks = TimeSpan.FromSeconds(double.Parse(data.format.duration)).Ticks;
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty(data.format.bit_rate))
|
|
|
|
+ {
|
|
|
|
+ video.BitRate = int.Parse(data.format.bit_rate);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- if (!string.IsNullOrEmpty(data.format.bit_rate))
|
|
|
|
|
|
+ if (data.streams != null)
|
|
{
|
|
{
|
|
- video.BitRate = int.Parse(data.format.bit_rate);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // For now, only read info about first video stream
|
|
|
|
- // Files with multiple video streams are possible, but extremely rare
|
|
|
|
- bool foundVideo = false;
|
|
|
|
|
|
+ // For now, only read info about first video stream
|
|
|
|
+ // Files with multiple video streams are possible, but extremely rare
|
|
|
|
+ bool foundVideo = false;
|
|
|
|
|
|
- foreach (MediaStream stream in data.streams)
|
|
|
|
- {
|
|
|
|
- if (stream.codec_type.Equals("video", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
+ foreach (MediaStream stream in data.streams)
|
|
{
|
|
{
|
|
- if (!foundVideo)
|
|
|
|
|
|
+ if (stream.codec_type.Equals("video", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
{
|
|
- FetchFromVideoStream(video, stream);
|
|
|
|
- }
|
|
|
|
|
|
+ if (!foundVideo)
|
|
|
|
+ {
|
|
|
|
+ FetchFromVideoStream(video, stream);
|
|
|
|
+ }
|
|
|
|
|
|
- foundVideo = true;
|
|
|
|
- }
|
|
|
|
- else if (stream.codec_type.Equals("audio", StringComparison.OrdinalIgnoreCase))
|
|
|
|
- {
|
|
|
|
- FetchFromAudioStream(video, stream);
|
|
|
|
|
|
+ foundVideo = true;
|
|
|
|
+ }
|
|
|
|
+ else if (stream.codec_type.Equals("audio", StringComparison.OrdinalIgnoreCase))
|
|
|
|
+ {
|
|
|
|
+ FetchFromAudioStream(video, stream);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -111,6 +111,17 @@ namespace MediaBrowser.Controller.Providers
|
|
streams.Add(audio);
|
|
streams.Add(audio);
|
|
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
|