0.11.0-1 queue fix

This commit is contained in:
2026-03-17 20:08:45 +00:00
parent 16c783e1aa
commit 56879d2e8d
13 changed files with 147 additions and 50 deletions
@@ -92,7 +92,18 @@ function DriveDevicesEditor({ value, onChange, settingKey }) {
const parseDevices = (val) => {
try {
const parsed = JSON.parse(val || '[]');
return Array.isArray(parsed) ? parsed.map(String) : [];
if (!Array.isArray(parsed)) return [];
return parsed.map((e) => {
if (typeof e === 'string') {
const p = e.trim();
const m = p.match(/sr(\d+)$/);
return { path: p, makemkvIndex: m ? Number(m[1]) : 0 };
}
if (e && typeof e === 'object') {
return { path: String(e.path || '').trim(), makemkvIndex: Number.isFinite(Number(e.makemkvIndex)) ? Number(e.makemkvIndex) : 0 };
}
return { path: '', makemkvIndex: 0 };
});
} catch (_e) {
return [];
}
@@ -109,18 +120,35 @@ function DriveDevicesEditor({ value, onChange, settingKey }) {
{devices.length === 0 && (
<p className="drive-devices-empty">Keine expliziten Laufwerke konfiguriert.</p>
)}
{devices.map((path, idx) => (
{devices.map((dev, idx) => (
<div key={idx} className="drive-device-row">
<InputText
value={path}
value={dev.path}
placeholder="/dev/sr0"
onChange={(e) => {
const next = [...devices];
next[idx] = e.target.value;
const p = e.target.value;
const m = p.match(/sr(\d+)$/);
next[idx] = { ...next[idx], path: p, makemkvIndex: m ? Number(m[1]) : next[idx].makemkvIndex };
updateDevices(next);
}}
className="drive-device-input"
/>
<InputNumber
value={dev.makemkvIndex}
min={0}
max={9}
showButtons={false}
placeholder="Idx"
title="MakeMKV disc index (disc:N)"
style={{ width: '4rem' }}
inputStyle={{ textAlign: 'center' }}
onChange={(e) => {
const next = [...devices];
next[idx] = { ...next[idx], makemkvIndex: e.value ?? 0 };
updateDevices(next);
}}
/>
<Button
icon="pi pi-trash"
severity="danger"
@@ -139,7 +167,10 @@ function DriveDevicesEditor({ value, onChange, settingKey }) {
severity="secondary"
text
size="small"
onClick={() => updateDevices([...devices, ''])}
onClick={() => {
const nextIdx = devices.length;
updateDevices([...devices, { path: '', makemkvIndex: nextIdx }]);
}}
type="button"
/>
</div>