Closed jquyatt closed 1 month ago
For some additional context, this is the luascript I used in my config in Hammerspoon when I had the automation set up previously:
-- Define ProPresenter API settings
local propresenter_ip = "192.168.1.100" -- Replace with your ProPresenter IP
local propresenter_port = "12345" -- Replace with your ProPresenter Port
local propresenter_password = "your_password" -- Replace with your ProPresenter Remote password
-- Function to send API requests to ProPresenter
local function sendProPresenterCommand(endpoint)
local url = string.format("http://%s:%s/v1/%s", propresenter_ip, propresenter_port, endpoint)
hs.http.asyncGet(url, {Authorization = "Basic " .. hs.base64.encode(":" .. propresenter_password)}, function(status, body, headers)
if status == 200 then
hs.alert.show("Command Sent: " .. endpoint)
elseif status == 204 then
-- Do nothing, because 204 means success with no content
else
hs.alert.show("Error: " .. status)
end
end)
end
-- Bind F19 and F20 to ProPresenter actions
hs.hotkey.bind({}, "F19", function()
sendProPresenterCommand("presentation/slide/next")
end)
hs.hotkey.bind({}, "F20", function()
sendProPresenterCommand("presentation/slide/previous")
end)
Here is the current "documentation": https://github.com/ChurchApps/FreeShow/blob/main/src/frontend/components/actions/api.ts I'll see if there is time to make a better page sometime.
I'm sure you can integrate it with Hammerspoon. You can also automate the controlling with MIDI signals.
I see the use is not very clear, but it works with WebSocket (that's what Bitfocus Companion uses).
And REST commands, a POST with a request body like this:
{action: "ACTION_ID", (additional data like id, index, value, etc.)}
E.g. {action: "index_select_slide", index: 2}
Port set in settings: http://localhost:5505
I think I can add a check for this to REST as well:
?action=ACTION_ID
E.g. ?action=index_select_slide&data={"index":2}
This should help: https://www.npmjs.com/package/freeshow-api
Not final, but this can be used for testing: https://github.com/vassbo/freeshow-api/blob/main/tests/index.html
I was able to get some commands sent through, but after sending 5-10 commands, it stops responding to them. Hammerspoon console tells me this:
2024-09-27 21:26:41: Failed to trigger previous slide. Status: -1
While I'm waiting for FreeShow to respond to those commands, I used the test script from freeshow-api, and it successfully sends two Next Slide commands.
Attaching the log file if that helps. error_log jquyatt 240927.txt
Thanks. I managed to fix a different issue I saw in your error log.
Looking into it, the HTTP request never received a response causing the browser to cap at 6 requests, so I added a timeout for that. I'm not sure you have the same issue, but make sure the request from Hammerspoon is properly closed/timed out & not cached in any way.
Describe the feature I would like to be able to have a Web UI that shows me all the API endpoints for FreeShow, including being able to test commands. It could be modeled off of the page for ProPresenter: https://openapi.propresenter.com
Additional context I run AV for a corporate events venue and I am frequently running slide decks where the presenter is using a clicker to progress through slides. It is ideal for me to leave the focus of my presentation software while I'm working, so while I was using ProPresenter, I was using Karabiner Elements to intercept next/previous clicks from the clicker and convert them to keypresses for F19 and F20. Then, I used Hammerspoon to look for those keystrokes and trigger ProPresenter API events for next/previous slide. This enabled me to focus on other windows on my machine and still enable clicker commands to be sent to ProPresenter.
I'm essentially looking to recreate this functionality in FreeShow. I don't know if it would be feasible to make this a direct integration where you can select your clicker device and accept those signals regardless of window focus, but having the API Endpoints available would allow me to recreate this now.
Thank you so much for your development!