mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 12:55:00 +00:00
feat: Add speed-up factor to recording timestamps in redact.py
This commit is contained in:
parent
1bb3041298
commit
a27f4d0e04
1 changed files with 7 additions and 2 deletions
|
@ -4,6 +4,9 @@ import sys
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
# Speed up factor for the recording
|
||||||
|
SPEEDUP = 1.25
|
||||||
|
|
||||||
def process_file(input_path, output_path):
|
def process_file(input_path, output_path):
|
||||||
"""
|
"""
|
||||||
Process an asciinema cast v2 file to filter out certain sections based on ANSI cursor commands.
|
Process an asciinema cast v2 file to filter out certain sections based on ANSI cursor commands.
|
||||||
|
@ -74,7 +77,8 @@ def process_file(input_path, output_path):
|
||||||
# Ensure timestamps never go backward
|
# Ensure timestamps never go backward
|
||||||
adjusted_timestamp = max(adjusted_timestamp, last_timestamp)
|
adjusted_timestamp = max(adjusted_timestamp, last_timestamp)
|
||||||
last_timestamp = adjusted_timestamp
|
last_timestamp = adjusted_timestamp
|
||||||
record[0] = adjusted_timestamp
|
# Apply speedup factor to the timestamp
|
||||||
|
record[0] = adjusted_timestamp / SPEEDUP
|
||||||
outfile.write(json.dumps(record) + '\n')
|
outfile.write(json.dumps(record) + '\n')
|
||||||
|
|
||||||
# If we're in skip mode, check if we should exit it
|
# If we're in skip mode, check if we should exit it
|
||||||
|
@ -102,7 +106,8 @@ def process_file(input_path, output_path):
|
||||||
# Ensure timestamps never go backward
|
# Ensure timestamps never go backward
|
||||||
adjusted_timestamp = max(adjusted_timestamp, last_timestamp)
|
adjusted_timestamp = max(adjusted_timestamp, last_timestamp)
|
||||||
last_timestamp = adjusted_timestamp
|
last_timestamp = adjusted_timestamp
|
||||||
record[0] = adjusted_timestamp
|
# Apply speedup factor to the timestamp
|
||||||
|
record[0] = adjusted_timestamp / SPEEDUP
|
||||||
outfile.write(json.dumps(record) + '\n')
|
outfile.write(json.dumps(record) + '\n')
|
||||||
# Otherwise we're still in skip mode, don't write anything
|
# Otherwise we're still in skip mode, don't write anything
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue