Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2024
2,381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. import obspython as obs
  2. from shutil import move
  3.  
  4. output_path1 = "D:/vods/anything-else"
  5. output_path2 = "D:/vods/bridges"
  6. output_path3 = "D:/vods/destiny-stream"
  7. output_path4 = "D:/vods/saturday-morning"
  8. search_string1 = "anythingelse"
  9. search_string2 = "bridges"
  10. search_string3 = "destinystudio"
  11. search_string4 = "saturdaymorning"
  12.  
  13.  
  14. def script_description():
  15. """Return the plugin description script."""
  16. return "This plugin moves the recorded file to another folder when the recording has stopped."
  17.  
  18.  
  19. def script_load(settings):
  20. """Hook stop recording signal on plugin load."""
  21. signal_handler = obs.obs_output_get_signal_handler(
  22. obs.obs_frontend_get_recording_output()
  23. )
  24. obs.signal_handler_connect(signal_handler, "stop", signal_handler_function)
  25.  
  26.  
  27. def script_update(settings):
  28. """Called on settings change. Update the output path accordingly."""
  29. global output_path1
  30. output_path1 = obs.obs_data_get_string(settings, "output_path1")
  31. global output_path2
  32. output_path2 = obs.obs_data_get_string(settings, "output_path2")
  33. global output_path3
  34. output_path3 = obs.obs_data_get_string(settings, "output_path3")
  35. global output_path4
  36. output_path4 = obs.obs_data_get_string(settings, "output_path4")
  37. global search_string1
  38. search_string1 = obs.obs_data_get_string(settings, "search_string1")
  39. global search_string2
  40. search_string2 = obs.obs_data_get_string(settings, "search_string2")
  41. global search_string3
  42. search_string3 = obs.obs_data_get_string(settings, "search_string3")
  43. global search_string4
  44. search_string4 = obs.obs_data_get_string(settings, "search_string4")
  45.  
  46.  
  47. def script_properties():
  48. """Specifying the output folder."""
  49. props = obs.obs_properties_create()
  50. output_path1
  51. obs.obs_properties_add_text(
  52. props, "search_string1", "Output (1) String", obs.OBS_TEXT_DEFAULT
  53. )
  54. obs.obs_properties_add_path(
  55. props, "output_path1", "Output (1) folder", obs.OBS_PATH_DIRECTORY, "", ""
  56. )
  57. output_path2
  58. obs.obs_properties_add_text(
  59. props, "search_string2", "Output (2) String", obs.OBS_TEXT_DEFAULT
  60. )
  61. obs.obs_properties_add_path(
  62. props, "output_path2", "Output (2) folder", obs.OBS_PATH_DIRECTORY, "", ""
  63. )
  64. output_path3
  65. obs.obs_properties_add_text(
  66. props, "search_string3", "Output (3) String", obs.OBS_TEXT_DEFAULT
  67. )
  68. obs.obs_properties_add_path(
  69. props, "output_path3", "Output (3) folder", obs.OBS_PATH_DIRECTORY, "", ""
  70. )
  71. output_path4
  72. obs.obs_properties_add_text(
  73. props, "search_string4", "Output (4) String", obs.OBS_TEXT_DEFAULT
  74. )
  75. obs.obs_properties_add_path(
  76. props, "output_path4", "Output (4) folder", obs.OBS_PATH_DIRECTORY, "", ""
  77. )
  78.  
  79. return props
  80.  
  81.  
  82. def signal_handler_function(calldata):
  83. """Handle record stop signal and move recording."""
  84. global output_path1
  85. global output_path2
  86. global output_path3
  87. global output_path4
  88. global search_string1
  89. global search_string2
  90. global search_string3
  91. global search_string4
  92.  
  93. try:
  94. if (
  95. search_string1 in obs.obs_frontend_get_last_recording()
  96. and search_string1 != ""
  97. ):
  98. move(obs.obs_frontend_get_last_recording(), output_path1)
  99. elif (
  100. search_string2 in obs.obs_frontend_get_last_recording()
  101. and search_string2 != ""
  102. ):
  103. move(obs.obs_frontend_get_last_recording(), output_path2)
  104. elif (
  105. search_string3 in obs.obs_frontend_get_last_recording()
  106. and search_string3 != ""
  107. ):
  108. move(obs.obs_frontend_get_last_recording(), output_path3)
  109. elif (
  110. search_string4 in obs.obs_frontend_get_last_recording()
  111. and search_string4 != ""
  112. ):
  113. move(obs.obs_frontend_get_last_recording(), output_path4)
  114. else:
  115. pass
  116.  
  117. except Exception as e:
  118. pass # OBS logs, pass error
  119.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement