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:
2025-12-16 18:26:00 +00:00
parent cef299b92f
commit c3b79a1f47
2 changed files with 7 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from datetime import datetime from datetime import datetime
from rewind.video import clip from rewind.video import save
import obsws_python as obs import obsws_python as obs
import sys, argparse import sys, argparse
@@ -15,10 +15,10 @@ def stop_recording(con):
con.stop_record() con.stop_record()
print("Stopped recording") print("Stopped recording")
def create_clip(con): def create_recording(con):
record_dir = con.get_record_directory() record_dir = con.get_record_directory()
output_file_name = f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}.mp4" 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}") print(f"Created clip: {output_file_name}")
def build_parser(): def build_parser():
@@ -31,7 +31,7 @@ def build_parser():
sub.add_parser("start", help="Start OBS recording") sub.add_parser("start", help="Start OBS recording")
sub.add_parser("stop", help="Stop 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 return parser
@@ -46,8 +46,8 @@ def main(argv=None):
start_recording(con) start_recording(con)
elif args.command == "stop": elif args.command == "stop":
stop_recording(con) stop_recording(con)
elif args.command == "clip": elif args.command == "save":
create_clip(con) create_recording(con)
else: else:
parser.error("Unknown command") parser.error("Unknown command")

View File

@@ -19,7 +19,7 @@ def clean_old_ts_files(record_dir, max_age_seconds=60*60*3):
os.remove(file_path) os.remove(file_path)
print(f"Deleted old file: {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 # 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 = [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))) ts_files.sort(key=lambda x: os.path.getmtime(os.path.join(record_dir, x)))