jiimjaam
New Member
I recently designed a bunch of different BRB/Ending videos for my stream, and I wanted to write a script that would modify a Media Source by picking a random file from a directory and assigning that file to said Media Source. I have the script that picks a random video and it works fine, but I have no idea how to implement it with OBS's Python functions. Basically, I have 3 scenes: Main, BRB, and Ending. I would like to run the script every time I switch to the Main scene, causing the BRB and Ending screens to be randomized the next time I switch to them.
Here's the Python I have so far to pick the files randomly:
Sorry if this is the wrong subforum to post this on! I've been using OBS for a while but I'm new to its more advanced features.
Here's the Python I have so far to pick the files randomly:
Python:
import os, random
import obspython as obs
def list_full_paths(directory):
return [os.path.join(directory, file) for file in os.listdir(directory)]
brb = random.choice(list_full_paths("E:\\Streaming\\Bumpers\\BRB"))
end = random.choice(list_full_paths("E:\\Streaming\\Bumpers\\Ending"))
Sorry if this is the wrong subforum to post this on! I've been using OBS for a while but I'm new to its more advanced features.