file_manager: check for unsuccessful attempt at metadata extraction

If the metadata script encoutners an error it will return an empty dict for the "metadata" item.  Do not update the metadata storage or send a notification if the dict is empty.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-09-02 17:13:25 -04:00
parent d59d1e5f7f
commit 2a34986acb
1 changed files with 3 additions and 0 deletions

View File

@ -535,6 +535,9 @@ class MetadataStorage:
raise self.server.error("Unable to extract metadata") raise self.server.error("Unable to extract metadata")
path = self.script_response['file'] path = self.script_response['file']
metadata = self.script_response['metadata'] metadata = self.script_response['metadata']
if not metadata:
# This indicates an error, do not add metadata for this
raise self.server.error("Unable to extract metadata")
self.metadata[path] = dict(metadata) self.metadata[path] = dict(metadata)
metadata['filename'] = path metadata['filename'] = path
if do_notify: if do_notify: