|
|
@ -12,6 +12,7 @@ EXPLORER_FILE_RE = r'^({})--([a-z]+\.[a-z0-9]+)$'.format(SEGMENT_NAME_RE) |
|
|
|
OP_SEGMENT_DIR_RE = r'^({})$'.format(SEGMENT_NAME_RE) |
|
|
|
OP_SEGMENT_DIR_RE = r'^({})$'.format(SEGMENT_NAME_RE) |
|
|
|
|
|
|
|
|
|
|
|
QLOG_FILENAMES = ['qlog.bz2'] |
|
|
|
QLOG_FILENAMES = ['qlog.bz2'] |
|
|
|
|
|
|
|
QCAMERA_FILENAMES = ['qcamera.ts'] |
|
|
|
LOG_FILENAMES = ['rlog.bz2', 'raw_log.bz2'] |
|
|
|
LOG_FILENAMES = ['rlog.bz2', 'raw_log.bz2'] |
|
|
|
CAMERA_FILENAMES = ['fcamera.hevc', 'video.hevc'] |
|
|
|
CAMERA_FILENAMES = ['fcamera.hevc', 'video.hevc'] |
|
|
|
|
|
|
|
|
|
|
@ -40,6 +41,10 @@ class Route(object): |
|
|
|
camera_path_by_seg_num = {s.canonical_name.segment_num: s.camera_path for s in self._segments} |
|
|
|
camera_path_by_seg_num = {s.canonical_name.segment_num: s.camera_path for s in self._segments} |
|
|
|
return [camera_path_by_seg_num.get(i, None) for i in range(self.max_seg_number+1)] |
|
|
|
return [camera_path_by_seg_num.get(i, None) for i in range(self.max_seg_number+1)] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def qcamera_paths(self): |
|
|
|
|
|
|
|
qcamera_path_by_seg_num = {s.canonical_name.segment_num: s.qcamera_path for s in self._segments} |
|
|
|
|
|
|
|
return [qcamera_path_by_seg_num.get(i, None) for i in range(self.max_seg_number+1)] |
|
|
|
|
|
|
|
|
|
|
|
def _get_segments_remote(self): |
|
|
|
def _get_segments_remote(self): |
|
|
|
api = CommaApi(get_token()) |
|
|
|
api = CommaApi(get_token()) |
|
|
|
route_files = api.get('v1/route/' + self.route_name + '/files') |
|
|
|
route_files = api.get('v1/route/' + self.route_name + '/files') |
|
|
@ -53,14 +58,16 @@ class Route(object): |
|
|
|
segment_name, |
|
|
|
segment_name, |
|
|
|
url if fn in LOG_FILENAMES else segments[segment_name].log_path, |
|
|
|
url if fn in LOG_FILENAMES else segments[segment_name].log_path, |
|
|
|
url if fn in QLOG_FILENAMES else segments[segment_name].qlog_path, |
|
|
|
url if fn in QLOG_FILENAMES else segments[segment_name].qlog_path, |
|
|
|
url if fn in CAMERA_FILENAMES else segments[segment_name].camera_path |
|
|
|
url if fn in CAMERA_FILENAMES else segments[segment_name].camera_path, |
|
|
|
|
|
|
|
url if fn in QCAMERA_FILENAMES else segments[segment_name].qcamera_path, |
|
|
|
) |
|
|
|
) |
|
|
|
else: |
|
|
|
else: |
|
|
|
segments[segment_name] = RouteSegment( |
|
|
|
segments[segment_name] = RouteSegment( |
|
|
|
segment_name, |
|
|
|
segment_name, |
|
|
|
url if fn in LOG_FILENAMES else None, |
|
|
|
url if fn in LOG_FILENAMES else None, |
|
|
|
url if fn in QLOG_FILENAMES else None, |
|
|
|
url if fn in QLOG_FILENAMES else None, |
|
|
|
url if fn in CAMERA_FILENAMES else None |
|
|
|
url if fn in CAMERA_FILENAMES else None, |
|
|
|
|
|
|
|
url if fn in QCAMERA_FILENAMES else None, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
return sorted(segments.values(), key=lambda seg: seg.canonical_name.segment_num) |
|
|
|
return sorted(segments.values(), key=lambda seg: seg.canonical_name.segment_num) |
|
|
@ -110,18 +117,24 @@ class Route(object): |
|
|
|
except StopIteration: |
|
|
|
except StopIteration: |
|
|
|
camera_path = None |
|
|
|
camera_path = None |
|
|
|
|
|
|
|
|
|
|
|
segments.append(RouteSegment(segment, log_path, qlog_path, camera_path)) |
|
|
|
try: |
|
|
|
|
|
|
|
qcamera_path = next(path for path, filename in files if filename in QCAMERA_FILENAMES) |
|
|
|
|
|
|
|
except StopIteration: |
|
|
|
|
|
|
|
qcamera_path = None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
segments.append(RouteSegment(segment, log_path, qlog_path, camera_path, qcamera_path)) |
|
|
|
|
|
|
|
|
|
|
|
if len(segments) == 0: |
|
|
|
if len(segments) == 0: |
|
|
|
raise ValueError('Could not find segments for route {} in data directory {}'.format(self.route_name, data_dir)) |
|
|
|
raise ValueError('Could not find segments for route {} in data directory {}'.format(self.route_name, data_dir)) |
|
|
|
return sorted(segments, key=lambda seg: seg.canonical_name.segment_num) |
|
|
|
return sorted(segments, key=lambda seg: seg.canonical_name.segment_num) |
|
|
|
|
|
|
|
|
|
|
|
class RouteSegment(object): |
|
|
|
class RouteSegment(object): |
|
|
|
def __init__(self, name, log_path, qlog_path, camera_path): |
|
|
|
def __init__(self, name, log_path, qlog_path, camera_path, qcamera_path): |
|
|
|
self._name = RouteSegmentName(name) |
|
|
|
self._name = RouteSegmentName(name) |
|
|
|
self.log_path = log_path |
|
|
|
self.log_path = log_path |
|
|
|
self.qlog_path = qlog_path |
|
|
|
self.qlog_path = qlog_path |
|
|
|
self.camera_path = camera_path |
|
|
|
self.camera_path = camera_path |
|
|
|
|
|
|
|
self.qcamera_path = qcamera_path |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
@property |
|
|
|
def name(self): |
|
|
|
def name(self): |
|
|
|