0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00

TOOLS/command-test.lua: fix lint warnings

This commit is contained in:
Guido Cella 2024-05-27 23:05:39 +02:00 committed by Kacper Michajłow
parent 843161d96e
commit f3f77353f2
2 changed files with 13 additions and 9 deletions

View File

@ -110,7 +110,6 @@ max_line_length = 100
-- TODO: Remove everything below this line
local todo = {
"player/lua/osc.lua",
"TOOLS/lua/command-test.lua",
"TOOLS/lua/cycle-deinterlace-pullup.lua",
"TOOLS/lua/nan-test.lua",
"TOOLS/lua/observe-all.lua",

View File

@ -2,7 +2,7 @@
local utils = require("mp.utils")
function join(sep, arr, count)
local function join(sep, arr, count)
local r = ""
if count == nil then
count = #arr
@ -31,19 +31,19 @@ mp.observe_property("vo-configured", "bool", function(_, v)
mp.set_property("screenshot-format", "png")
mp.set_property("screenshot-png-compression", "9")
timer = mp.add_periodic_timer(0.1, function() print("I'm alive") end)
local timer = mp.add_periodic_timer(0.1, function() print("I'm alive") end)
timer:resume()
print("Slow screenshot command...")
res = mp.command_native({"screenshot"})
print("done, res: " .. utils.to_string(res))
local result = mp.command_native({"screenshot"})
print("done, res: " .. utils.to_string(result))
print("Slow screenshot async command...")
res = mp.command_native_async({"screenshot"}, function(res)
result = mp.command_native_async({"screenshot"}, function(res)
print("done (async), res: " .. utils.to_string(res))
timer:kill()
end)
print("done (sending), res: " .. utils.to_string(res))
print("done (sending), res: " .. utils.to_string(result))
print("Broken screenshot async command...")
mp.command_native_async({"screenshot-to-file", "/nonexistent/bogus.png"},
@ -51,7 +51,11 @@ mp.observe_property("vo-configured", "bool", function(_, v)
print("done err scr.: " .. join(" ", {res, val, err}))
end)
mp.command_native_async({name = "subprocess", args = {"sh", "-c", "echo hi && sleep 10s"}, capture_stdout = true},
mp.command_native_async({
name = "subprocess",
args = {"sh", "-c", "echo hi && sleep 10s"},
capture_stdout = true
},
function(res, val, err)
print("done subprocess: " .. join(" ", {res, val, err}))
end)
@ -105,7 +109,8 @@ mp.observe_property("vo-configured", "bool", function(_, v)
playback_only = false, args = {"sleep", "inf"}})
end)
function freeze_test(playback_only)
local counter
local function freeze_test(playback_only)
-- This "freezes" the script, should be killed via timeout.
counter = counter and counter + 1 or 0
print("freeze! " .. counter)