Skip to content
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

Clarify client_id_command option & trim output #656

Merged
merged 2 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading