Skip to content

Commit

Permalink
Implements #13
Browse files Browse the repository at this point in the history
Fixes #15
Implements #16
  • Loading branch information
JakubKoralewski committed Feb 16, 2024
1 parent 7957176 commit 9d6cc22
Showing 1 changed file with 44 additions and 23 deletions.
67 changes: 44 additions & 23 deletions scripts/cursor_recorder_for_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,15 @@ def install_pip_then_multiple(packages):
def install(c: List, name: str = ""):
logger.info(name)
p = Popen(
' '.join(c),
c,
stdout=PIPE,
stderr=PIPE,
stdin=PIPE,
executable=py_interpreter,
cwd=py_dir
)
print(p.args)
print(py_dir, c)
out, err = p.communicate()
if len(err) != 0:
logging.error(f"{name} Error:\n {err}")
logging.info(f"{name} Output:\n {out}")
logging.info(f"{name=} {out=} {err=} {p.returncode=}")

cmd_line_update = [
PY_EXECUTABLE, '-m', 'pip', 'install', '--upgrade', 'pip', '--user'
Expand All @@ -95,24 +92,19 @@ def install(c: List, name: str = ""):


def install_modules_button_click(*args):
install_pip_then_multiple(['pyautogui', 'keyboard'])
install_pip_then_multiple(['pyautogui'])


try:
import pyautogui
import keyboard
except ModuleNotFoundError:
logger.error("PyAutoGui and or keyboard are not installed.\n\
I'm installing them for you if you don't mind.\n")
install_pip_then_multiple(['pyautogui', 'keyboard'])
install_pip_then_multiple(['pyautogui'])
import pyautogui
import keyboard


def save_to_file(seconds: float, x: int, y: int):
full_path = os.path.join(path, name) if path and name else "cursor-recorder.txt"
logger.info(f'Saving file to {full_path}')

if not file.closed:
file.write(f'{round(seconds, 3)} {x} {y}\n')

Expand Down Expand Up @@ -170,7 +162,8 @@ def cursor_recorder():
"""
Recording of cursor that takes place from custom_fps option. Started in handler of start of recording.
"""
refresh_rate = 1 / cached_settings["custom_fps"]
custom_fps = cached_settings["custom_fps"]
refresh_rate = 1 / custom_fps
def should_exit():
"""
Whether cursor_recorder should exit in a given iteration.
Expand All @@ -187,6 +180,7 @@ def should_exit():
skipping = False

start_time: float = time.time()
print(f"{refresh_rate=} {start_time=} {custom_fps=}")

while True:
time.sleep(refresh_rate)
Expand Down Expand Up @@ -260,16 +254,17 @@ def recording_start_handler(_):
if cached_settings["use_default_fps"]:
init_tick_globals()

# Only set is_being_recorder after the path and name have been set so that the script_tick saves to correct file from the start
global is_being_recorded
if not cached_settings["use_default_fps"] and not is_being_recorded:
is_being_recorded = True
logger.info('Starting recording using custom FPS settings.')
threading.Thread(target=cursor_recorder).start()

# Only set is_being_recorder after the path and name have been set so that the script_tick saves to correct file from the start
is_being_recorded = True
global CUSTOM_FPS_SHOULD_EXIT
CUSTOM_FPS_SHOULD_EXIT = False

if not cached_settings["use_default_fps"]:
logger.info('Starting recording using custom FPS settings.')
threading.Thread(target=cursor_recorder).start()


def recording_stopped_handler(_):
"""
Expand All @@ -287,8 +282,8 @@ def recording_stopped_handler(_):

def script_description():
logger.debug('script_description')
return '<h1>OBS Cursor Recorder</h1><b>Lets you save your cursor movement to a file.</b>' \
'<br/><br/>©2019 Jakub Koralewski. ' \
return '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAigUlEQVR42uxbBZTcRra9UuMweUxZjyGMYGaHmUzhmMK4BGEG01LgbJiZmelsmDlmZoRBD7Xq33dO9fH7WkkzE6aXc1NqdWksvVsPS43f5Df5puJEwFVwIvCbfEMJUnZMIW6RCIOaE4sg7CcnsZ8gCa4eFQkOYSw8dawVayyg/kaiRVLs8W+EhLscGT1B1jpyc3NLL7zwwm4TJkzY9qSTTtqJ6H3KKacMOPnkkweceuqpfU844YReY8eO3fGII47Y8tBDD60YNGhQu/z8/Jxp06ZlFIHZZ074SNfi/JpdkqsUFFcKK7nlllt6f/DBB8cuXrx4yvr165+pq6v7vKGhYWlzc3OtaUE4x2tsbNxQW1s7v6qq6v1ly5Y98Nlnn134wAMPjDzyyCN3AlBG5BG5RL4dUz5rcn5FRNg4oFbqdttt1/Gll146cOnSpVNqamrepULXmu9BSNKCFStWPPfRRx+dM3HixN0AdL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g0JO6mXGKJJaYHODPB+E5GT20YUGqMmI39GfQt8m7v4znub0ES3kcn05fVTefN7jAAEJgOjfctA/FPAaQMjGzM0GJrd7DHMjpSFxMgLTMeXNIJUFc8Dj4bE+puJKinYThVB6pKA8C6+CB6xBSdoL5woX/9HgQp+AqbRl/j5n/78MMPfyN15NI/Yg+Cd2V1/OcDEgHjjH+bUWnitkDd8cgYZ1g4BUMjiUlQMryzLuTUBqC4wD7pjmwNMJmfdZIdADawI4dA/PsAiUcatjhbIwDaHLeKHbBhjo1sJCFmJwliD8R/ARBRLgAkkPzr7DgahdrlgLHHWj0g/BcBic/H3ujiY2zjBJcDxoOVeg7CEMrigsR4bgk4Ox5CzQdN/M+l/wH9YIsbuUQfHgAAAABJRU5ErkJggg== "/><h1>OBS Cursor Recorder</h1><b>Lets you save your cursor movement to a file.</b>' \
'<br/><br/>©2019-2024 Jakub Koralewski. ' \
'<a href="' \
'https://github.com/JakubKoralewski/cursor-recorder-for-afterfx"' \
'target="_blank">Open-source on GitHub.</a> <hr />'
Expand All @@ -298,16 +293,42 @@ def script_properties():
logger.debug('script_properties')
props = obs.obs_properties_create()
enabled = obs.obs_properties_add_bool(props, "enabled", "Enabled")
obs.obs_property_set_long_description(enabled, "Whether to save the file when recording or not.")
obs.obs_property_set_long_description(enabled, "Whether to save the cursor recorder file when recording or not.")

long_default_fps_description = "Use this option to achieve higher accuracy than every video frame."
long_default_fps_description = "Use this option to achieve higher accuracy than every video frame (larger than video fps) or to save text file space (lower than video fps)."

default_fps = obs.obs_properties_add_bool(props, "use_default_fps", "Use video's FPS to capture cursor")
obs.obs_property_set_long_description(default_fps, long_default_fps_description)

custom_fps = obs.obs_properties_add_int_slider(props, "custom_fps", "Custom FPS", 1, 200, 1)
obs.obs_property_set_long_description(custom_fps, long_default_fps_description)

default_fps_enabled = cached_settings.get("use_default_fps", True)
obs.obs_property_set_enabled(custom_fps, not default_fps_enabled)

def on_default_fps_clicked(props, prop, settings):
default_fps_enabled = obs.obs_data_get_bool(settings, "use_default_fps")
print(f"on_default_fps_clicked {default_fps_enabled=}")
obs.obs_property_set_enabled(custom_fps, not default_fps_enabled)
return True

obs.obs_property_set_modified_callback(default_fps, on_default_fps_clicked)

def on_enabled_clicked(props, prop, settings):
enabled = obs.obs_data_get_bool(settings, "enabled")
default_fps_enabled = obs.obs_data_get_bool(settings, "use_default_fps")
if enabled:
obs.obs_property_set_enabled(custom_fps, not default_fps_enabled)
else:
obs.obs_property_set_enabled(custom_fps, False)

obs.obs_property_set_enabled(default_fps, enabled)

return True


obs.obs_property_set_modified_callback(enabled, on_enabled_clicked)

install_modules = obs.obs_properties_add_button(
props,
"install_modules",
Expand Down

0 comments on commit 9d6cc22

Please sign in to comment.