From 6b1b8c51025c6a8650b4cecfefb47f0ff1d4415a Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Wed, 6 Mar 2024 03:42:59 +0300 Subject: [PATCH] metadata: support multiple filament lengths for prusaslicer Signed-off-by: Aleksey Frolov --- moonraker/components/file_manager/metadata.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/moonraker/components/file_manager/metadata.py b/moonraker/components/file_manager/metadata.py index 5fed236..31c1e42 100644 --- a/moonraker/components/file_manager/metadata.py +++ b/moonraker/components/file_manager/metadata.py @@ -357,9 +357,14 @@ class PrusaSlicer(BaseSlicer): return regex_find_max_float(r"G1\sZ(%F)\sF", self.footer_data) def parse_filament_total(self) -> Optional[float]: - return regex_find_float( - r"filament\sused\s\[mm\]\s=\s(%F)", self.footer_data - ) + line = regex_find_string(r'filament\sused\s\[mm\]\s=\s(%S)\n', self.footer_data) + if line: + filament = regex_find_floats( + r"(%F)", line + ) + if filament: + return sum(filament) + return None def parse_filament_weight_total(self) -> Optional[float]: return regex_find_float(