Skip to content

Add new form of preparation commands that runs before checking for displays #3821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

FiveYellowMice
Copy link

@FiveYellowMice FiveYellowMice commented Apr 28, 2025

Description

This PR attempts to a new form of preparation commands that runs before checking for displays, to solve feature request https://github.com/orgs/LizardByte/discussions/283 . This will include a minor refactor as suggested in this comment.

Hopefully this can open up doors for adding "on stream pause/resume" commands in the future.

Issues Fixed or Closed

https://github.com/orgs/LizardByte/discussions/283

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
2 New issues
2 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@ReenigneArcher
Copy link
Member

ReenigneArcher commented Apr 28, 2025

Thank you for the PR!

I think we could just move when the prep commands run instead of introducing another type of prep commands?

Edit: You might be interested in helping with this roadmap item LizardByte/roadmap#38 ... if not, this PR can still be accepted in the meantime.

@ReenigneArcher
Copy link
Member

@FiveYellowMice any response?

@FiveYellowMice
Copy link
Author

FiveYellowMice commented May 4, 2025

I was travelling last week, hence the silence.

Anyways, there are 2 reasons for a new type of prep commands:

  1. If prep commands are simply moved to run before display setup, it would technically a breaking change. If someone have their commands assuming display to be already setup, they will fail. This sounds like a super specific scenario, I don't know how relavant this is, but I didn't want to make a breaking change without being told it's acceptable to do so.

  2. According to a comment by Nonary:

    When the day comes for extending prep commands (to do things like on stream pause, on stream resume, etc) it's definitely a consideration to add a before encoder initialize command I guess.

    It seems having multiple types of prep commands is going to be desirable eventually. So I figured that it would be a good idea for this PR to be laying some groundwork for adding stream pause/resume commands. i.e. factoring out prep command running logic, and accomodating multiple types of prep commands in the web UI.

Helping out with the roadmap sounds interesting. It seems to encompass the aforementioned "day for extending prep commands". It doesn't seem clear what I can do for the roadmap, though, just by reading its thread. What can I do?

@ReenigneArcher
Copy link
Member

ReenigneArcher commented May 4, 2025

If someone have their commands assuming display to be already setup, they will fail.

That's a good point. I was not considering those who are changing resolutions for example. My bad...

Expanding on the roadmap entry here. This is just some brainstorming, nothing written in stone. We probably need a few different stages when a command can run.

  • pre display check - this PR (needed to enable displays before streaming)
  • post display check - current prep commands
  • pre stream start - current main command
  • post stream start - nothing available currently
  • stream pause / disconnect - nothing available currently
  • stream quit / end / termination - current undo commands
  • additional user connects to stream - nothing available currently

And the commands and do/undo commands to be refactored a bit. In the apps config it should probably just be a sequence of commands.

e.g.

"commands": [
  {
    "detached": True/False,
    "elevated": True/False,
    "ignore_error": True/False,
    "log_file": "e.g. my_command.log",
    "name": "Friendly name",
    "run": "terminal command to run",
    "shell": "shell to use, e.g. auto, bash, cmd, pwsh, etc.",
    "stage": "the point when the command should run",
    "working_directory": "path to start in"
  }
]

These would be listed in the order that they should run. In the c++ at each stage loop over the list in order and only run the command if the stage matches the stage we're at.

@FiveYellowMice
Copy link
Author

FiveYellowMice commented May 6, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants