From aae259d2cd06dc59d279cf04b0f94a09d485cba0 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Mon, 20 Aug 2012 15:16:51 -0400 Subject: Initial check-in of VideoInfoProvider, although it's currently disabled. --- MediaBrowser.Controller/FFMpeg/FFProbe.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'MediaBrowser.Controller/FFMpeg') diff --git a/MediaBrowser.Controller/FFMpeg/FFProbe.cs b/MediaBrowser.Controller/FFMpeg/FFProbe.cs index fd9b2ff438..ea6bda6224 100644 --- a/MediaBrowser.Controller/FFMpeg/FFProbe.cs +++ b/MediaBrowser.Controller/FFMpeg/FFProbe.cs @@ -35,6 +35,28 @@ namespace MediaBrowser.Controller.FFMpeg } } + public async static Task Run(Video item, string outputCachePath) + { + // Use try catch to avoid having to use File.Exists + try + { + using (FileStream stream = File.OpenRead(outputCachePath)) + { + return JsonSerializer.DeserializeFromStream(stream); + } + } + catch (FileNotFoundException) + { + } + + await Run(item.Path, outputCachePath); + + using (FileStream stream = File.OpenRead(outputCachePath)) + { + return JsonSerializer.DeserializeFromStream(stream); + } + } + private async static Task Run(string input, string output) { ProcessStartInfo startInfo = new ProcessStartInfo(); -- cgit v1.2.3