aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/FFMpeg
diff options
context:
space:
mode:
authorLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-08-20 15:16:51 -0400
committerLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-08-20 15:16:51 -0400
commitaae259d2cd06dc59d279cf04b0f94a09d485cba0 (patch)
treee232a2ed1a2e6e3f7a51d5f8c5783b099abc784a /MediaBrowser.Controller/FFMpeg
parent8f024e81996b14a9e6a440a601d0f6c0694f7ab8 (diff)
Initial check-in of VideoInfoProvider, although it's currently disabled.
Diffstat (limited to 'MediaBrowser.Controller/FFMpeg')
-rw-r--r--MediaBrowser.Controller/FFMpeg/FFProbe.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/FFMpeg/FFProbe.cs b/MediaBrowser.Controller/FFMpeg/FFProbe.cs
index fd9b2ff43..ea6bda622 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<FFProbeResult> 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<FFProbeResult>(stream);
+ }
+ }
+ catch (FileNotFoundException)
+ {
+ }
+
+ await Run(item.Path, outputCachePath);
+
+ using (FileStream stream = File.OpenRead(outputCachePath))
+ {
+ return JsonSerializer.DeserializeFromStream<FFProbeResult>(stream);
+ }
+ }
+
private async static Task Run(string input, string output)
{
ProcessStartInfo startInfo = new ProcessStartInfo();