Add prints
All checks were successful
Upload release / build (push) Successful in 40s

This commit is contained in:
Mylloon 2024-10-09 12:31:11 +02:00
parent cf9880281f
commit 4dd5fd95fe
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -18,8 +18,7 @@ function script_load()
long long last_input_received(void); long long last_input_received(void);
]] ]]
monitor = ffi.load(script_path() .. "monitor.dll") monitor = ffi.load(script_path() .. "monitor.dll")
start_loop()
obs.timer_add(check_restart, wait_time * 1000)
end end
function script_unload() function script_unload()
@ -28,9 +27,17 @@ function script_unload()
monitor.stop_hook() monitor.stop_hook()
end end
function start_loop()
print("Start idle")
obs.timer_add(check_restart, wait_time * 1000)
end
function check_restart() function check_restart()
obs.timer_remove(check_restart) obs.timer_remove(check_restart)
print("Start check every " .. idle_time .. "secs")
monitor.start_hook() monitor.start_hook()
obs.timer_add(check_idle, idle_time * 1000) obs.timer_add(check_idle, idle_time * 1000)
end end
@ -43,6 +50,7 @@ function check_idle()
if current_time - last_input_time >= idle_time then if current_time - last_input_time >= idle_time then
monitor.stop_hook() monitor.stop_hook()
print("No activity detected, restart replay buffer")
obs.obs_frontend_replay_buffer_stop() obs.obs_frontend_replay_buffer_stop()
obs.timer_add(start_replay_buffer, 2000) obs.timer_add(start_replay_buffer, 2000)
else else
@ -54,5 +62,5 @@ function start_replay_buffer()
obs.timer_remove(start_replay_buffer) obs.timer_remove(start_replay_buffer)
obs.obs_frontend_replay_buffer_start() obs.obs_frontend_replay_buffer_start()
obs.timer_add(check_restart, wait_time * 1000) start_loop()
end end