132 Commits

Author SHA1 Message Date
moggieuk
9b4b3def44
file_manager: Added additional metadata to aid tool selection on single extruder multi-material prints
Added additional essential metdata for single extruder multi-material printing.  This is critical to new Mainsail functionality to map tools to MMU spools when using Happy Hare (Klipper MMU driver)

Signed-off-by: Paul Morgan (moggieuk@hotmail.com)
2025-02-26 12:32:10 -05:00
Eric Callahan
c35353ed2a file_manager: delay file observer initialization
The addition of "gcode file processors" makes it possible
for processor registration to occur in "component_init".
The file observer init must be delayed until after all processors
are registered to correctly process metadata for gcode files
added while Moonraker was not running.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2025-02-17 15:32:45 -05:00
Eric Callahan
a95405f800 file_manager: handle inotify edge move case
It is possible to create, move, then close a file.  Handle this case
by rescheduling the "create_file" event under the new name.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2025-02-17 15:32:45 -05:00
Eric Callahan
b8b28bc0c9 file_manager: add support for metadata gcode processors
Allow components to register gcode processors which will modify
the gcode file prior to metadata processing.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2025-02-17 08:06:46 -05:00
Eric Callahan
bda03dcf29 file_manager: emit event after gcode metadata has been processed
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2025-02-10 18:17:39 -05:00
Eric Callahan
636626506a file_manager: provide method to look up paths by root
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2025-02-07 15:20:46 -05:00
Eric Callahan
0ff1d79b5b server: improve add_warning method
Add an exc_info parameter that optionally takes an
exception that is passed to the logging function. This
will log the traceback without an additional logging call.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-07-24 07:37:08 -04:00
Nick Gon
2dbea4f4cd metadata: Add support to extract metadata from g-code files generated by QIDISlicer
This PR adds support to extract metadata from the g-code files generated by QIDISlicer

Signed-off-by: Nick Gon <albatar@trance.fr>
2024-06-23 05:31:45 -04:00
Moggie
4d6037c3d3 module: file_manager
Allow default metadata parser timeout to be configurable

Signed-off-by: Paul Morgan moggieuk@hotmail.com
2024-06-23 05:31:18 -04:00
Eric Callahan
3f62bb6fb4 database: add backup, restore, and compact endpoints
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-21 06:18:46 -04:00
Eric Callahan
0b1fce8a6d file_manager: minor type checking fixes
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-21 06:18:46 -04:00
Eric Callahan
bb0266f5c4 app: replace dict with UserInfo throughout Moonraker
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-21 06:18:46 -04:00
Eric Callahan
531028ef4f history: report user in job history
When possible record the name of the user that requested the
job.  The klippy_api's component now takes an optional user
argument in its "start_print" method.  This user is broadcast
in an event after a print request successfully returns.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-04 08:16:37 -04:00
Eric Callahan
9447494bd5
file_manager: static type checking fixes 2024-04-19 11:28:01 -04:00
bakatrouble
6b1b8c5102
metadata: support multiple filament lengths for prusaslicer
Signed-off-by: Aleksey Frolov <bakatrouble@gmail.com>
2024-03-05 19:42:59 -05:00
Eric Callahan
4b9973826e
file_manager: add "enable_config_write_access" option
Some installations, such as those in public areas, may wish disallow
changes to the configuration.

This option defaults to True, so no change in behavior is introduced.

Signed-off-by:  Eric  Callahan <arksine.code@gmail.com>
2024-01-28 05:55:29 -05:00
Eric Callahan
69f527b7c7
secrets: remove dependency on file_manager
It is desirable to use templates (and therefore secrets) in
the server's configuration options.  We need to defer loading
the "file_manager", remove its dependency from secrets.  When
the file_manager is loaded it will look up "secrets" and register
the file path as reserved.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-15 06:03:43 -05:00
Eric Callahan
ddd735feba
refactor: convert klippy_connection into a component
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-13 15:15:15 -05:00
Eric Callahan
b18e9cc222
all: Replace strings with RequestType flags
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:20 -05:00
Eric Callahan
3b53d9532d
file_manager: add option to opt out of klipper check
Some installations do not have Klipper's configuration
in the data path's "config" folder.  Provide a way to
opt out of this check.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 15:25:38 -05:00
Eric Callahan
6d8cb762ff
file_manager: relax registration requirements
Use EAFP techniques to test for directory read permission
during registration.  If access fails continue with registration.
This allows users to potentially fix an issue without restarting.
Inotify failures always require a restart to resolve.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-15 10:53:09 -05:00
Eric Callahan
fb15b2a3de
metadata: increase read size to 1 MiB
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-19 17:56:55 -05:00
Eric Callahan
be23f206ee
metadata: refactor regex helper methods
Introduce placeholders for the regex capture groups.
This reduces the length of the original pattern and
makes it easy to change the pattern for a return value
if necessary.

