file_manager: don't request metadata from non-gcode files
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
ec29787edd
commit
18b84b8d9f
|
@ -1170,15 +1170,18 @@ class INotifyHandler:
|
||||||
|
|
||||||
def parse_gcode_metadata(self, file_path: str) -> asyncio.Event:
|
def parse_gcode_metadata(self, file_path: str) -> asyncio.Event:
|
||||||
rel_path = self.file_manager.get_relative_path("gcodes", file_path)
|
rel_path = self.file_manager.get_relative_path("gcodes", file_path)
|
||||||
|
ext = os.path.splitext(rel_path)[-1].lower()
|
||||||
try:
|
try:
|
||||||
path_info = self.file_manager.get_path_info(file_path, "gcodes")
|
path_info = self.file_manager.get_path_info(file_path, "gcodes")
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception(
|
path_info = {}
|
||||||
f"Error retreiving path info for file {file_path}")
|
if (
|
||||||
|
ext not in VALID_GCODE_EXTS or
|
||||||
|
path_info.get('size', 0) == 0
|
||||||
|
):
|
||||||
evt = asyncio.Event()
|
evt = asyncio.Event()
|
||||||
evt.set()
|
evt.set()
|
||||||
return evt
|
return evt
|
||||||
ext = os.path.splitext(file_path)[-1].lower()
|
|
||||||
if ext == ".ufp":
|
if ext == ".ufp":
|
||||||
rel_path = os.path.splitext(rel_path)[0] + ".gcode"
|
rel_path = os.path.splitext(rel_path)[0] + ".gcode"
|
||||||
path_info['ufp_path'] = file_path
|
path_info['ufp_path'] = file_path
|
||||||
|
|
Loading…
Reference in New Issue