diff options
| -rw-r--r-- | ar/.config/mpv/scripts/integrity-check.lua | 32 | ||||
| -rwxr-xr-x | ar/.local/bin/remaps | 2 |
2 files changed, 28 insertions, 6 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 diff --git a/ar/.local/bin/remaps b/ar/.local/bin/remaps index eb55dba..c19e56c 100755 --- a/ar/.local/bin/remaps +++ b/ar/.local/bin/remaps @@ -44,7 +44,7 @@ xinput list | grep 'id=' | while read -r line; do xinput set-prop "$mouse" "libinput Scroll Method Enabled" 0, 0, 1 ;; *) - [ -z "$1" ] && xinput set-prop "$mouse" "Coordinate Transformation Matrix" 5, 0, 0, 0, 5, 0, 0, 0, 1 || xinput set-prop "$mouse" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1 + [ -z "$1" ] && xinput set-prop "$mouse" "Coordinate Transformation Matrix" 3, 0, 0, 0, 3, 0, 0, 0, 1 || xinput set-prop "$mouse" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1 ;; esac } |