This change modifies the float pattern to accept any
float or integer.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-19 17:49:30 -05:00
WALDNER Emmanuel
975011d190
metadata : fix extract to work with Ideamaker
Correction of the regex (Replacing the = with one: and adding the filament index for the regex to work).

Signed-off-by: Emmanuel WALDNER emmanuel.waldner@gmail.com
2023-11-07 16:12:58 -05:00
Eric Callahan
b676773602
metadata: update deprecated pillow constant
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-10 18:23:26 -04:00
Eric Callahan
6f6f535d6a
file_manager: fix linter errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-07 10:36:16 -04:00
Eric Callahan
f99e5b0bea
utils: add support for msgspec with stdlib json fallback
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2023-10-06 18:20:28 -04:00
SHID
52ee49eed3
metadata: add support for Moment Slicer
Signed-off-by: Sanghun Jung / Email: sanghun.id@gmail.com
2023-10-05 08:08:22 -04:00
Eric Callahan
0c6b4e0dad
file_manager: fix reserved path handling during runtime
If the user creates or moves a folder that was is reserved
reserved correctly ignore or remove watches as appropriate.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-05 07:59:23 -04:00
Eric Callahan
d51820f48c
metadata; use python's logging module
Replace calls to `log_to_stderr` with standard logging.<level> calls.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-09 12:01:27 -04:00
Eric Callahan
c3c3170451
file_manager: log metadata response in real time
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-09 11:31:19 -04:00
Eric Callahan
d6231634db
history: add modified time check for file existence
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-01 05:50:31 -04:00
SoftFever
110cbd1084 metadata: Add support to extract metadata from g-code files generated by OrcaSlicer
Signed-off-by: Li Jiang <softfeverever@gmail.com>
2023-03-20 06:20:33 -04:00
Eric Callahan
2d70511474
file_manager: use get_list WebRequest method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 10:26:15 -05:00
Eric Callahan
6d73c60a38
moonraker: move common classes to common.py
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 07:08:41 -05:00
Eric Callahan
fce056e481
file_manager: fix notification sync on fast machines
Desktop class PCs may exit the request before the inotify observer
gains control of the loop.  When the observer does gain control
it will immediately notify as the sync mutex is no longer held,
this can result in sending  the websocket notification before
the response has returned.  Delay all notifications by 5ms to prevent
this.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 18:08:51 -05:00
Eric Callahan
79467e6484
utils: add source_info utility module
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 18:08:48 -05:00
Eric Callahan
0f8638fec7
components: correct imports
All imports must now be relative to work correctly with the
moonraker parent package.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 12:16:27 -05:00
Eric Callahan
dce3b9eaf5
file_manager: add metadata scan endpoint
Support manual scan requests for systems where inotify
does not function correctlly (network shares).  This endpoint
may also be used to force a rescan of files that have already
had an initial scan.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-21 12:10:56 -05:00
Eric Callahan
9178b3833c
file_manager: improve observer log message
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-21 07:33:45 -05:00
Eric Callahan
522fdab63d
metadata: simplify the S3Dv5 temp regex
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-21 06:24:17 -05:00
Eric Callahan
7845390dd1
file_manager: support uploading to symlinks
Previously Moonraker disabled writing to symbolic links, as
doing so would overwrite the link.  Moonraker now resolves
the link, overwrites the file, and manually emits a websocket
notification.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2023-02-20 20:42:19 -05:00
Eric Callahan
0f7b781f57
file_manager: process metadata changes when no observer is configured
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:49:48 -05:00
Eric Callahan
347c9f4d2b
file_manager: improve duplicate notifcation detection
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:36:58 -05:00
Eric Callahan
2fd668bf0d
file_manager: implement configurable fs observer
Currently the choices are "none" and "inotify".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:36:58 -05:00
Eric Callahan
1e97571aa8
file_manager: refactor attribute names
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:36:57 -05:00
Eric Callahan
7330c2c123
file_manager: add request notifcation fallback
Schedule fallback websocket notifications in the event that
inotify is unable to watch a file system.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:36:57 -05:00
Eric Callahan
51e307dbd6
file_manager: don't queue "create from move" events
Treat these events as if they were actual file write events.  They
will reset the node completion time and suppress the notifcation.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:36:56 -05:00
Christian Speich
45506647a7 metadata: Add support for Simplify3D v5
Signed-off-by: Christian Speich <christian@spei.ch>
2023-02-20 19:35:37 -05:00
Eric Callahan
0a811b9e44
file_manager: cleanup coroutines on close
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-17 16:40:31 -05:00