diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-24 12:24:29 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-24 12:24:29 -0400 |
| commit | cc25bd579b820a91e436a358f38321d254c27451 (patch) | |
| tree | 0370b3de129933e9dda0bf5318d1d79c23ff4f2a /MediaBrowser.Controller/FFMpeg | |
| parent | 0a16aeb4483ca8241c781eb40a07942b46bc171c (diff) | |
Chaged BaseItem.People to a dictionary to prevent duplicates and improve Contains performance. Tweaked ffprobe and provider execution.
Diffstat (limited to 'MediaBrowser.Controller/FFMpeg')
| -rw-r--r-- | MediaBrowser.Controller/FFMpeg/FFProbe.cs | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/MediaBrowser.Controller/FFMpeg/FFProbe.cs b/MediaBrowser.Controller/FFMpeg/FFProbe.cs index 831ae50a3a..791f47b298 100644 --- a/MediaBrowser.Controller/FFMpeg/FFProbe.cs +++ b/MediaBrowser.Controller/FFMpeg/FFProbe.cs @@ -16,12 +16,14 @@ namespace MediaBrowser.Controller.FFMpeg /// <summary>
/// Runs FFProbe against an Audio file, caches the result and returns the output
/// </summary>
- public static FFProbeResult Run(Audio item)
+ public static FFProbeResult Run(BaseItem item, string cacheDirectory)
{
+ string cachePath = GetFFProbeCachePath(item, cacheDirectory);
+
// Use try catch to avoid having to use File.Exists
try
{
- return GetCachedResult(GetFFProbeCachePath(item));
+ return GetCachedResult(cachePath);
}
catch (FileNotFoundException)
{
@@ -34,7 +36,7 @@ namespace MediaBrowser.Controller.FFMpeg FFProbeResult result = Run(item.Path);
// Fire and forget
- CacheResult(result, GetFFProbeCachePath(item));
+ CacheResult(result, cachePath);
return result;
}
@@ -65,32 +67,6 @@ namespace MediaBrowser.Controller.FFMpeg }).ConfigureAwait(false);
}
- /// <summary>
- /// Runs FFProbe against a Video file, caches the result and returns the output
- /// </summary>
- public static FFProbeResult Run(Video item)
- {
- // Use try catch to avoid having to use File.Exists
- try
- {
- return GetCachedResult(GetFFProbeCachePath(item));
- }
- catch (FileNotFoundException)
- {
- }
- catch (Exception ex)
- {
- Logger.LogException(ex);
- }
-
- FFProbeResult result = Run(item.Path);
-
- // Fire and forget
- CacheResult(result, GetFFProbeCachePath(item));
-
- return result;
- }
-
private static FFProbeResult Run(string input)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
@@ -148,16 +124,9 @@ namespace MediaBrowser.Controller.FFMpeg (sender as Process).Dispose();
}
- private static string GetFFProbeCachePath(Audio item)
- {
- string outputDirectory = Path.Combine(Kernel.Instance.ApplicationPaths.FFProbeAudioCacheDirectory, item.Id.ToString().Substring(0, 1));
-
- return Path.Combine(outputDirectory, item.Id + "-" + item.DateModified.Ticks + ".pb");
- }
-
- private static string GetFFProbeCachePath(Video item)
+ private static string GetFFProbeCachePath(BaseItem item, string cacheDirectory)
{
- string outputDirectory = Path.Combine(Kernel.Instance.ApplicationPaths.FFProbeVideoCacheDirectory, item.Id.ToString().Substring(0, 1));
+ string outputDirectory = Path.Combine(cacheDirectory, item.Id.ToString().Substring(0, 1));
return Path.Combine(outputDirectory, item.Id + "-" + item.DateModified.Ticks + ".pb");
}
|
