fix: API /admin/devices/list retourne vrais IDs PulseAudio/PipeWire
Avant : IDs numériques (0, 1, 2...) incompatibles avec PipeWireBackend Après : IDs réels (alsa_input.pci-..., alsa_output.pci-...) - Extraction deviceId depuis pactl (colonne 2) - Filtrage des monitors (.monitor) - Descriptions lisibles (Input: pci-..., Output: pci-...) - Compatible avec config.yaml existant
This commit is contained in:
@@ -81,7 +81,7 @@ define(['./workbox-290dd570'], (function (workbox) { 'use strict';
|
|||||||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||||
}, {
|
}, {
|
||||||
"url": "index.html",
|
"url": "index.html",
|
||||||
"revision": "0.lhgefe7plc8"
|
"revision": "0.881sreuemg"
|
||||||
}], {});
|
}], {});
|
||||||
workbox.cleanupOutdatedCaches();
|
workbox.cleanupOutdatedCaches();
|
||||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+27
-7
@@ -736,21 +736,41 @@ router.get('/devices/list', async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Fallback : PipeWire via pactl
|
// Fallback : PipeWire/PulseAudio via pactl
|
||||||
const { stdout: paDevices } = await execPromise('pactl list short sources 2>/dev/null || echo ""');
|
const { stdout: paDevices } = await execPromise('pactl list short sources 2>/dev/null || echo ""');
|
||||||
const { stdout: paSinks } = await execPromise('pactl list short sinks 2>/dev/null || echo ""');
|
const { stdout: paSinks } = await execPromise('pactl list short sinks 2>/dev/null || echo ""');
|
||||||
|
|
||||||
|
// Helper pour obtenir une description lisible
|
||||||
|
const getDeviceDescription = (deviceId) => {
|
||||||
|
// Extraire une description plus lisible du nom technique
|
||||||
|
if (deviceId.includes('alsa_input')) return deviceId.replace('alsa_input.', 'Input: ');
|
||||||
|
if (deviceId.includes('alsa_output')) return deviceId.replace('alsa_output.', 'Output: ');
|
||||||
|
return deviceId;
|
||||||
|
};
|
||||||
|
|
||||||
if (paDevices.trim()) {
|
if (paDevices.trim()) {
|
||||||
paDevices.split('\n').filter(Boolean).forEach((line, idx) => {
|
paDevices.split('\n').filter(Boolean).forEach((line) => {
|
||||||
const name = line.split('\t')[1] || `Device ${idx}`;
|
const parts = line.split('\t');
|
||||||
devices.inputs.push({ id: idx, name });
|
const deviceId = parts[1]; // Nom du device (ex: alsa_input.pci-...)
|
||||||
|
if (deviceId && !deviceId.includes('.monitor')) { // Ignorer les monitors
|
||||||
|
devices.inputs.push({
|
||||||
|
id: deviceId,
|
||||||
|
name: getDeviceDescription(deviceId)
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paSinks.trim()) {
|
if (paSinks.trim()) {
|
||||||
paSinks.split('\n').filter(Boolean).forEach((line, idx) => {
|
paSinks.split('\n').filter(Boolean).forEach((line) => {
|
||||||
const name = line.split('\t')[1] || `Device ${idx}`;
|
const parts = line.split('\t');
|
||||||
devices.outputs.push({ id: idx, name });
|
const deviceId = parts[1]; // Nom du device (ex: alsa_output.pci-...)
|
||||||
|
if (deviceId) {
|
||||||
|
devices.outputs.push({
|
||||||
|
id: deviceId,
|
||||||
|
name: getDeviceDescription(deviceId)
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user