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

Fix pactl parsing when in non-English language #220

Merged
merged 1 commit into from
Apr 19, 2023
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
2 changes: 1 addition & 1 deletion src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ pub fn exec(command: ExecCommand, uiclient: &dyn UiClient) -> anyhow::Result<()>
let short_name = if server_name.len() > 7 {
bs58::encode(&server_name).into_string()[0..7].to_string()
} else {
server_name.clone()
server_name.replace('-', "")
};
format!("vo_{alias}_{short_name}")
};
Expand Down
7 changes: 5 additions & 2 deletions vopono_core/src/util/pulseaudio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ use regex::Regex;
use std::process::Command;

pub fn get_pulseaudio_server() -> anyhow::Result<String> {
let output = Command::new("pactl").args(["info"]).output()?.stdout;
let re = Regex::new(r"Server String: ([^\n]+)").unwrap();
let output = Command::new("pactl")
.args(["-f", "json", "info"])
.output()?
.stdout;
let re = Regex::new("\"server_string\":\"([^\"]+)\"").unwrap();
let output = std::str::from_utf8(&output)?;

let caps = re.captures(output);
Expand Down