Skip to content

Struct issue when a plugin supports multiple protocols, e.g. logitech media server #9

@onkelandy

Description

@onkelandy

One way to support multi-protocols in a plugin would be to seperate the commands based on the protocol, e.g. one major tree is called "json", one "cli". This might work if the different models idea is used, e.g. in the init.py the model is automatically set based on the protocol defined in plugin.yaml.

So far, so good. However, to use individual structs currently it would be necessary to support the definition of "sub-structs" in item.yaml files such as

server:
  struct: lms.cli.server
player1:
  struct: lms.cli.player
player2:
  struct: lms.cli.player

This is not supported by shng and won't be supported in the future.

As nested structs are supported now, this might be a new approach. However, I currently don't have an idea how to use this feature without using un-cool command/item names because if all commands have to be on the same hierarchy level they'd need to be named server_cli oder server_json to be distinguishable..?
It could work with a sruct definition in plugin.yaml as such

cli_server:
  struct: server_cli
cli_player:
  struct:
    - control_cli
    - settings_cli
    - ..._cli

control_cli:
  play_cli: lms_command: player_cli.play
  stop_cli: ..
  pause_cli: ...

Or do I oversee another possibility?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions