|
|
|
@ -26,7 +26,7 @@ def do_extract_segment(*segment_paths, prototypes_path="./prototypes"):
|
|
|
|
|
prototypes = load_prototypes(prototypes_path)
|
|
|
|
|
for segment_path in segment_paths:
|
|
|
|
|
segment_info = parse_segment_path(segment_path)
|
|
|
|
|
odometer, clock, tod = extract_segment(prototypes, segment_info, segment_info.start)
|
|
|
|
|
odometer, clock, tod = extract_segment(prototypes, segment_info)
|
|
|
|
|
print(f"{segment_path} {odometer} {clock} {tod}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -76,7 +76,7 @@ def compare_segments(dbconnect, base_dir='.', prototypes_path="./prototypes", si
|
|
|
|
|
for old_odometer, (segment, old_clock, old_tod) in selected:
|
|
|
|
|
path = os.path.join(base_dir, segment)
|
|
|
|
|
segment_info = parse_segment_path(path)
|
|
|
|
|
odometer, clock, tod = extract_segment(prototypes, segment_info, segment_info.start)
|
|
|
|
|
odometer, clock, tod = extract_segment(prototypes, segment_info)
|
|
|
|
|
results.append((segment, {
|
|
|
|
|
"odo": (old_odometer, odometer),
|
|
|
|
|
"clock": (old_clock, clock),
|
|
|
|
@ -118,13 +118,8 @@ def analyze_segment(db_manager, prototypes, segment_path, check_segment_name=Non
|
|
|
|
|
if check_segment_name is not None:
|
|
|
|
|
assert segment_name == check_segment_name
|
|
|
|
|
|
|
|
|
|
# A timestamp fully at the end doesn't get us a valid frame.
|
|
|
|
|
# But we want to be as late as possible to minimize latency.
|
|
|
|
|
# We attempt to do a fixed time before the end, or use the start if too short.
|
|
|
|
|
timestamp = max(segment_info.start, segment_info.end - datetime.timedelta(seconds=0.1))
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
odometer, clock, tod = extract_segment(prototypes, segment_info, timestamp)
|
|
|
|
|
odometer, clock, tod = extract_segment(prototypes, segment_info)
|
|
|
|
|
except Exception:
|
|
|
|
|
logging.warning(f"Failed to extract segment {segment_path!r}", exc_info=True)
|
|
|
|
|
odometer = None
|
|
|
|
@ -148,7 +143,7 @@ def analyze_segment(db_manager, prototypes, segment_path, check_segment_name=Non
|
|
|
|
|
timeofday = %(timeofday)s
|
|
|
|
|
""",
|
|
|
|
|
channel=segment_info.channel,
|
|
|
|
|
timestamp=timestamp,
|
|
|
|
|
timestamp=segment_info.start,
|
|
|
|
|
segment=segment_name,
|
|
|
|
|
error=error,
|
|
|
|
|
odometer=odometer,
|
|
|
|
@ -205,7 +200,7 @@ def main(
|
|
|
|
|
prototypes_path="./prototypes",
|
|
|
|
|
concurrency=10,
|
|
|
|
|
):
|
|
|
|
|
CHECK_INTERVAL = 0.5
|
|
|
|
|
CHECK_INTERVAL = 2
|
|
|
|
|
|
|
|
|
|
stopping = gevent.event.Event()
|
|
|
|
|
|
|
|
|
|