Skip to content

Commit

Permalink
Merge pull request #220 from jamesmcm/pactlfix
Browse files Browse the repository at this point in the history
Fix pactl parsing when in non-English language
  • Loading branch information
jamesmcm authored Apr 19, 2023
2 parents a566ec5 + e18c385 commit 8026b9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit 8026b9d

Please sign in to comment.