1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-17 22:01:49 -05:00

Change listen command plugins

The listen command now adds the --load-plugins, which is false by
default, to load all the plugins as defined in the config file.
This commit is contained in:
Hemna 2023-04-17 15:00:58 -04:00
parent c353877321
commit 0ec41f7605
2 changed files with 15 additions and 12 deletions

View File

@ -107,9 +107,10 @@ class APRSDListenThread(rx.APRSDRXThread):
help="Filter by packet type", help="Filter by packet type",
) )
@click.option( @click.option(
"--packet-plugins", "--load-plugins",
default=None, default=False,
help="CSV, List of aprsd plugins to enable", is_flag=True,
help="Load plugins as enabled in aprsd.conf ?",
) )
@click.argument( @click.argument(
"filter", "filter",
@ -123,7 +124,7 @@ def listen(
aprs_login, aprs_login,
aprs_password, aprs_password,
packet_filter, packet_filter,
packet_plugins, load_plugins,
filter, filter,
): ):
"""Listen to packets on the APRS-IS Network based on FILTER. """Listen to packets on the APRS-IS Network based on FILTER.
@ -180,14 +181,16 @@ def listen(
keepalive = threads.KeepAliveThread() keepalive = threads.KeepAliveThread()
keepalive.start() keepalive.start()
LOG.info(f"Packet plugins {packet_plugins}")
pm = None pm = None
if packet_plugins: pm = plugin.PluginManager()
LOG.info(f"Load plugins! {packet_plugins}") if load_plugins:
pm = plugin.PluginManager() LOG.info("Loading plugins")
for plugin_path in packet_plugins.split(","): pm.setup_plugins()
pm._load_plugin(plugin_path) else:
LOG.warning(
"Not Loading any plugins use --load-plugins to load what's "
"defined in the config file.",
)
LOG.debug("Create APRSDListenThread") LOG.debug("Create APRSDListenThread")
listen_thread = APRSDListenThread( listen_thread = APRSDListenThread(

View File

@ -213,7 +213,7 @@ class APRSDRegexCommandPluginBase(APRSDPluginBase, metaclass=abc.ABCMeta):
return result return result
if not isinstance(packet, packets.core.MessagePacket): if not isinstance(packet, packets.core.MessagePacket):
LOG.warning(f"Got a {packet.__class__.__name__} ignoring") LOG.warning(f"{self.__class__.__name__} Got a {packet.__class__.__name__} ignoring")
return packets.NULL_MESSAGE return packets.NULL_MESSAGE
result = None result = None