From ff8e53b2699142b50ed5947bbd803efe4aa48740 Mon Sep 17 00:00:00 2001 From: Arksine Date: Wed, 20 Jan 2021 10:21:27 -0500 Subject: [PATCH] moonraker: return list of registered directors in server.info response Signed-off-by: Eric Callahan --- moonraker/moonraker.py | 7 ++++++- moonraker/plugins/file_manager.py | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/moonraker/moonraker.py b/moonraker/moonraker.py index c96dda4..9543076 100755 --- a/moonraker/moonraker.py +++ b/moonraker/moonraker.py @@ -468,11 +468,16 @@ class Server: return "ok" async def _handle_info_request(self, web_request): + file_manager = self.lookup_plugin('file_manager', None) + reg_dirs = [] + if file_manager is not None: + reg_dirs = file_manager.get_registered_dirs() return { 'klippy_connected': self.klippy_connection.is_connected(), 'klippy_state': self.klippy_state, 'plugins': list(self.plugins.keys()), - 'failed_plugins': self.failed_plugins} + 'failed_plugins': self.failed_plugins, + 'registered_directories': reg_dirs} class KlippyConnection: def __init__(self, on_recd, on_close): diff --git a/moonraker/plugins/file_manager.py b/moonraker/plugins/file_manager.py index 7eade73..969596e 100644 --- a/moonraker/plugins/file_manager.py +++ b/moonraker/plugins/file_manager.py @@ -117,6 +117,9 @@ class FileManager: def get_sd_directory(self): return self.file_paths.get('gcodes', "") + def get_registered_dirs(self): + return list(self.file_paths.keys()) + def get_fixed_path_args(self): return dict(self.fixed_path_args)