diff --git a/client/discordAudioBot/dabSettings.mjs b/client/discordAudioBot/dabSettings.mjs index b486405..05137e4 100644 --- a/client/discordAudioBot/dabSettings.mjs +++ b/client/discordAudioBot/dabSettings.mjs @@ -11,8 +11,8 @@ let type = "dshow"; if (os.platform() === 'linux') { await new Promise((res) => { executeCommand("pactl", ['list', 'short', 'sources']).then(cliOutput => { - device = extractValue(cliOutput, '(?:\d[ ]{4,12}(.+?)[ ]{4,12}(?:.+?[ ]{4,12}){2,4}RUNNING)') - console.log("Device:", device); + device = extractValue(cliOutput, '(?:\\d(?:\\t|[\\s]{1,9})(?[\\w\\d\\-\\.\\_]+?)(?:\\t|[\\s]{1,9})(?[\\w\\d\\-\\.\\_]+)(?:\\t|[\\s]{1,9})(?:(?[\\w\\d\\-\\.\\_]+?) (?\\dch) (?\\d+Hz))(?:\\t|[\\s]{1,9})(?:IDLE|RUNNING|SUSPENDED))') + console.log("Device:", device.groups.device); res(); }); }); diff --git a/client/modules/baseUtils.mjs b/client/modules/baseUtils.mjs index b58c4a2..85127c8 100644 --- a/client/modules/baseUtils.mjs +++ b/client/modules/baseUtils.mjs @@ -71,7 +71,7 @@ export const generateUniqueID = () => { * @returns {string|null} The value found after the pattern, or null if not found. */ export const extractValue = (input, pattern) => { - const regex = new RegExp(`${pattern}\\s+(\\S+)`); + const regex = new RegExp(`${pattern}`); const match = input.match(regex); - return match ? match[1] : null; + return match ? match : null; }; \ No newline at end of file