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

feat: client_id_cmd config option #548

Merged
merged 5 commits into from
Aug 17, 2024

Conversation

juliamertz
Copy link
Contributor

This PR fixes #537 by adding a new config option client_id_cmd. When set, it will run this command and use its stdout as the client_id. I haven't been able to verify it's working on Windows, but that part has been copied from the rust docs so it should be fine.

Comment on lines 395 to 404
let output = if cfg!(target_os = "windows") {
std::process::Command::new("cmd")
.args(["/C", &cmd])
.output()
} else {
std::process::Command::new("sh")
.arg("-c")
.arg(&cmd)
.output()
}?;
Copy link
Owner

Choose a reason for hiding this comment

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

Should we use config::Command struct to represent this for consistency (e.g. with previous player_event_hook_command)? See

pub struct Command {
pub command: String,
#[serde(default)]
pub args: Vec<String>,
}

I guess specifying a command string is more convenient, but the above code looks kinda "hacky" to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I didn't know this existed in the codebase, this does seem like a better idea.
I could pull out the execution logic for player_event_hook_command and implement that on the Command struct

Co-authored-by: Thang Pham <phamducthang1234@gmail.com>
Copy link
Owner

@aome510 aome510 left a comment

Choose a reason for hiding this comment

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

few comments left. Otherwise, looks good

spotify_player/src/config/mod.rs Outdated Show resolved Hide resolved
spotify_player/src/config/mod.rs Outdated Show resolved Hide resolved
spotify_player/src/config/mod.rs Show resolved Hide resolved
spotify_player/src/config/mod.rs Outdated Show resolved Hide resolved
juliamertz and others added 2 commits August 17, 2024 23:11
Co-authored-by: Thang Pham <phamducthang1234@gmail.com>
@juliamertz
Copy link
Contributor Author

I learn new things about this language every day, thanks!

@aome510 aome510 merged commit 04f1763 into aome510:master Aug 17, 2024
3 checks passed
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.

FR: Store client_id outside dotfiles
2 participants