0.11.0-1 queue fix
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "ripster-backend",
|
||||
"version": "0.11.0",
|
||||
"version": "0.11.0-1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ripster-backend",
|
||||
"version": "0.11.0",
|
||||
"version": "0.11.0-1",
|
||||
"dependencies": {
|
||||
"archiver": "^7.0.1",
|
||||
"cors": "^2.8.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ripster-backend",
|
||||
"version": "0.11.0",
|
||||
"version": "0.11.0-1",
|
||||
"private": true,
|
||||
"type": "commonjs",
|
||||
"scripts": {
|
||||
|
||||
@@ -964,7 +964,7 @@ async function migrateSettingsSchemaMetadata(db) {
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('drive_devices', 'Laufwerk', 'Explizite Laufwerke', 'path', 0, 'Laufwerkspfade für den expliziten Modus als JSON-Array, z.B. [\"/dev/sr0\",\"/dev/sr1\"]. Nur relevant wenn Modus = Explizites Device.', '[]', '[]', '{}', 15)`
|
||||
VALUES ('drive_devices', 'Laufwerk', 'Explizite Laufwerke', 'path', 0, 'Laufwerke für den expliziten Modus als JSON-Array mit Pfad und MakeMKV-Index, z.B. [{\"path\":\"/dev/sr0\",\"makemkvIndex\":0},{\"path\":\"/dev/sr1\",\"makemkvIndex\":1}]. Nur relevant wenn Modus = Explizites Device.', '[]', '[]', '{}', 15)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('drive_devices', '[]')`);
|
||||
|
||||
|
||||
@@ -447,7 +447,9 @@ class DiskDetectionService extends EventEmitter {
|
||||
try {
|
||||
const parsed = JSON.parse(settingsMap.drive_devices || '[]');
|
||||
if (Array.isArray(parsed)) {
|
||||
explicitPaths = parsed.map((p) => String(p || '').trim()).filter(Boolean);
|
||||
explicitPaths = parsed
|
||||
.map((e) => (typeof e === 'string' ? e.trim() : String(e?.path || '').trim()))
|
||||
.filter(Boolean);
|
||||
}
|
||||
} catch (_error) {
|
||||
// malformed JSON — ignore, fall through to legacy
|
||||
|
||||
@@ -5158,9 +5158,11 @@ class PipelineService extends EventEmitter {
|
||||
const isNonJob = candidate.type && candidate.type !== 'job';
|
||||
|
||||
if (isNonJob) {
|
||||
// Non-job entries (script, chain, wait) always start immediately
|
||||
entryIndex = i;
|
||||
break;
|
||||
// Non-job entries (script, chain, wait) only start when no jobs are running
|
||||
if (totalRunning === 0) {
|
||||
entryIndex = i;
|
||||
}
|
||||
break; // FIFO: stop scanning regardless (non-job blocks everything behind it)
|
||||
}
|
||||
|
||||
// Job entry: check hierarchical limits
|
||||
@@ -5311,7 +5313,10 @@ class PipelineService extends EventEmitter {
|
||||
try {
|
||||
const parsed = JSON.parse(settingsMap?.drive_devices || '[]');
|
||||
if (Array.isArray(parsed)) {
|
||||
parsed.map((p) => String(p || '').trim()).filter(Boolean).forEach((p) => devicesToEject.push(p));
|
||||
parsed
|
||||
.map((e) => (typeof e === 'string' ? e.trim() : String(e?.path || '').trim()))
|
||||
.filter(Boolean)
|
||||
.forEach((p) => devicesToEject.push(p));
|
||||
}
|
||||
} catch (_error) {
|
||||
// ignore
|
||||
@@ -13488,7 +13493,7 @@ class PipelineService extends EventEmitter {
|
||||
title: 'Ripster - CD Rip erfolgreich',
|
||||
message: `Job #${jobId}: ${selectedMeta?.title || 'Audio CD'}`
|
||||
});
|
||||
void this.ejectDriveIfEnabled(settings);
|
||||
void settingsService.getSettingsMap().then((cdSettings) => this.ejectDriveIfEnabled(cdSettings, devicePath));
|
||||
} catch (error) {
|
||||
settleLifecycle();
|
||||
const failedCdLive = buildLiveContext(currentTrackPosition || null);
|
||||
|
||||
@@ -572,6 +572,45 @@ function mapPresetEntriesToOptions(entries) {
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the drive_devices JSON setting into a normalized array of {path, makemkvIndex}.
|
||||
* Supports both the legacy string format ["/dev/sr0"] and the object format
|
||||
* [{"path": "/dev/sr0", "makemkvIndex": 0}].
|
||||
* When makemkvIndex is missing, it is auto-derived from the device name (sr0→0, sr1→1).
|
||||
*/
|
||||
function parseDriveDeviceEntries(raw) {
|
||||
try {
|
||||
const arr = JSON.parse(raw || '[]');
|
||||
if (!Array.isArray(arr)) {
|
||||
return [];
|
||||
}
|
||||
return arr.map((entry) => {
|
||||
if (typeof entry === 'string') {
|
||||
const p = entry.trim();
|
||||
if (!p) {
|
||||
return null;
|
||||
}
|
||||
const m = p.match(/sr(\d+)$/);
|
||||
return { path: p, makemkvIndex: m ? Number(m[1]) : 0 };
|
||||
}
|
||||
if (entry && typeof entry === 'object' && entry.path) {
|
||||
const p = String(entry.path || '').trim();
|
||||
if (!p) {
|
||||
return null;
|
||||
}
|
||||
const idxRaw = entry.makemkvIndex != null ? Number(entry.makemkvIndex) : null;
|
||||
const m = p.match(/sr(\d+)$/);
|
||||
const derived = m ? Number(m[1]) : 0;
|
||||
const idx = Number.isFinite(idxRaw) && idxRaw >= 0 ? Math.trunc(idxRaw) : derived;
|
||||
return { path: p, makemkvIndex: idx };
|
||||
}
|
||||
return null;
|
||||
}).filter(Boolean);
|
||||
} catch (_error) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsService {
|
||||
constructor() {
|
||||
this.settingsSnapshotCache = {
|
||||
@@ -1192,21 +1231,12 @@ class SettingsService {
|
||||
|
||||
resolveHandBrakeSourceArg(map, deviceInfo = null) {
|
||||
if (map.drive_mode === 'explicit') {
|
||||
// Prefer drive_devices array, fall back to legacy drive_device
|
||||
let explicitPaths = [];
|
||||
try {
|
||||
const parsed = JSON.parse(map.drive_devices || '[]');
|
||||
if (Array.isArray(parsed)) {
|
||||
explicitPaths = parsed.map((p) => String(p || '').trim()).filter(Boolean);
|
||||
}
|
||||
} catch (_error) {
|
||||
// ignore parse error
|
||||
}
|
||||
const firstExplicit = explicitPaths[0] || String(map.drive_device || '').trim();
|
||||
if (!firstExplicit) {
|
||||
const entries = parseDriveDeviceEntries(map.drive_devices);
|
||||
const firstPath = entries[0]?.path || String(map.drive_device || '').trim();
|
||||
if (!firstPath) {
|
||||
throw new Error('Kein Laufwerk konfiguriert, obwohl drive_mode=explicit gesetzt ist.');
|
||||
}
|
||||
return firstExplicit;
|
||||
return firstPath;
|
||||
}
|
||||
|
||||
const detectedPath = String(deviceInfo?.path || '').trim();
|
||||
@@ -1214,15 +1244,10 @@ class SettingsService {
|
||||
return detectedPath;
|
||||
}
|
||||
|
||||
// Fallback: first explicit device, or legacy drive_device
|
||||
try {
|
||||
const parsed = JSON.parse(map.drive_devices || '[]');
|
||||
if (Array.isArray(parsed) && parsed.length > 0) {
|
||||
const first = String(parsed[0] || '').trim();
|
||||
if (first) return first;
|
||||
}
|
||||
} catch (_error) {
|
||||
// ignore
|
||||
// Fallback: first configured device or legacy drive_device
|
||||
const entries = parseDriveDeviceEntries(map.drive_devices);
|
||||
if (entries.length > 0) {
|
||||
return entries[0].path;
|
||||
}
|
||||
const configuredPath = String(map.drive_device || '').trim();
|
||||
if (configuredPath) {
|
||||
@@ -1385,10 +1410,28 @@ class SettingsService {
|
||||
}
|
||||
|
||||
resolveSourceArg(map, deviceInfo = null) {
|
||||
// Single-drive setup: always use MakeMKV's first logical disc device.
|
||||
void map;
|
||||
void deviceInfo;
|
||||
return 'disc:0';
|
||||
const devicePath = String(deviceInfo?.path || '').trim();
|
||||
|
||||
// In explicit mode: look up per-drive makemkvIndex from drive_devices
|
||||
if (devicePath && map.drive_mode === 'explicit') {
|
||||
const entries = parseDriveDeviceEntries(map.drive_devices);
|
||||
const entry = entries.find((e) => e.path === devicePath);
|
||||
if (entry) {
|
||||
return `disc:${entry.makemkvIndex}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-derive from device name (/dev/sr0 → disc:0, /dev/sr1 → disc:1)
|
||||
if (devicePath) {
|
||||
const match = devicePath.match(/sr(\d+)$/);
|
||||
if (match) {
|
||||
return `disc:${match[1]}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to global makemkv_source_index setting
|
||||
const sourceIndex = Number(map.makemkv_source_index ?? 0);
|
||||
return `disc:${Number.isFinite(sourceIndex) && sourceIndex >= 0 ? Math.trunc(sourceIndex) : 0}`;
|
||||
}
|
||||
|
||||
async loadHandBrakePresetOptionsFromCli(map = {}) {
|
||||
|
||||
Reference in New Issue
Block a user