Render Ping

@rebind / render-pingv0.1.3Public

Watches your render's progress bar and pings your phone through ntfy.sh when it finishes.

Files

Older release. Installs get 0.1.3.

main.luau1.4 KB

-- Render Ping: watch a few pixels at the end of a progress bar and send a
-- notification through ntfy.sh to your phone when they turn the done color.

local cfg = UI.Schema({
  watch = UI.Keybind("F4", { label = "Watch the render" }),
  topic = UI.Text("my-renders", { label = "ntfy.sh topic" }),
  done = UI.Color("#3ddc84", { label = "Color when done" }),
})

local watcher = nil

Bind(cfg.watch, function()
  if watcher then
    watcher:Cancel()
    watcher = nil
    UI.Notify("Stopped watching", "info")
    return
  end
  local x, y = System.Mouse()
  local box = { x - 3, y - 3, x + 3, y + 3 }
  local color = cfg.done:gsub("^#", "")
  UI.Notify("Watching the render", "info")
  watcher = Run(function()
    local read, err = pcall(function()
      while not Screen.SearchForColor(box, color, 0.1) do
        Sleep(2000)
      end
    end)
    watcher = nil
    if not read then
      UI.Notify("Stopped watching: " .. tostring(err), "error")
      return
    end
    local ok, response =
      pcall(Net.Post, "https://ntfy.sh/" .. cfg.topic, "Your render is done")
    if ok and response.status >= 200 and response.status < 300 then
      UI.Notify("Render done", "success")
    else
      UI.Notify("Render done, but ntfy.sh did not take the message", "warning")
    end
  end)
end)

function OnStop()
  if watcher then
    watcher:Cancel()
  end
end

3 files, 3.3 KB.