Added some null checks and logging when parsing ffprobe output

pull/702/head
LukePulverenti Luke Pulverenti luke pulverenti 12 years ago
parent b15c064bba
commit 863ca986bd

@ -66,8 +66,6 @@ namespace MediaBrowser.Controller.FFMpeg
private static FFProbeResult Run(string input)
{
MediaBrowser.Common.Logging.Logger.LogInfo(input);
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = true;

@ -4,6 +4,7 @@ using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Common.Logging;
using MediaBrowser.Controller.Events;
using MediaBrowser.Controller.FFMpeg;
using MediaBrowser.Model.Entities;
@ -35,6 +36,12 @@ namespace MediaBrowser.Controller.Providers
private 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));
string bitrate = null;

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Common.Logging;
using MediaBrowser.Controller.Events;
using MediaBrowser.Controller.FFMpeg;
using MediaBrowser.Model.Entities;
@ -47,6 +48,12 @@ namespace MediaBrowser.Controller.Providers
private void Fetch(Video video, FFProbeResult data)
{
if (data == 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;

Loading…
Cancel
Save