From 1c55d749a3d609386a06bb2be84542794f9f3812 Mon Sep 17 00:00:00 2001 From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com> Date: Thu, 5 May 2022 18:10:34 -0500 Subject: [PATCH] Allow caching fpcalc results Probably only useful during development, when the same files are being fingerprinted repeatedly --- .../Configuration/PluginConfiguration.cs | 32 +------ .../Configuration/configPage.html | 46 +++------- .../FPCalc.cs | 89 +++++++++++++++++++ .../Plugin.cs | 82 ++++++++++++++--- .../ScheduledTasks/FingerprinterTask.cs | 2 +- 5 files changed, 174 insertions(+), 77 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs index e42540b..3508a90 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs @@ -16,38 +16,10 @@ public class PluginConfiguration : BasePluginConfiguration /// public PluginConfiguration() { - AnalysisResults = new Collection(); } /// - /// Save timestamps to disk. + /// If the output of fpcalc should be cached to the filesystem. /// - public void SaveTimestamps() - { - AnalysisResults.Clear(); - - foreach (var intro in Plugin.Instance!.Intros) - { - AnalysisResults.Add(intro.Value); - } - - Plugin.Instance!.SaveConfiguration(); - } - - /// - /// Restore previous analysis results from disk. - /// - public void RestoreTimestamps() - { - // Since dictionaries can't be easily serialized, analysis results are stored on disk as a list. - foreach (var intro in AnalysisResults) - { - Plugin.Instance!.Intros[intro.EpisodeId] = intro; - } - } - - /// - /// Previous analysis results. - /// - public Collection AnalysisResults { get; private set; } + public bool CacheFingerprints { get; set; } } diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html index 261d42a..d5a0520 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html @@ -8,29 +8,17 @@
-
-
- - -
-
- - -
A Description
-
+
-
-
- - -
Another Description
+ +
+ If checked, will store the fingerprints for all subsequently scanned files to disk. + Caching fingerprints avoids having to re-run fpcalc on each file, at the expense of disk usage. +