diff --git a/moonraker/components/file_manager/metadata.py b/moonraker/components/file_manager/metadata.py index b425d87..a2d1c14 100644 --- a/moonraker/components/file_manager/metadata.py +++ b/moonraker/components/file_manager/metadata.py @@ -807,11 +807,72 @@ class IceSL(BaseSlicer): return _regex_find_first( r";\snozzle_diameter_mm_0\s:\s+(\d+\.\d+)", self.header_data) +class KiriMoto(BaseSlicer): + def check_identity(self, data) -> Optional[Dict[str, Any]]: + variants: Dict[str, str] = { + "Kiri:Moto": r"; Generated by Kiri:Moto (\d.+)", + "SimplyPrint": r"; Generated by Kiri:Moto \(SimplyPrint\) (.+)" + } + for name, pattern in variants.items(): + match = re.search(pattern, data) + if match: + return { + "slicer": name, + "slicer_version": match.group(1) + } + return None + + def parse_first_layer_height(self) -> Optional[float]: + return _regex_find_first( + r"; firstSliceHeight = (\d+\.\d+)", self.header_data + ) + + def parse_layer_height(self) -> Optional[float]: + self.layer_height = _regex_find_first( + r"; sliceHeight = (\d+\.\d+)", self.header_data + ) + return self.layer_height + + def parse_object_height(self) -> Optional[float]: + return self._parse_max_float( + r"G1 Z\d+\.\d+ (?:; z-hop end|F\d+\n)", + self.footer_data, strict=True + ) + + def parse_layer_count(self) -> Optional[int]: + matches = re.findall( + r";; --- layer (\d+) \(.+", self.footer_data + ) + if not matches: + return None + try: + return int(matches[-1]) + 1 + except Exception: + return None + + def parse_estimated_time(self) -> Optional[float]: + return _regex_find_int(r"; --- print time: (\d+)s", self.footer_data) + + def parse_filament_total(self) -> Optional[float]: + return _regex_find_first( + r"; --- filament used: (\d+\.?\d*) mm", self.footer_data + ) + + def parse_first_layer_extr_temp(self) -> Optional[float]: + return _regex_find_first( + r"; firstLayerNozzleTemp = (\d+\.?\d*)", self.header_data + ) + + def parse_first_layer_bed_temp(self) -> Optional[float]: + return _regex_find_first( + r"; firstLayerBedTemp = (\d+\.?\d*)", self.header_data + ) + READ_SIZE = 512 * 1024 SUPPORTED_SLICERS: List[Type[BaseSlicer]] = [ PrusaSlicer, Slic3rPE, Slic3r, Cura, Simplify3D, - KISSlicer, IdeaMaker, IceSL + KISSlicer, IdeaMaker, IceSL, KiriMoto ] SUPPORTED_DATA = [ 'gcode_start_byte',