RedditVideoMakerBot icon indicating copy to clipboard operation
RedditVideoMakerBot copied to clipboard

Change video name instead of overwriting the existing video?

Open Goodgamer78 opened this issue 4 years ago • 15 comments

Hey, I've made a script to auto run the process. It can make a bunch of videos and is fully automatic. I'd like to have it be fully automatic although the existing video gets overwritten. Is there any way to have the video name change itself after completing so it won't overwrite it?

Goodgamer78 avatar Jun 01 '22 21:06 Goodgamer78

sure. in final_video.py L57 thats where the file name is picked just replace final_video with {os.getenv("POST_ID")} and in askreddit.py just add os.environ["POST_ID"] = str(submission) after L26

JasonLovesDoggo avatar Jun 02 '22 02:06 JasonLovesDoggo

then the file name would be the Reddit post's ID (you can also replace submission with submission.title if you want the posts title instead of the id)

JasonLovesDoggo avatar Jun 02 '22 02:06 JasonLovesDoggo

or even easier but lame imo replace

 final.write_videofile(
        "assets/final_video.mp4", fps=30, audio_codec="aac", audio_bitrate="192k"
    )

with

 final.write_videofile(
        f"assets/{len(os.listdir('./assets'))}.mp4", fps=30, audio_codec="aac", audio_bitrate="192k"

and the file names will be like 1.mp4, 2.mp4......

JasonLovesDoggo avatar Jun 02 '22 02:06 JasonLovesDoggo

I tried with the reddit post name but I get the below error:

Traceback (most recent call last): File "C:\r\main.py", line 22, in <module> final_video = make_final_video(number_of_comments) File "C:\r\video_creation\final_video.py", line 57, in make_final_video f"assets/{len(os.listdir('./assets'))}.mp4", fps=30, audio_codec="aac", audio_bitrate="192k" NameError: name 'os' is not defined

FluffyUnicorn111 avatar Jun 02 '22 11:06 FluffyUnicorn111

You have to import OS

JasonLovesDoggo avatar Jun 02 '22 12:06 JasonLovesDoggo

what do you mean by import os ? sorry im kinda new haha

realdav2 avatar Jun 02 '22 15:06 realdav2

At the top of the file type Import os

JasonLovesDoggo avatar Jun 02 '22 15:06 JasonLovesDoggo

oh perfect thank you seems to work although I am stugeling to get find an outrun solution like every 10 min or when its complete any idea on that ? Thanks in advance

realdav2 avatar Jun 02 '22 16:06 realdav2

please clarify

JasonLovesDoggo avatar Jun 02 '22 16:06 JasonLovesDoggo

I mean if you might have an idea how to implement an end of autorun so every time it completes a video it directly starts a new one

realdav2 avatar Jun 02 '22 17:06 realdav2

you could add os.system('python main.py') at the bottom of the main.py file in the if main block

JasonLovesDoggo avatar Jun 02 '22 17:06 JasonLovesDoggo

oh shit thx ill try it out later

realdav2 avatar Jun 02 '22 17:06 realdav2

oh shit thx ill try it out later

realdav2 avatar Jun 02 '22 17:06 realdav2

oh perfect thank you seems to work although I am stugeling to get find an outrun solution like every 10 min or when its complete any idea on that ? Thanks in advance

Where exactly did you put the Import OS command Im also very new to this Update fixed it

Marc0tics avatar Jun 03 '22 17:06 Marc0tics

Hi @Goodgamer78,

I hope you were able to resolve your issue as there has not been activity in this Issue, I will be closing this for the time being. Feel free to re-open the issue if it has not been solved!!

Happy Coding!

FreebieII avatar Jun 06 '22 18:06 FreebieII