From 054b8568390c2a88bfcf1ffd67eb1c2da0ddc0de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 14 Jun 2021 10:59:41 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Set=20empty=20analysis=20result?= =?UTF-8?q?=20for=20empty=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That way they won't get added to the backlog again on every single server startup. Fixes #4162 --- src/octoprint/filemanager/analysis.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/octoprint/filemanager/analysis.py b/src/octoprint/filemanager/analysis.py index 11a187de6..89a59816c 100644 --- a/src/octoprint/filemanager/analysis.py +++ b/src/octoprint/filemanager/analysis.py @@ -5,7 +5,7 @@ __author__ = "Gina Häußge " __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html" __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" - +import copy import logging try: @@ -25,6 +25,20 @@ from octoprint.util import get_fully_qualified_classname as fqcn from octoprint.util import monotonic_time from octoprint.util.platform import CLOSE_FDS +EMPTY_RESULT = { + "_empty": True, + "printingArea": { + "minX": 0, + "maxX": 0, + "minY": 0, + "maxY": 0, + "minZ": 0, + "maxZ": 0, + }, + "dimensions": {"width": 0, "height": 0, "depth": 0}, + "filament": {}, +} + class QueueEntry( collections.namedtuple( @@ -489,6 +503,7 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue): raise RuntimeError(error.strip()) elif "EMPTY:" in output: self._logger.info("Result is empty, no extrusions found") + result = copy.deepcopy(EMPTY_RESULT) elif "RESULTS:" not in output: raise RuntimeError("No analysis result found") else: