Retry GetFrameCountCached up to 3x, clear cmd output caches on new file

This commit is contained in:
n00mkrad
2022-04-05 18:07:05 +02:00
parent dd98b02355
commit 483aa46ebb
7 changed files with 42 additions and 11 deletions

View File

@@ -9,7 +9,7 @@ namespace Flowframes.Media
{
class GetMediaResolutionCached
{
public static Dictionary<QueryInfo, Size> cache = new Dictionary<QueryInfo, Size>();
private static Dictionary<QueryInfo, Size> cache = new Dictionary<QueryInfo, Size>();
public static async Task<Size> GetSizeAsync(string path)
{
@@ -31,8 +31,11 @@ namespace Flowframes.Media
Size size;
size = await IoUtils.GetVideoOrFramesRes(path);
Logger.Log($"Adding hash with value {size} to cache.", true);
cache.Add(hash, size);
if(size.Width > 0 && size.Height > 0)
{
Logger.Log($"Adding hash with value {size} to cache.", true);
cache.Add(hash, size);
}
return size;
}
@@ -54,5 +57,10 @@ namespace Flowframes.Media
return new Size();
}
public static void Clear()
{
cache.Clear();
}
}
}