-
Notifications
You must be signed in to change notification settings - Fork 171
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
Conversation
cleanup function doc
spotify_player/src/config/mod.rs
Outdated
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() | ||
}?; |
There was a problem hiding this comment.
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
spotify-player/spotify_player/src/config/mod.rs
Lines 138 to 142 in c3e9a4e
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.
There was a problem hiding this comment.
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>
There was a problem hiding this 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
Co-authored-by: Thang Pham <phamducthang1234@gmail.com>
I learn new things about this language every day, thanks! |
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.