summaryrefslogtreecommitdiff
path: root/ar/.config
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-06-20 14:07:44 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-06-20 14:07:44 +0900
commit2dace6a64ceda809ad0b466f7317989a81cb3514 (patch)
tree297dde42bf2e17adc845fc6180708a0aecfc776f /ar/.config
parent9f70c04731c50875c4fcc9f8665e7791663e5769 (diff)
modified scripts/integrity-check.lua
Diffstat (limited to 'ar/.config')
-rw-r--r--ar/.config/mpv/scripts/integrity-check.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/ar/.config/mpv/scripts/integrity-check.lua b/ar/.config/mpv/scripts/integrity-check.lua
index 6165d77..672cf4e 100644
--- a/ar/.config/mpv/scripts/integrity-check.lua
+++ b/ar/.config/mpv/scripts/integrity-check.lua
@@ -284,6 +284,18 @@ local function load_dur_cache()
f:close()
end
+-- Rewrite DUR_FILE keeping only the latest entry per path (drops duplicates).
+local function compact_dur_cache()
+ local f = io.open(DUR_FILE, "w")
+ if not f then
+ return
+ end
+ for path, e in pairs(dur_cache) do
+ f:write(string.format("%d\t%d\t%s\t%s\n", e.mtime or 0, e.size or 0, e.dur, path))
+ end
+ f:close()
+end
+
-- Return a cached duration if it matches the file's current mtime/size.
local function cached_duration(path)
local e = dur_cache[path]
@@ -821,4 +833,5 @@ mp.register_script_message("integrity-status", status)
load_cache()
compact_cache()
load_dur_cache()
+compact_dur_cache()
mp.register_event("file-loaded", on_file_loaded)