Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion openrgb/orgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,10 @@ def _callback(self, device: int, type: int, data: Any):
elif type == utils.PacketType.REQUEST_PLUGIN_LIST:
for plugin in data:
if (all(plugin.id != existing.id for existing in self.plugins)):
self.plugins.append(create_plugin(plugin, self.comms))
# Plugins that are not supported should be skipped
new_plugin = create_plugin(plugin, self.comms)
if new_plugin is not None:
self.plugins.append(new_plugin)
elif type == utils.PacketType.PLUGIN_SPECIFIC:
next(plugin for plugin in self.plugins if plugin.id == device)._recv(data)

Expand Down
13 changes: 11 additions & 2 deletions openrgb/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations
from typing import Optional
from openrgb.utils import Plugin
from openrgb.network import NetworkClient
from openrgb.plugins.common import ORGBPlugin
Expand All @@ -10,5 +11,13 @@
}


def create_plugin(plugin: Plugin, comms: NetworkClient) -> ORGBPlugin:
return PLUGIN_NAMES[plugin.name](plugin, comms)
def create_plugin(plugin: Plugin, comms: NetworkClient) -> Optional[ORGBPlugin]:
plugin_class = PLUGIN_NAMES.get(plugin.name)

# There are cases where the plugin metadata from the OpenRGB server is
# entirely empty (version, description, name) - this seems to be when a plugin is
# disabled or in an invalid state
# or we don't support the plugin yet
if plugin_class is None:
return None
return plugin_class(plugin, comms)
Loading