ADD old file deletion in the stop command
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from rewind.video import save
|
from rewind.video import save, clean_old_ts_files
|
||||||
|
|
||||||
import obsws_python as obs
|
import obsws_python as obs
|
||||||
import sys, argparse
|
import sys, argparse
|
||||||
|
|
||||||
@@ -13,6 +12,7 @@ def start_recording(con):
|
|||||||
|
|
||||||
def stop_recording(con):
|
def stop_recording(con):
|
||||||
con.stop_record()
|
con.stop_record()
|
||||||
|
clean_old_ts_files(con.get_record_directory().record_directory, max_age_seconds=0)
|
||||||
print("Stopped recording")
|
print("Stopped recording")
|
||||||
|
|
||||||
def create_recording(con):
|
def create_recording(con):
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ def combine_ts_to_mp4(ts_files, output_file):
|
|||||||
for ts in ts_files:
|
for ts in ts_files:
|
||||||
f.write(f"file '{ts}'\n")
|
f.write(f"file '{ts}'\n")
|
||||||
|
|
||||||
subprocess.run(["ffmpeg", "-y", "-f", "concat", "-safe", "0", "-i", "file_list.txt", "-c", "copy", output_file])
|
subprocess.run(["ffmpeg", "-y",
|
||||||
|
"-f", "concat", "-safe", "0", "-i",
|
||||||
|
"file_list.txt",
|
||||||
|
"-c", "copy",
|
||||||
|
output_file])
|
||||||
|
|
||||||
os.remove("file_list.txt")
|
os.remove("file_list.txt")
|
||||||
|
|
||||||
def clean_old_ts_files(record_dir, max_age_seconds=60*60*3):
|
def clean_old_ts_files(record_dir, max_age_seconds=60*60*3):
|
||||||
|
|||||||
Reference in New Issue
Block a user