From 2dace6a64ceda809ad0b466f7317989a81cb3514 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sat, 20 Jun 2026 14:07:44 +0900 Subject: modified scripts/integrity-check.lua --- ar/.config/mpv/scripts/integrity-check.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ar') 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) -- cgit v1.2.3