diff options
Diffstat (limited to 'TOOLS/lua/skip-logo.lua')
-rw-r--r-- | TOOLS/lua/skip-logo.lua | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/TOOLS/lua/skip-logo.lua b/TOOLS/lua/skip-logo.lua index 8e1f9da489..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" @@ -232,7 +234,7 @@ local function read_frames() end end -mp.observe_property(meta_property, "none", function() +mp.observe_property(meta_property, "native", function() -- Ignore frames that are decoded/filtered during seeking. if seeking then return @@ -241,7 +243,7 @@ mp.observe_property(meta_property, "none", 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 |