def get_log_metadata(golog_path):
"""
Returns the metadata from the log at the given *golog_path* in the form of
a dict.
"""
metadata = {}
if not os.path.getsize(golog_path): # 0 bytes
return metadata # Nothing to do
try:
first_frame, distance = retrieve_first_frame(golog_path)
except IOError:
# Something wrong with the log... Probably still being written to
return metadata
if first_frame[14:].startswith('{'):
# This is JSON, capture metadata
metadata = json_decode(first_frame[14:])
return metadata # All done
评论列表
文章目录