|
|
@ -1,6 +1,7 @@ |
|
|
|
import os |
|
|
|
import os |
|
|
|
import re |
|
|
|
import re |
|
|
|
import requests |
|
|
|
import requests |
|
|
|
|
|
|
|
from typing import TypeAlias |
|
|
|
from functools import cache |
|
|
|
from functools import cache |
|
|
|
from urllib.parse import urlparse |
|
|
|
from urllib.parse import urlparse |
|
|
|
from collections import defaultdict |
|
|
|
from collections import defaultdict |
|
|
@ -10,14 +11,15 @@ from openpilot.tools.lib.auth_config import get_token |
|
|
|
from openpilot.tools.lib.api import APIError, CommaApi |
|
|
|
from openpilot.tools.lib.api import APIError, CommaApi |
|
|
|
from openpilot.tools.lib.helpers import RE |
|
|
|
from openpilot.tools.lib.helpers import RE |
|
|
|
|
|
|
|
|
|
|
|
QLOG_FILENAMES = ('qlog.bz2', 'qlog.zst', 'qlog') |
|
|
|
FileNameTuple: TypeAlias = tuple[str, ...] |
|
|
|
QCAMERA_FILENAMES = ('qcamera.ts',) |
|
|
|
class FileName: |
|
|
|
LOG_FILENAMES = ('rlog.bz2', 'raw_log.bz2', 'rlog.zst', 'rlog') |
|
|
|
RLOG: FileNameTuple = ("rlog.zst", "rlog.bz2") |
|
|
|
CAMERA_FILENAMES = ('fcamera.hevc', 'video.hevc') |
|
|
|
QLOG: FileNameTuple = ("qlog.zst", "qlog.bz2") |
|
|
|
DCAMERA_FILENAMES = ('dcamera.hevc',) |
|
|
|
QCAMERA: FileNameTuple = ('qcamera.ts',) |
|
|
|
ECAMERA_FILENAMES = ('ecamera.hevc',) |
|
|
|
FCAMERA: FileNameTuple = ('fcamera.hevc',) |
|
|
|
BOOTLOG_FILENAMES = ('bootlog.zst', 'bootlog.bz2', 'bootlog') |
|
|
|
ECAMERA: FileNameTuple = ('ecamera.hevc',) |
|
|
|
|
|
|
|
DCAMERA: FileNameTuple = ('dcamera.hevc',) |
|
|
|
|
|
|
|
BOOTLOG: FileNameTuple = ('bootlog.zst', 'bootlog.bz2') |
|
|
|
|
|
|
|
|
|
|
|
class Route: |
|
|
|
class Route: |
|
|
|
def __init__(self, name, data_dir=None): |
|
|
|
def __init__(self, name, data_dir=None): |
|
|
@ -82,23 +84,23 @@ class Route: |
|
|
|
if segments.get(segment_name): |
|
|
|
if segments.get(segment_name): |
|
|
|
segments[segment_name] = Segment( |
|
|
|
segments[segment_name] = Segment( |
|
|
|
segment_name, |
|
|
|
segment_name, |
|
|
|
url if fn in LOG_FILENAMES else segments[segment_name].log_path, |
|
|
|
url if fn in FileName.RLOG else segments[segment_name].log_path, |
|
|
|
url if fn in QLOG_FILENAMES else segments[segment_name].qlog_path, |
|
|
|
url if fn in FileName.QLOG else segments[segment_name].qlog_path, |
|
|
|
url if fn in CAMERA_FILENAMES else segments[segment_name].camera_path, |
|
|
|
url if fn in FileName.FCAMERA else segments[segment_name].camera_path, |
|
|
|
url if fn in DCAMERA_FILENAMES else segments[segment_name].dcamera_path, |
|
|
|
url if fn in FileName.DCAMERA else segments[segment_name].dcamera_path, |
|
|
|
url if fn in ECAMERA_FILENAMES else segments[segment_name].ecamera_path, |
|
|
|
url if fn in FileName.ECAMERA else segments[segment_name].ecamera_path, |
|
|
|
url if fn in QCAMERA_FILENAMES else segments[segment_name].qcamera_path, |
|
|
|
url if fn in FileName.QCAMERA else segments[segment_name].qcamera_path, |
|
|
|
self.metadata['url'], |
|
|
|
self.metadata['url'], |
|
|
|
) |
|
|
|
) |
|
|
|
else: |
|
|
|
else: |
|
|
|
segments[segment_name] = Segment( |
|
|
|
segments[segment_name] = Segment( |
|
|
|
segment_name, |
|
|
|
segment_name, |
|
|
|
url if fn in LOG_FILENAMES else None, |
|
|
|
url if fn in FileName.RLOG else None, |
|
|
|
url if fn in QLOG_FILENAMES else None, |
|
|
|
url if fn in FileName.QLOG else None, |
|
|
|
url if fn in CAMERA_FILENAMES else None, |
|
|
|
url if fn in FileName.FCAMERA else None, |
|
|
|
url if fn in DCAMERA_FILENAMES else None, |
|
|
|
url if fn in FileName.DCAMERA else None, |
|
|
|
url if fn in ECAMERA_FILENAMES else None, |
|
|
|
url if fn in FileName.ECAMERA else None, |
|
|
|
url if fn in QCAMERA_FILENAMES else None, |
|
|
|
url if fn in FileName.QCAMERA else None, |
|
|
|
self.metadata['url'], |
|
|
|
self.metadata['url'], |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -136,32 +138,32 @@ class Route: |
|
|
|
for segment, files in segment_files.items(): |
|
|
|
for segment, files in segment_files.items(): |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
log_path = next(path for path, filename in files if filename in LOG_FILENAMES) |
|
|
|
log_path = next(path for path, filename in files if filename in FileName.RLOG) |
|
|
|
except StopIteration: |
|
|
|
except StopIteration: |
|
|
|
log_path = None |
|
|
|
log_path = None |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
qlog_path = next(path for path, filename in files if filename in QLOG_FILENAMES) |
|
|
|
qlog_path = next(path for path, filename in files if filename in FileName.QLOG) |
|
|
|
except StopIteration: |
|
|
|
except StopIteration: |
|
|
|
qlog_path = None |
|
|
|
qlog_path = None |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
camera_path = next(path for path, filename in files if filename in CAMERA_FILENAMES) |
|
|
|
camera_path = next(path for path, filename in files if filename in FileName.FCAMERA) |
|
|
|
except StopIteration: |
|
|
|
except StopIteration: |
|
|
|
camera_path = None |
|
|
|
camera_path = None |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
dcamera_path = next(path for path, filename in files if filename in DCAMERA_FILENAMES) |
|
|
|
dcamera_path = next(path for path, filename in files if filename in FileName.DCAMERA) |
|
|
|
except StopIteration: |
|
|
|
except StopIteration: |
|
|
|
dcamera_path = None |
|
|
|
dcamera_path = None |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
ecamera_path = next(path for path, filename in files if filename in ECAMERA_FILENAMES) |
|
|
|
ecamera_path = next(path for path, filename in files if filename in FileName.ECAMERA) |
|
|
|
except StopIteration: |
|
|
|
except StopIteration: |
|
|
|
ecamera_path = None |
|
|
|
ecamera_path = None |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
qcamera_path = next(path for path, filename in files if filename in QCAMERA_FILENAMES) |
|
|
|
qcamera_path = next(path for path, filename in files if filename in FileName.QCAMERA) |
|
|
|
except StopIteration: |
|
|
|
except StopIteration: |
|
|
|
qcamera_path = None |
|
|
|
qcamera_path = None |
|
|
|
|
|
|
|
|
|
|
|