file_manager: initialize "print_start_time" and "job_id" fields in metadata
These fields will be updated by the [history] module. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
94ed9fbd7f
commit
06a07f09e5
|
@ -627,7 +627,7 @@ class FileManager:
|
||||||
|
|
||||||
METADATA_PRUNE_TIME = 600000
|
METADATA_PRUNE_TIME = 600000
|
||||||
METADATA_NAMESPACE = "gcode_metadata"
|
METADATA_NAMESPACE = "gcode_metadata"
|
||||||
METADATA_VERSION = 2
|
METADATA_VERSION = 3
|
||||||
|
|
||||||
class MetadataStorage:
|
class MetadataStorage:
|
||||||
def __init__(self, server, gc_path, database):
|
def __init__(self, server, gc_path, database):
|
||||||
|
@ -727,7 +727,12 @@ class MetadataStorage:
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.mddb[fname] = {'size': fsize, 'modified': modified}
|
self.mddb[fname] = {
|
||||||
|
'size': fsize,
|
||||||
|
'modified': modified,
|
||||||
|
'print_start_time': None,
|
||||||
|
'job_id': None
|
||||||
|
}
|
||||||
logging.info(
|
logging.info(
|
||||||
f"Unable to extract medatadata from file: {fname}")
|
f"Unable to extract medatadata from file: {fname}")
|
||||||
evt.set()
|
evt.set()
|
||||||
|
@ -754,6 +759,7 @@ class MetadataStorage:
|
||||||
if not metadata:
|
if not metadata:
|
||||||
# This indicates an error, do not add metadata for this
|
# This indicates an error, do not add metadata for this
|
||||||
raise self.server.error("Unable to extract metadata")
|
raise self.server.error("Unable to extract metadata")
|
||||||
|
metadata.update({'print_start_time': None, 'job_id': None})
|
||||||
self.mddb[path] = dict(metadata)
|
self.mddb[path] = dict(metadata)
|
||||||
metadata['filename'] = path
|
metadata['filename'] = path
|
||||||
if notify:
|
if notify:
|
||||||
|
|
Loading…
Reference in New Issue