Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import obspython as obs
- from shutil import move
- output_path1 = "D:/vods/anything-else"
- output_path2 = "D:/vods/bridges"
- output_path3 = "D:/vods/destiny-stream"
- output_path4 = "D:/vods/saturday-morning"
- search_string1 = "anythingelse"
- search_string2 = "bridges"
- search_string3 = "destinystudio"
- search_string4 = "saturdaymorning"
- def script_description():
- """Return the plugin description script."""
- return "This plugin moves the recorded file to another folder when the recording has stopped."
- def script_load(settings):
- """Hook stop recording signal on plugin load."""
- signal_handler = obs.obs_output_get_signal_handler(
- obs.obs_frontend_get_recording_output()
- )
- obs.signal_handler_connect(signal_handler, "stop", signal_handler_function)
- def script_update(settings):
- """Called on settings change. Update the output path accordingly."""
- global output_path1
- output_path1 = obs.obs_data_get_string(settings, "output_path1")
- global output_path2
- output_path2 = obs.obs_data_get_string(settings, "output_path2")
- global output_path3
- output_path3 = obs.obs_data_get_string(settings, "output_path3")
- global output_path4
- output_path4 = obs.obs_data_get_string(settings, "output_path4")
- global search_string1
- search_string1 = obs.obs_data_get_string(settings, "search_string1")
- global search_string2
- search_string2 = obs.obs_data_get_string(settings, "search_string2")
- global search_string3
- search_string3 = obs.obs_data_get_string(settings, "search_string3")
- global search_string4
- search_string4 = obs.obs_data_get_string(settings, "search_string4")
- def script_properties():
- """Specifying the output folder."""
- props = obs.obs_properties_create()
- output_path1
- obs.obs_properties_add_text(
- props, "search_string1", "Output (1) String", obs.OBS_TEXT_DEFAULT
- )
- obs.obs_properties_add_path(
- props, "output_path1", "Output (1) folder", obs.OBS_PATH_DIRECTORY, "", ""
- )
- output_path2
- obs.obs_properties_add_text(
- props, "search_string2", "Output (2) String", obs.OBS_TEXT_DEFAULT
- )
- obs.obs_properties_add_path(
- props, "output_path2", "Output (2) folder", obs.OBS_PATH_DIRECTORY, "", ""
- )
- output_path3
- obs.obs_properties_add_text(
- props, "search_string3", "Output (3) String", obs.OBS_TEXT_DEFAULT
- )
- obs.obs_properties_add_path(
- props, "output_path3", "Output (3) folder", obs.OBS_PATH_DIRECTORY, "", ""
- )
- output_path4
- obs.obs_properties_add_text(
- props, "search_string4", "Output (4) String", obs.OBS_TEXT_DEFAULT
- )
- obs.obs_properties_add_path(
- props, "output_path4", "Output (4) folder", obs.OBS_PATH_DIRECTORY, "", ""
- )
- return props
- def signal_handler_function(calldata):
- """Handle record stop signal and move recording."""
- global output_path1
- global output_path2
- global output_path3
- global output_path4
- global search_string1
- global search_string2
- global search_string3
- global search_string4
- try:
- if (
- search_string1 in obs.obs_frontend_get_last_recording()
- and search_string1 != ""
- ):
- move(obs.obs_frontend_get_last_recording(), output_path1)
- elif (
- search_string2 in obs.obs_frontend_get_last_recording()
- and search_string2 != ""
- ):
- move(obs.obs_frontend_get_last_recording(), output_path2)
- elif (
- search_string3 in obs.obs_frontend_get_last_recording()
- and search_string3 != ""
- ):
- move(obs.obs_frontend_get_last_recording(), output_path3)
- elif (
- search_string4 in obs.obs_frontend_get_last_recording()
- and search_string4 != ""
- ):
- move(obs.obs_frontend_get_last_recording(), output_path4)
- else:
- pass
- except Exception as e:
- pass # OBS logs, pass error
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement