RENAME "clip" option to "save"
Clips refer to short recordings, this command can save much longer recordings, therefore "save" is more appropriate
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
from datetime import datetime
|
||||
from rewind.video import clip
|
||||
from rewind.video import save
|
||||
|
||||
import obsws_python as obs
|
||||
import sys, argparse
|
||||
@@ -15,10 +15,10 @@ def stop_recording(con):
|
||||
con.stop_record()
|
||||
print("Stopped recording")
|
||||
|
||||
def create_clip(con):
|
||||
def create_recording(con):
|
||||
record_dir = con.get_record_directory()
|
||||
output_file_name = f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}.mp4"
|
||||
clip(record_dir.record_directory, output_file_name)
|
||||
save(record_dir.record_directory, output_file_name)
|
||||
print(f"Created clip: {output_file_name}")
|
||||
|
||||
def build_parser():
|
||||
@@ -31,7 +31,7 @@ def build_parser():
|
||||
|
||||
sub.add_parser("start", help="Start OBS recording")
|
||||
sub.add_parser("stop", help="Stop OBS recording")
|
||||
sub.add_parser("clip", help="Create a clip from the current recording")
|
||||
sub.add_parser("save", help="Save a section from the current recording")
|
||||
|
||||
return parser
|
||||
|
||||
@@ -46,8 +46,8 @@ def main(argv=None):
|
||||
start_recording(con)
|
||||
elif args.command == "stop":
|
||||
stop_recording(con)
|
||||
elif args.command == "clip":
|
||||
create_clip(con)
|
||||
elif args.command == "save":
|
||||
create_recording(con)
|
||||
else:
|
||||
parser.error("Unknown command")
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ def clean_old_ts_files(record_dir, max_age_seconds=60*60*3):
|
||||
os.remove(file_path)
|
||||
print(f"Deleted old file: {file_path}")
|
||||
|
||||
def clip(record_dir, output_file_name):
|
||||
def save(record_dir, output_file_name):
|
||||
# Gather all ts files and combine them into a single mp4
|
||||
ts_files = [f for f in os.listdir(record_dir) if f.endswith(".ts")]
|
||||
ts_files.sort(key=lambda x: os.path.getmtime(os.path.join(record_dir, x)))
|
||||
|
||||
Reference in New Issue
Block a user