From e9e2419fe4648f3ef8508a63a873b1da18d7f79c Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Wed, 29 Jan 2020 16:21:38 +0000 Subject: [PATCH] Renamed capture.filename to capture.name --- openflexure_microscope/api/v2/views/captures.py | 4 ++-- openflexure_microscope/camera/capture.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openflexure_microscope/api/v2/views/captures.py b/openflexure_microscope/api/v2/views/captures.py index c5e00623..097ff665 100644 --- a/openflexure_microscope/api/v2/views/captures.py +++ b/openflexure_microscope/api/v2/views/captures.py @@ -20,7 +20,7 @@ class CaptureSchema(Schema): data_key="path", description="Path of file on microscope device" ) exists = fields.Bool(data_key="available") - filename = fields.String() + name = fields.String() metadata = fields.Dict() links = fields.Dict() @@ -50,7 +50,7 @@ class CaptureSchema(Schema): "href": url_for( CaptureDownload.endpoint, id=data.id, - filename=data.filename, + filename=data.name, _external=True, ), "mimetype": "image/jpeg", diff --git a/openflexure_microscope/camera/capture.py b/openflexure_microscope/camera/capture.py index e7264b6c..81edff1a 100644 --- a/openflexure_microscope/camera/capture.py +++ b/openflexure_microscope/camera/capture.py @@ -152,11 +152,11 @@ class CaptureObject(object): Args: filepath (str): String of the full file path, including file format extension """ - # Split the full file path into a folder and a filename - self.filefolder, self.filename = os.path.split(filepath) - # Split the filename out from it's file extension - self.basename = os.path.splitext(self.filename)[0] - self.format = self.filename.split(".")[-1] + # Split the full file path into a folder and a name + self.filefolder, self.name = os.path.split(filepath) + # Split the name out from it's file extension + self.basename = os.path.splitext(self.name)[0] + self.format = self.name.split(".")[-1] @property def exists(self) -> bool: @@ -243,7 +243,7 @@ class CaptureObject(object): d = { "image": { "id": self.id, - "name": self.filename, + "name": self.name, "acquisitionDate": self.datetime.isoformat(), "format": self.format, "tags": self.tags, @@ -262,7 +262,7 @@ class CaptureObject(object): """ # Create basic state dictionary - d = {"path": self.file, "filename": self.filename, "metadata": self.metadata} + d = {"path": self.file, "name": self.name, "metadata": self.metadata} # Combined availability of data if self.exists: