Skip to content

Commit

Permalink
Clarify client_id_command option & trim output (aome510#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliamertz authored Jan 5, 2025
1 parent 3fe2cda commit 75c2d7d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [Notes](#notes)
- [Media control](#media-control)
- [Player event hook command](#player-event-hook-command)
- [Client id command](#client-id-command)
- [Device configurations](#device-configurations)
- [Layout configurations](#layout-configurations)
- [Themes](#themes)
Expand Down Expand Up @@ -122,6 +123,17 @@ case "$1" in
esac
```

### Client id command

If you prefer not to include your own `client_id` directly in your configuration, you can retrieve it at runtime using the `client_id_command` option.

If specified, `client_id_command` should be an object with two fields `command` and `args`, just like `player_event_hook_command`.
For example to read your client_id from a file your could use `client_id_command = { command = "cat", args = ["/path/to/file"] }`

> [!NOTE]
> When passing a path as an argument, always use the full path.
> The `~` symbol will not automatically expand to your home directory.
### Device configurations

The configuration options for the [Librespot](https://github.com/librespot-org/librespot) integrated device are specified under the `[device]` section in the `app.toml` file:
Expand Down
2 changes: 1 addition & 1 deletion spotify_player/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ impl AppConfig {
/// Returns stdout of `client_id_command` if set, otherwise it returns the the value of `client_id`
pub fn get_client_id(&self) -> Result<String> {
match self.client_id_command {
Some(ref cmd) => cmd.execute(None),
Some(ref cmd) => cmd.execute(None).map(|out| out.trim().into()),
None => Ok(self.client_id.clone()),
}
}
Expand Down

0 comments on commit 75c2d7d

Please sign in to comment.