5 Commits

Author SHA1 Message Date
9a15ad98a8 fix flag name 2025-06-14 17:17:27 +01:00
b8fa4d5be0 fix env prefix 2025-06-14 17:05:16 +01:00
64c1cb8fbe update/reorganise readme 2025-06-14 17:03:49 +01:00
eeb789003b add changelog links 2025-06-14 09:16:19 +01:00
4fd190bc4e read host, streamname from env 2025-06-14 09:13:25 +01:00
3 changed files with 60 additions and 27 deletions

View File

@@ -15,14 +15,14 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
### Added ### Added
- it's now possible to load configuration from environment variables. See [Environment Variables]() - it's now possible to load configuration from environment variables. See [Environment Variables](https://github.com/onyx-and-iris/vbantxt/tree/main?tab=readme-ov-file#environment-variables)
- --version/-v command - --version/-v command
### Changed ### Changed
- shortname for --host flag is now -H. - shortname for --host flag is now -H.
- shortname for --channel flag is now -n. - shortname for --channel flag is now -n.
- toml loader no longer requires a `[connection]` table. See [TOML Config]() - toml loader no longer requires a `[connection]` table. See [TOML Config](https://github.com/onyx-and-iris/vbantxt/tree/main?tab=readme-ov-file#toml-config)
# [0.4.1] - 2025-04-05 # [0.4.1] - 2025-04-05

View File

@@ -7,23 +7,37 @@ Send Voicemeeter/Matrix vban requests.
For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md) For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md)
## Tested against ---
- Basic 1.1.1.8 ## Table of Contents
- Banana 2.1.1.8
- Potato 3.1.1.8 - [Installation](#installation)
- Matrix 1.0.1.2 - [VBANTXT Package](#vbantxt-package)
- [VBANTXT CLI](#vbantxt-cli)
- [License](#license)
## Requirements ## Requirements
- [Voicemeeter](https://voicemeeter.com/) or [Matrix](https://vb-audio.com/Matrix/) - [Voicemeeter](https://voicemeeter.com/) or [Matrix](https://vb-audio.com/Matrix/)
- Go 1.18 or greater (if you want to compile yourself, otherwise check `Releases`) - Go 1.18 or greater (a binary is available in [Releases](https://github.com/onyx-and-iris/vbantxt/releases))
## Tested against
- Basic 1.1.1.9
- Banana 2.1.1.9
- Potato 3.1.1.9
- Matrix 1.0.1.2
## Installation
```console
go get github.com/onyx-and-iris/vbantxt
```
--- ---
## `Use` ## `VBANTXT Package`
`go get github.com/onyx-and-iris/vbantxt`
```go ```go
package main package main
@@ -55,35 +69,49 @@ func main() {
} }
``` ```
## `Command Line` ## `VBANTXT CLI`
### Use
Simply pass your vban commands as commane line arguments:
```console
vbantxt "strip[0].mute=1 strip[1].mono=1"
```
### Configuration ### Configuration
#### Flags #### Flags
- --host/-H: defaults to localhost ```console
- --port/-p: defaults to 6980 FLAGS
- --streamname/-s: defaults to Command1 -H, --host STRING VBAN host (default: localhost)
- --config/-C: defaults to `$XDG_CONFIG_HOME / vbantxt / config.toml` -p, --port INT VBAN port (default: 6980)
- --loglevel/-l: defaults to warn -s, --streamname STRING VBAN stream name (default: Command1)
- --version/-v: print the vbantxt version and exit -b, --bps INT VBAN BPS (default: 256000)
-n, --channel INT VBAN channel (default: 0)
-r, --ratelimit INT VBAN rate limit (ms) (default: 20)
-C, --config STRING Path to the configuration file (default: $XDG_CONFIG_HOME/vbantxt/config.toml)
-l, --loglevel STRING Log level (debug, info, warn, error, fatal, panic) (default: warn)
-v, --version Show version information
```
For example: Pass --host, --port and --streamname as flags on the root command, for example:
```console ```console
vbantxt --host="gamepc.local" --port=6980 --streamname=Command1 "strip[0].mute=1 strip[1].mono=1" vbantxt --host=localhost --port=6980 --streamname=Command1 --help
``` ```
#### Environment Variables #### Environment Variables
Load the following values from your environment: All flags have corresponding environment variables, prefixed with `VBANTXT_`:
```bash ```bash
#!/usr/bin/env bash #!/usr/bin/env bash
export VBANTXT_HOST=localhost export VBANTXT_HOST=localhost
export VBANTXT_PORT=6980 export VBANTXT_PORT=6980
export VBANTXT_STREAMNAME=onyx export VBANTXT_STREAMNAME=Command1
``` ```
Flags will override environment variables. Flags will override environment variables.
@@ -93,8 +121,9 @@ Flags will override environment variables.
By default the config loader will look for a config in: By default the config loader will look for a config in:
- $XDG_CONFIG_HOME / vbantxt / config.toml (see [os.UserConfigDir](https://pkg.go.dev/os#UserConfigDir)) - $XDG_CONFIG_HOME / vbantxt / config.toml (see [os.UserConfigDir](https://pkg.go.dev/os#UserConfigDir))
- A custom config path may be passed with the --config/-C flag.
A valid config.toml might look like this: All flags have corresponding keys in the config file, for example:
```toml ```toml
host="gamepc.local" host="gamepc.local"
@@ -102,8 +131,6 @@ port=6980
streamname="Command1" streamname="Command1"
``` ```
A custom config path may be passed with the --config/-C flag.
--- ---
## `Script files` ## `Script files`
@@ -162,3 +189,8 @@ vbantxt --loglevel=debug "bus[0].eq.on=1 bus[1].gain=-12.8"
``` ```
The default log level is `warn` if the flag is not specified. The default log level is `warn` if the flag is not specified.
## License
`vbantxt` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

View File

@@ -4,6 +4,7 @@ import (
"bufio" "bufio"
"bytes" "bytes"
_ "embed" _ "embed"
"os"
"testing" "testing"
"github.com/onyx-and-iris/vbantxt" "github.com/onyx-and-iris/vbantxt"
@@ -28,14 +29,14 @@ func run(t *testing.T, client *vbantxt.VbanTxt, script []byte) {
} }
func TestSendVm(t *testing.T) { func TestSendVm(t *testing.T) {
client, err := vbantxt.New("localhost", 6980, "onyx") client, err := vbantxt.New(os.Getenv("VBANTXT_HOST"), 6980, os.Getenv("VBANTXT_STREAMNAME"))
require.NoError(t, err) require.NoError(t, err)
run(t, client, vm) run(t, client, vm)
} }
func TestSendMatrix(t *testing.T) { func TestSendMatrix(t *testing.T) {
client, err := vbantxt.New("localhost", 6990, "onyx") client, err := vbantxt.New(os.Getenv("VBANTXT_HOST"), 6990, os.Getenv("VBANTXT_STREAMNAME"))
require.NoError(t, err) require.NoError(t, err)
run(t, client, matrix) run(t, client, matrix)