summaryrefslogtreecommitdiff
path: root/ar/.config/mpv/scripts/integrity-check.lua
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-06-20 19:14:06 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-06-20 19:14:06 +0900
commitcdfd5173b20c8166e6a2199df74b3dd0447fbd6b (patch)
tree2be8a1b836c5c27b355f870dd8cbf1d032f6b58f /ar/.config/mpv/scripts/integrity-check.lua
parent2dace6a64ceda809ad0b466f7317989a81cb3514 (diff)
modified scripts/integrity-check.lua, modified bin/remaps
Diffstat (limited to 'ar/.config/mpv/scripts/integrity-check.lua')
-rw-r--r--ar/.config/mpv/scripts/integrity-check.lua32
1 files changed, 27 insertions, 5 deletions
diff --git a/ar/.config/mpv/scripts/integrity-check.lua b/ar/.config/mpv/scripts/integrity-check.lua
index 672cf4e..a15ca9f 100644
--- a/ar/.config/mpv/scripts/integrity-check.lua
+++ b/ar/.config/mpv/scripts/integrity-check.lua
@@ -6,7 +6,7 @@
-- * Checking starts on the "scan" key (script-message integrity-scan), or
-- automatically on file open if scan_on_load=yes. ffmpeg demux runs in the
-- background, so playback continues.
--- * Abort on the first error with -xerror -> corrupt files are judged quickly.
+-- * Reads the whole file; benign muxer warnings (e.g. duplicate DTS) are ignored.
-- * Results are cached by path + mtime -> the same file shows instantly next time.
-- * Corrupt file paths are recorded in corrupted.log.
-- * If a playlist exists (scan_playlist), after the current file is checked,
@@ -209,7 +209,7 @@ local function build_args(path, read_rate, progfile)
args[#args + 1] = v
end
end
- add(opts.ffmpeg, "-hide_banner", "-v", "error", "-xerror")
+ add(opts.ffmpeg, "-hide_banner", "-v", "error")
if read_rate and read_rate > 0 then
add("-readrate", tostring(read_rate), "-readrate_initial_burst", tostring(opts.bg_read_burst or 30))
end
@@ -248,11 +248,33 @@ local function apply_result(path, corrupt, from_cache)
end
end
--- Convert the subprocess result into a corrupt/ok verdict
+-- Muxer-side complaints that don't indicate a damaged file (false positives).
+-- e.g. duplicate/non-monotonic audio DTS, common in recordings; plays fine.
+local BENIGN_PATTERNS = {
+ "non monotonically increasing dts",
+ "Application provided invalid",
+ "Last message repeated", -- ffmpeg log de-dup line (summarizes a prior, often benign, message)
+}
+
+-- Convert the subprocess result into a corrupt/ok verdict. A file is corrupt
+-- only if a real (non-benign) error line was logged.
local function determine_corrupt(result)
local stderr = result.stderr or ""
- local status = result.status or 0
- return (stderr:gsub("%s+", "") ~= "") or (status ~= 0)
+ for line in (stderr .. "\n"):gmatch("([^\n]*)\n") do
+ if line:gsub("%s+", "") ~= "" then
+ local benign = false
+ for _, pat in ipairs(BENIGN_PATTERNS) do
+ if line:find(pat, 1, true) then
+ benign = true
+ break
+ end
+ end
+ if not benign then
+ return true
+ end
+ end
+ end
+ return false
end
-- Return the cache entry if it matches the file's current mtime/size