Lua gurus, please help me.
I want a script that log URLs opened with mpv, and append if it worked or not.
I've tried asking AI to do and got this
local log_file = io.open("~/.config/mpv/mpv_urls.log", "a")
mp.add_hook("on_load", 50, function()
local path = mp.get_property("path")
if not path or not path:match("^https?://") then
return
end
local timestamp = os.date("%Y-%m-%d %H:%M:%S")
local log_entry = string.format("\n[%s] %s", timestamp, path)
-- Start a new line immediately
Comment too long. Click here to view the full text.