Skip to content

Instantly share code, notes, and snippets.

@mitchelloharawild
Created May 3, 2024 09:03
Show Gist options
  • Save mitchelloharawild/cb0328aa7190f861838ef9327e0c7962 to your computer and use it in GitHub Desktop.
Save mitchelloharawild/cb0328aa7190f861838ef9327e0c7962 to your computer and use it in GitHub Desktop.
OBS Script: Launch shiny for python app while OBS is loaded
obs = obslua
function script_properties()
local props = obs.obs_properties_create()
obs.obs_properties_add_int(props, "port", "Port", 1000, 9999, 1)
obs.obs_properties_add_path(props, "path", "App path:", obs.OBS_PATH_FILE, "*", nil)
return props
end
function script_description()
return "Launch a shiny app\n\nv0.1 \n\nMade by Mitchell O'Hara-Wild"obs = obslua
function script_properties()
local props = obs.obs_properties_create()
obs.obs_properties_add_int(props, "port", "Port", 1000, 9999, 1)
obs.obs_properties_add_path(props, "path", "App path:", obs.OBS_PATH_FILE, "*", nil)
return props
end
function script_description()
return "Launch a shiny app while OBS is running. Works on Linux.\n\nv0.1 \n\nMade by Mitchell O'Hara-Wild"
end
function script_defaults(settings)
obs.obs_data_set_default_int(settings, "port", 8000)
obs.obs_data_set_default_string(settings, "stop_text", "Starting soon (tm)")
end
function script_load(settings)
local port = obs.obs_data_get_int(settings, "port")
local path = obs.obs_data_get_string(settings, "path")
os.execute("shiny run " .. path .. " -p " .. port .. " &\n echo $! > /tmp/shiny_pid")
end
function script_unload()
os.execute("kill `cat /tmp/shiny_pid`")
end
end
function script_defaults(settings)
obs.obs_data_set_default_int(settings, "port", 8000)
obs.obs_data_set_default_string(settings, "stop_text", "Starting soon (tm)")
end
function script_load(settings)
local port = obs.obs_data_get_int(settings, "port")
local path = obs.obs_data_get_string(settings, "path")
os.execute("shiny run " .. path .. " -p " .. port .. " &\n echo $! > /tmp/shiny_pid")
end
function script_unload()
os.execute("kill `cat /tmp/shiny_pid`")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment