[Help] Python script OBS help needed [Additional Replay Buffer]

ikarycs

New Member
I'm trying to use this script to implement multiple replay buffer timers, so you can get the last 1, 5 or 10 minutes of your current gameplay depending on how you configure it. The script run good at the beginning when obs is being just launched, however after some 10 minutes or so, the script wont work anymore, and when u attempt to save a clip it says this in the log:

Code:
[AdditionalReplays.py] [AR] save_replay
[AdditionalReplays.py] [AR] seconds=180
[AdditionalReplays.py] [AR] path=D:/OBS_Recordings/Replays_New/medium_clips
[AdditionalReplays.py] [AR] remove=True
[AdditionalReplays.py] [AR] from_end=True
[AdditionalReplays.py] Traceback (most recent call last):
[AdditionalReplays.py]   File "C:/Anything/Programs/obs-studio/data/obs-plugins/frontend-tools/scripts\AdditionalReplays.py", line 157, in save_replay2
[AdditionalReplays.py]     save_replay(replay2_seconds, replay2_path, replay2_remove, replay2_from_end)
[AdditionalReplays.py]   File "C:/Anything/Programs/obs-studio/data/obs-plugins/frontend-tools/scripts\AdditionalReplays.py", line 185, in save_replay
[AdditionalReplays.py]     last_replay = save_and_get_last_replay()
[AdditionalReplays.py]   File "C:/Anything/Programs/obs-studio/data/obs-plugins/frontend-tools/scripts\AdditionalReplays.py", line 128, in save_and_get_last_replay
[AdditionalReplays.py]     file_timestamp = os.path.getctime(path)
[AdditionalReplays.py]   File "D:/Program Files/Python/Python36\lib\genericpath.py", line 65, in getctime
[AdditionalReplays.py]     return os.stat(filename).st_ctime
[AdditionalReplays.py] TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

I tried to solve the issue doing some research but my knowledge in code is very limited, but I suspect that the obspython.py is somewhat messing with the script but since I'm not a pro I can't detect where the issue is or if its easy to solve just by adding a few lines to the script itself.

Thanks for any help anyone could provide.
 

Attachments

  • 2022-07-15 02-10-49.txt
    193.5 KB · Views: 30

Suslik V

Active Member
If you know how to not mess up with tabs and spaces in python (indentation very important), then you may try to find the "def save_and_get_last_replay()" block and replace it with this changes:
Edit:
Python:
def save_and_get_last_replay():
    timestamp = time.time()
    obs.obs_frontend_replay_buffer_save()

    # Try to get the file timestamp 20 times, only then give up, interval 1 sec
    for i in range(20):
        path = get_last_replay()
        if path and os.path.isfile(path):
            file_timestamp = os.path.getctime(path)
            if file_timestamp < timestamp:
                path = None
            else:
                break
        sleep(1)

    return path

Maybe later the script will be updated by the author (fingers crossed). It has number of other mistakes too...
 
Last edited:

Suslik V

Active Member
What error in the log says?
Edit: I modified the code block above (it had mistake). But anyway, I cannot reproduce your issue with the script. More info needed.
 
Last edited:

ikarycs

New Member
What error in the log says?
Edit: I modified the code block above (it had mistake). But anyway, I cannot reproduce your issue with the script. More info needed.
man you are the best, the goat! tyvm :D
It is now working properly, I'm not pro but I dare to say that maybe the path issue was giving to the fact of me using my hdd for storage and not my ssd, in which the replay wasn't saved fast enough for obs to finish its code pathing report and send it back to the custom script maybe idk?
anyway tyvm :D
I will go the the main script forum and post ur code there and give you credit there too, for any other people that in the future will need this fix.
 
Top