Skip to content

Conversation

@nzoschke
Copy link

@nzoschke nzoschke commented Jul 29, 2025

  • List input kinds as table
  • Create input
  • Show input with simple and verbose
  • Update input
  • Delete input

Fixes #5

@nzoschke nzoschke changed the title Extend input command group WIP: Extend input command group Jul 29, 2025
@nzoschke
Copy link
Author

nzoschke commented Jul 29, 2025

Demo

% gobs-cli input kinds
╭──────────────────────────────╮
│             Kind             │
├──────────────────────────────┤
│   image_source               │
│   color_source_v3            │
│   slideshow_v2               │
│   av_capture_input_v2        │
│   macos-avcapture            │
│   macos-avcapture-fast       │
│   screen_capture             │
│   sck_audio_capture          │
│   display_capture            │
│   window_capture             │
│   coreaudio_input_capture    │
│   coreaudio_output_capture   │
│   syphon-input               │
│   browser_source             │
│   ffmpeg_source              │
│   text_ft2_source_v2         │
╰──────────────────────────────╯

% gobs-cli input create coreaudio_input_capture Mix
Created input: Mix (coreaudio_input_capture) in scene Scene

% gobs-cli input show Mix
╭────────────────┬─────────────────────────────┬─────────────╮
│   Input Name   │            Kind             │   Device    │
├────────────────┼─────────────────────────────┼─────────────┤
│   Mix          │   Coreaudio Input Capture   │   Default   │
╰────────────────┴─────────────────────────────┴─────────────╯
% gobs-cli input show Mix --verbose
╭────────────────┬─────────────────────────────┬─────────────╮
│   Input Name   │            Kind             │   Device    │
├────────────────┼─────────────────────────────┼─────────────┤
│   Mix          │   Coreaudio Input Capture   │   Default   │
╰────────────────┴─────────────────────────────┴─────────────╯
╭────────────────────────╮
│        Devices         │
├────────────────────────┤
│   Default              │
│   HD Pro Webcam C920   │
│   BlackHole 2ch        │
╰────────────────────────╯

% gobs-cli input update Mix "BlackHole 2ch"
Input Mix device_id set to BlackHole 2ch

% gobs-cli input delete Mix
Deleted input: Mix

@nzoschke nzoschke changed the title WIP: Extend input command group Extend input command group Jul 29, 2025
@nzoschke
Copy link
Author

The main question I still have is around device property names. I've only observed two here, device for vide capture and device_id for audio capture. I haven't found a way to determine the right one from the API alone.

@nzoschke
Copy link
Author

@onyx-and-iris check it out when you get a chance!

Copy link
Owner

@onyx-and-iris onyx-and-iris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with the rest of the CLI, let's keep command struct definitions next to the Run methods that hang off them.

For example:

// InputCreateCmd provides a command to create an input.
type InputCreateCmd struct {
	Name string `arg:"" help:"Name for the input." required:""`
	Kind string `arg:"" help:"Input kind (e.g., coreaudio_input_capture, macos-avcapture)." required:""`
}

// Run executes the command to create an input.
func (cmd *InputCreateCmd) Run(ctx *context) error {
	currentScene, err := ctx.Client.Scenes.GetCurrentProgramScene()
	if err != nil {
		return err
	}

        ...
}

@onyx-and-iris
Copy link
Owner

The main question I still have is around device property names. I've only observed two here, device for vide capture and device_id for audio capture. I haven't found a way to determine the right one from the API alone.

So I've taken a look into this, I think the way to do it is to fetch the input settings for the input in question, then match it's device id against the device ids returned by GetInputPropertiesListPropertyItems and finally return the device name. Check out this gist.

Note, I've modified the device function too because it was raising an unparam warning. As well as that, err was always nil.

Have a fiddle around with it let me know what you think.

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.

Extend Input Command Group

2 participants