Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Arksine/moonraker
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jun 24, 2024
2 parents bebd4b8 + 8f3b30a commit 892bdcb
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1360,8 +1360,8 @@ location:
# must be provided.
port:
# Port of the USB device to control. The port corresponds to the "-p"
# option of "ububctl". This parameter must be provided

# option of "ububctl". When omitted no port is provided to the uhubctl
# command.
```

!!! Tip
Expand Down
8 changes: 5 additions & 3 deletions moonraker/components/file_manager/file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,8 @@ def __init__(self,
self.server = config.get_server()
self.enable_object_proc = config.getboolean(
'enable_object_processing', False)
self.default_metadata_parser_timeout = config.getfloat(
'default_metadata_parser_timeout', 20.)
self.gc_path = ""
db.register_local_namespace(METADATA_NAMESPACE)
self.mddb = db.wrap_namespace(
Expand Down Expand Up @@ -2542,13 +2544,13 @@ async def _run_extract_metadata(self,
filename = filename.replace("\"", "\\\"")
cmd = " ".join([sys.executable, METADATA_SCRIPT, "-p",
self.gc_path, "-f", f"\"{filename}\""])
timeout = 10.
timeout = self.default_metadata_parser_timeout
if ufp_path is not None and os.path.isfile(ufp_path):
timeout = 300.
timeout = max(timeout, 300.)
ufp_path.replace("\"", "\\\"")
cmd += f" -u \"{ufp_path}\""
if self.enable_object_proc:
timeout = 300.
timeout = max(timeout, 300.)
cmd += " --check-objects"
result = bytearray()
sc: SCMDComp = self.server.lookup_component('shell_command')
Expand Down
1 change: 1 addition & 0 deletions moonraker/components/file_manager/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ def check_identity(self, data: str) -> Optional[Dict[str, str]]:
'SliCR-3D': r"SliCR-3D\s(.*)\son",
'BambuStudio': r"BambuStudio[^ ]*\s(.*)\n",
'A3dp-Slicer': r"A3dp-Slicer\s(.*)\son",
'QIDISlicer': r"QIDISlicer\s(.*)\son",
}
for name, expr in aliases.items():
match = re.search(expr, data)
Expand Down
14 changes: 8 additions & 6 deletions moonraker/components/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ async def _send_status_request(self) -> str:
(?:Port\s(?P<port>[0-9]+):)
(?:\s(?P<bits>[0-9a-f]{4}))
(?:\s(?P<pstate>power|off))
(?P<flags>(?:\s[0-9a-z]+)+)?
(?P<flags>(?:\s[0-9a-z.]+)+)?
(?:\s\[(?P<desc>.+)\])?
"""

Expand All @@ -1488,7 +1488,7 @@ def __init__(self, config: ConfigHelper) -> None:
super().__init__(config)
self.scmd: ShellCommand = self.server.load_component(config, "shell_command")
self.location = config.get("location")
self.port = config.getint("port")
self.port = config.getint("port", None)
ret = shutil.which("uhubctl")
if ret is None:
raise config.error(
Expand Down Expand Up @@ -1531,11 +1531,13 @@ async def set_power(self, state: str) -> None:
self.state = result["state"]

async def _run_uhubctl(self, action: str) -> Dict[str, Any]:
cmd = f"uhubctl -l {self.location} -p {self.port}"
search_prefix = "Current status"
cmd = f"uhubctl -l {self.location}"
if self.port is not None:
cmd += f" -p {self.port}"
search_prefix = f"Current status for hub {self.location}"
if action in ["on", "off"]:
cmd += f" -a {action}"
search_prefix = "New status"
search_prefix = f"New status for hub {self.location}"
resp: str = await self.scmd.exec_cmd(cmd, log_complete=False)
for line in resp.splitlines():
if search_prefix:
Expand All @@ -1551,7 +1553,7 @@ async def _run_uhubctl(self, action: str) -> Dict[str, Any]:
status_bits = int(result["bits"], 16)
except (TypeError, ValueError):
continue
if port != self.port:
if self.port is not None and port != self.port:
continue
if result["pstate"] is None:
continue
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = [
]
dependencies = [
"tornado==6.2.0 ; python_version=='3.7'",
"tornado==6.4.0 ; python_version>='3.8'",
"tornado==6.4.1 ; python_version>='3.8'",
"pyserial==3.4",
"pyserial-asyncio==0.6",
"pillow==9.5.0 ; python_version=='3.7'",
Expand Down
2 changes: 1 addition & 1 deletion scripts/moonraker-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Python dependencies for Moonraker
--find-links=python_wheels
tornado==6.2.0 ; python_version=='3.7'
tornado==6.4.0 ; python_version>='3.8'
tornado==6.4.1 ; python_version>='3.8'
pyserial==3.4
pyserial-asyncio==0.6
pillow==9.5.0 ; python_version=='3.7'
Expand Down

0 comments on commit 892bdcb

Please sign in to comment.