0.12.0-19 Final Build
Deploy Docs to GitHub Pages / Build Documentation (push) Has been cancelled
Deploy Docs to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled

This commit is contained in:
2026-04-07 19:12:40 +00:00
parent ccad7ec9f4
commit 43702b0138
39 changed files with 2829 additions and 460 deletions
+71 -5
View File
@@ -306,6 +306,35 @@ function normalizeMediaTypeValue(value) {
return null;
}
function normalizeJobKindValue(value) {
const raw = String(value || '').trim().toLowerCase();
if (!raw) {
return null;
}
if (raw === 'audiobook' || raw === 'cd' || raw === 'dvd' || raw === 'bluray') {
return raw;
}
if (raw === 'converter_audio' || raw === 'converter_video' || raw === 'converter_iso') {
return raw;
}
return null;
}
function inferMediaTypeFromJobKind(value) {
const normalized = normalizeJobKindValue(value);
if (normalized === 'converter_audio' || normalized === 'converter_video' || normalized === 'converter_iso') {
return 'converter';
}
if (normalized === 'audiobook' || normalized === 'cd' || normalized === 'dvd' || normalized === 'bluray') {
return normalized;
}
const legacy = String(value || '').trim().toLowerCase();
if (legacy === 'converter') {
return 'converter';
}
return null;
}
function inferMediaType(job, makemkvInfo, mediainfoInfo, encodePlan, handbrakeInfo = null) {
const mkInfo = parseInfoFromValue(makemkvInfo, null);
const miInfo = parseInfoFromValue(mediainfoInfo, null);
@@ -326,8 +355,21 @@ function inferMediaType(job, makemkvInfo, mediainfoInfo, encodePlan, handbrakeIn
return profileHint;
}
const profileFromJobKind = inferMediaTypeFromJobKind(
job?.job_kind
|| plan?.jobKind
|| mkInfo?.jobKind
|| mkInfo?.analyzeContext?.jobKind
|| miInfo?.jobKind
|| hbInfo?.jobKind
);
if (profileFromJobKind) {
return profileFromJobKind;
}
// Converter jobs: detected via media_type field (plan.mediaProfile = 'converter')
const rawMediaType = normalizeMediaTypeValue(job?.media_type);
const rawMediaTypeLegacy = String(job?.media_type || '').trim().toLowerCase();
const rawPlanProfile = String(plan?.mediaProfile || '').trim().toLowerCase();
const converterMediaTypeHint = String(plan?.converterMediaType || '').trim().toLowerCase();
const hasConverterPathHint = (value) => {
@@ -343,6 +385,7 @@ function inferMediaType(job, makemkvInfo, mediainfoInfo, encodePlan, handbrakeIn
if (
rawPlanProfile === 'converter'
|| rawMediaType === 'converter'
|| rawMediaTypeLegacy === 'converter'
|| converterMediaTypeHint === 'video'
|| converterMediaTypeHint === 'audio'
|| converterMediaTypeHint === 'iso'
@@ -1897,22 +1940,39 @@ function isFilesystemRootPath(inputPath) {
}
class HistoryService {
async createJob({ discDevice = null, status = 'ANALYZING', detectedTitle = null }) {
async createJob({
discDevice = null,
status = 'ANALYZING',
detectedTitle = null,
mediaType = null,
jobKind = null
}) {
const db = await getDb();
const startTime = new Date().toISOString();
const normalizedMediaType = (() => {
const normalized = normalizeMediaTypeValue(mediaType);
if (normalized) {
return normalized;
}
const legacy = String(mediaType || '').trim().toLowerCase();
return legacy === 'converter' ? 'converter' : null;
})();
const normalizedJobKind = normalizeJobKindValue(jobKind);
const result = await db.run(
`
INSERT INTO jobs (disc_device, status, start_time, detected_title, last_state, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
INSERT INTO jobs (disc_device, status, start_time, detected_title, last_state, media_type, job_kind, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
`,
[discDevice, status, startTime, detectedTitle, status]
[discDevice, status, startTime, detectedTitle, status, normalizedMediaType, normalizedJobKind]
);
logger.info('job:created', {
jobId: result.lastID,
discDevice,
status,
detectedTitle
detectedTitle,
mediaType: normalizedMediaType,
jobKind: normalizedJobKind
});
return this.getJobById(result.lastID);
@@ -2635,6 +2695,7 @@ class HistoryService {
const rowMediaProfile = normalizeMediaTypeValue(
makemkvInfo?.mediaProfile
|| makemkvInfo?.analyzeContext?.mediaProfile
|| inferMediaTypeFromJobKind(row?.job_kind)
|| row?.media_type
);
const posterCandidate = String(
@@ -2764,6 +2825,7 @@ class HistoryService {
const mediaProfile = normalizeMediaTypeValue(
makemkvInfo?.mediaProfile
|| makemkvInfo?.analyzeContext?.mediaProfile
|| inferMediaTypeFromJobKind(job?.job_kind)
|| job?.media_type
);
if (String(makemkvInfo?.source || '').trim().toLowerCase() !== 'orphan_raw_import' || mediaProfile !== 'cd') {
@@ -3616,6 +3678,10 @@ class HistoryService {
|| ''
).trim() || null;
await this.updateJob(created.id, {
...(detectedMediaType === 'audiobook' ? { job_kind: 'audiobook', media_type: 'audiobook' } : {}),
...(detectedMediaType === 'cd' ? { job_kind: 'cd' } : {}),
...(detectedMediaType === 'dvd' ? { job_kind: 'dvd' } : {}),
...(detectedMediaType === 'bluray' ? { job_kind: 'bluray' } : {}),
status: 'FINISHED',
last_state: 'FINISHED',
title: omdbById?.title