alright I found the sweet spot where it deserves proper organization but not its own repo

ssshut up tho
This commit is contained in:
adam 2023-03-07 10:40:55 -05:00
parent 0ca006f234
commit f9f45cf1fc
5 changed files with 230 additions and 5 deletions

View File

@ -1,5 +0,0 @@
Q: but adam, I thought you utterly despised "organizing" by file type
A: yes, but this particular repo is "misc". if it needs *any* more organization, make it a repo. it's not hard.

65
obstwitch/q and a.html Normal file
View File

@ -0,0 +1,65 @@
<html>
<head>
<script type="text/javascript">
let trivial = [
{q:"are mechanical keyboards the best?", a:"yes"},
{q:"should adam not type on his mechanical keyboard while the microphone is like 6cm away?", a:"yessiree"}
];
let timeoutSeconds = 6;
let questionBox = null;
let answerBox = null;
let isOnQ = false;
let ccurrentpair = 0;
setTimeout(initial, 100);
function initial(){
questionBox = document.querySelector("#question");
answerBox = document.querySelector("#answer");
next();
setInterval(next, timeoutSeconds * 1000);
}
function next(){
if(!isOnQ){
isOnQ = true;
ccurrentpair = Math.floor(Math.random() * trivial.length);
console.log(trivial[ccurrentpair]);
questionBox.className = "hidden";
answerBox.className = "hidden";
questionBox.innerHTML = trivial[ccurrentpair].q;
answerBox.innerHTML = trivial[ccurrentpair].a;
setTimeout(() => {questionBox.className="display-normal";}, 100);
}
else{
isOnQ = false;
answerBox.className = "display-normal";
}
}
</script>
<style type="text/css">
body{
margin: 0px;
padding: 0px;
}
#prompt{
width:100%;
height: 100%;
font-size: xx-large;
font-weight: bold;
text-align: center;
font-family: 'Times New Roman', Times, serif;
}
.hidden{
display:none;
}
</style>
</head>
<body>
<div id="prompt">
<div id="question" class="hidden"></div>
<div id="answer" class="hidden"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,63 @@
obs = obslua
stop_target = ""
start_target = ""
pause_target = ""
function source_activated(cd)
local source = obs.calldata_source(cd, "source")
if source ~= nil then
local name = obs.obs_source_get_name(source)
if pause_target == name then
obs.obs_frontend_recording_pause(true)
elseif stop_target == name then
obs.obs_frontend_recording_stop()
elseif start_target == name then
obs.obs_frontend_recording_start()
end
end
end
function source_deactivated(cd)
local source = obs.calldata_source(cd, "source")
if source ~= nil then
local name = obs.obs_source_get_name(source)
if pause_target == name then
obs.obs_frontend_recording_pause(false)
end
end
end
function script_properties()
local props = obs.obs_properties_create()
local pStart = obs.obs_properties_add_list(props, "start_target", "start target", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING)
local pStop = obs.obs_properties_add_list(props, "stop_target", "stop target", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING)
local pPause = obs.obs_properties_add_list(props, "pause_target", "pause target", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING)
local sources = obs.obs_enum_sources()
if sources ~= nil then
for _, source in ipairs(sources) do
local name = obs.obs_source_get_name(source)
obs.obs_property_list_add_string(pStart, name, name)
obs.obs_property_list_add_string(pStop, name, name)
obs.obs_property_list_add_string(pPause, name, name)
end
end
obs.source_list_release(sources)
return props
end
function script_description()
return "start/stop recording when specified source is in active scene"
end
function script_update(settings)
stop_target = obs.obs_data_get_string(settings, "stop_target")
start_target = obs.obs_data_get_string(settings, "start_target")
pause_target = obs.obs_data_get_string(settings, "pause_target")
end
function script_load(settings)
local sh = obs.obs_get_signal_handler()
obs.signal_handler_connect(sh, "source_activate", source_activated)
obs.signal_handler_connect(sh, "source_deactivate", source_deactivated)
end

43
obstwitch/trivia.html Normal file
View File

@ -0,0 +1,43 @@
<html>
<head>
<script type="text/javascript">
let trivial = [
"Arnold Schwarzenegger earned $15 million for speaking a total of 700 words of dialogue — which breaks down to $21,429 per word. \"Hasta la vista, baby\"? earned $85,716.",
"the sun is also sometimes called the day moon.",
"in Jurassic Park, The giant Tyrannosaurus Rex occasionally malfunctioned when it rained. Producer Kathleen Kennedy recalls, \"The T. rex went into the heebie-jeebies sometimes. Scared the crap out of us. We'd be, like, eating lunch, and all of a sudden a T. rex would come alive. At first, we didn't know what was happening, and then we realized it was the rain. You'd hear people start screaming.\""
];
let timeoutSeconds = 15;
let isOnQ = false;
let ccurrentpair = 0;
setTimeout(() => {next(); setInterval(next, timeoutSeconds * 1000);}, 100);
function next(){
console.log(ccurrentpair);
let box = document.querySelector("#thebox");
ccurrentpair = Math.floor(Math.random() * trivial.length);
box.innerHTML = trivial[ccurrentpair];
}
</script>
<style type="text/css">
body{
margin: 0px;
padding: 0px;
}
#thebox{
width:100%;
height: 100%;
font-size: xx-large;
font-weight: bold;
font-family: 'Times New Roman', Times, serif;
text-align: center;
}
</style>
</head>
<body>
<div id="thebox">
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
import obspython as obs
import urllib.request
import urllib.error
from urllib import request, parse
import json
url = ""
body = ""
# ------------------------------------------------------------
def call_hook():
global url
global body
try:
data = json.dumps({"content": body})
data = str(data)
data = data.encode()
req = request.Request(url, data=data,method="POST",headers = {'Content-Type': 'application/json', 'User-Agent': 'curl/7.54.1'})
resp = request.urlopen(req)
except urllib.error.URLError as err:
obs.script_log(obs.LOG_WARNING, "Error opening URL '" + url + "': " + err.reason)
obs.remove_current_callback()
def testbutton_pressed(props, prop):
call_hook()
# ------------------------------------------------------------
def on_event(event):
if event == obs.OBS_FRONTEND_EVENT_STREAMING_STARTED:
call_hook()
def script_description():
return "posts basic text to a discord webhook when you go live\n\nBy AdamRGrey"
def script_load(settings):
obs.obs_frontend_add_event_callback(on_event)
def script_defaults(settings):
obs.obs_data_set_default_string(settings, "body", "hey I'm live! https://twitch.tv")
def script_update(settings):
global url
global body
url = obs.obs_data_get_string(settings, "url")
body = obs.obs_data_get_string(settings, "body")
def script_properties():
props = obs.obs_properties_create()
obs.obs_properties_add_text(props, "url", "URL", obs.OBS_TEXT_DEFAULT)
obs.obs_properties_add_text(props, "body", "body", obs.OBS_TEXT_DEFAULT)
obs.obs_properties_add_button(props, "button", "test", testbutton_pressed)
return props