diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2024-05-12 02:26:35 +0200 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2024-05-12 20:06:39 +0200 |
commit | 0f7aab534aeb0233655223fbfcf4831cbbdb0501 (patch) | |
tree | 6342be545d12367fb7d5971abde52dcefcbce0c9 /TOOLS | |
parent | 885cc305964ae79f48b29cb2d8b364c868a39f79 (diff) | |
download | mpv-0f7aab534aeb0233655223fbfcf4831cbbdb0501.tar.bz2 mpv-0f7aab534aeb0233655223fbfcf4831cbbdb0501.tar.xz |
skip-logo.lua: fix some lint warnings
Diffstat (limited to 'TOOLS')
-rw-r--r-- | TOOLS/lua/skip-logo.lua | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/TOOLS/lua/skip-logo.lua b/TOOLS/lua/skip-logo.lua index ae66b22250..970cc288db 100644 --- a/TOOLS/lua/skip-logo.lua +++ b/TOOLS/lua/skip-logo.lua @@ -22,14 +22,14 @@ Example script-opts/skip-logo.conf: name = "black frame", -- print if matched skip = 10, -- number of seconds to skip forward score = 0.3, -- required score - fingerprint = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + fingerprint = string.rep("0", 512), }, { -- Skip ahead 20 seconds if a white frame was detected -- Note: this is dangerous non-sense. It's just for demonstration. name = "fun2", skip = 20, - fingerprint = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + fingerprint = string.rep("f", 512), }, } @@ -70,7 +70,6 @@ frames of a video. This could be fixed, but the author was too lazy to do so. --]] -local utils = require "mp.utils" local msg = require "mp.msg" local label = "skip-logo" @@ -121,8 +120,10 @@ end local function load_config() local conf_file = mp.find_config_file("script-opts/skip-logo.conf") local conf_fn - local err = nil + local err if conf_file then + -- luacheck: push + -- luacheck: ignore setfenv if setfenv then conf_fn, err = loadfile(conf_file) if conf_fn then @@ -131,12 +132,13 @@ local function load_config() else conf_fn, err = loadfile(conf_file, "t", config) end + -- luacheck: pop else err = "config file not found" end if conf_fn and (not err) then - local ok, err2 = pcall(conf_fn) + local _, err2 = pcall(conf_fn) err = err2 end @@ -146,7 +148,7 @@ local function load_config() if config.cases then for n, case in ipairs(config.cases) do - local err = nil + err = nil case.bitmap = hex_to_norm8(case.fingerprint) if case.bitmap == nil then err = "invalid or missing fingerprint field" @@ -241,7 +243,7 @@ mp.observe_property(meta_property, "native", function() read_frames() end) -mp.observe_property("seeking", "bool", function(name, val) +mp.observe_property("seeking", "bool", function(_, val) seeking = val if seeking == false then playback_start_pts = mp.get_property_number("playback-time") @@ -259,7 +261,7 @@ for _, f in ipairs(filters) do end if found then - mp.command(("no-osd vf add @%s:fingerprint"):format(label, filter)) + mp.command(("no-osd vf add @%s:fingerprint"):format(label)) else msg.warn("vf_fingerprint not found") end |