diff options
Diffstat (limited to 'MediaBrowser.Controller/FFMpeg/FFProbe.cs')
| -rw-r--r-- | MediaBrowser.Controller/FFMpeg/FFProbe.cs | 22 |
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();
|
