0.10.2-2 Fix TrackIDs

This commit is contained in:
2026-03-15 19:01:48 +00:00
parent ca2bd76572
commit cc20dc8120
9 changed files with 45 additions and 26 deletions

View File

@@ -8,7 +8,8 @@
"Bash(mkdocs build --strict)", "Bash(mkdocs build --strict)",
"Read(//mnt/external/media/**)", "Read(//mnt/external/media/**)",
"WebFetch(domain:www.makemkv.com)", "WebFetch(domain:www.makemkv.com)",
"Bash(node --check backend/src/services/pipelineService.js)" "Bash(node --check backend/src/services/pipelineService.js)",
"Bash(wc -l /home/michael/ripster/debug/backend/data/logs/backend/*.log)"
] ]
} }
} }

1
.gitignore vendored
View File

@@ -82,3 +82,4 @@ Thumbs.db
/scripts/ /scripts/
/release.sh /release.sh
/Audible_Tool /Audible_Tool
/AddOns

View File

@@ -1,12 +1,12 @@
{ {
"name": "ripster-backend", "name": "ripster-backend",
"version": "0.10.2-1", "version": "0.10.2-2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ripster-backend", "name": "ripster-backend",
"version": "0.10.2-1", "version": "0.10.2-2",
"dependencies": { "dependencies": {
"archiver": "^7.0.1", "archiver": "^7.0.1",
"cors": "^2.8.5", "cors": "^2.8.5",

View File

@@ -1,6 +1,6 @@
{ {
"name": "ripster-backend", "name": "ripster-backend",
"version": "0.10.2-1", "version": "0.10.2-2",
"private": true, "private": true,
"type": "commonjs", "type": "commonjs",
"scripts": { "scripts": {

View File

@@ -3251,26 +3251,43 @@ function extractHandBrakeTrackSelectionFromPlan(encodePlan, inputPath = null) {
return null; return null;
} }
const audioTrackIds = normalizeTrackIdList( const allAudioTracks = Array.isArray(encodeTitle.audioTracks) ? encodeTitle.audioTracks : [];
(Array.isArray(encodeTitle.audioTracks) ? encodeTitle.audioTracks : []) const allSubtitleTracks = Array.isArray(encodeTitle.subtitleTracks) ? encodeTitle.subtitleTracks : [];
.filter((track) => Boolean(track?.selectedForEncode))
.map((track) => track?.sourceTrackId ?? track?.id) // manualTrackSelection stores validated track?.id values written by applyManualTrackSelectionToPlan.
); // Use it as the authoritative source for audio/subtitle IDs. Fall back to the selectedForEncode
const subtitleTrackIds = normalizeTrackIdList( // flags on the track objects when the field is absent (e.g. auto-selected plans without user review).
(Array.isArray(encodeTitle.subtitleTracks) ? encodeTitle.subtitleTracks : []) // Always resolve through track?.id never sourceTrackId, which may hold MakeMKV stream IDs
.filter((track) => Boolean(track?.selectedForEncode)) // (e.g. 189) that have no relation to HandBrake's 1-indexed track positions.
.map((track) => track?.sourceTrackId ?? track?.id) const manualSelection = plan.manualTrackSelection && typeof plan.manualTrackSelection === 'object'
); ? plan.manualTrackSelection
const selectedSubtitleTracks = (Array.isArray(encodeTitle.subtitleTracks) ? encodeTitle.subtitleTracks : []) : null;
.filter((track) => Boolean(track?.selectedForEncode)); const manualTitleId = normalizeReviewTitleId(manualSelection?.titleId);
const manualMatchesTitle = !manualTitleId || !encodeInputTitleId || manualTitleId === encodeInputTitleId;
const audioTrackIds = (manualMatchesTitle && Array.isArray(manualSelection?.audioTrackIds))
? normalizeTrackIdList(manualSelection.audioTrackIds)
: normalizeTrackIdList(allAudioTracks.filter((t) => Boolean(t?.selectedForEncode)).map((t) => t?.id));
const subtitleTrackIds = (manualMatchesTitle && Array.isArray(manualSelection?.subtitleTrackIds))
? normalizeTrackIdList(manualSelection.subtitleTrackIds)
: normalizeTrackIdList(allSubtitleTracks.filter((t) => Boolean(t?.selectedForEncode)).map((t) => t?.id));
// Resolve burn/default/forced attributes from the actual track objects, matched by track?.id.
const subtitleTrackIdSet = new Set(subtitleTrackIds.map(String));
const selectedSubtitleTracks = allSubtitleTracks.filter((t) => {
const tid = normalizeTrackIdList([t?.id])[0];
return tid !== undefined && subtitleTrackIdSet.has(String(tid));
});
const subtitleBurnTrackId = normalizeTrackIdList( const subtitleBurnTrackId = normalizeTrackIdList(
selectedSubtitleTracks.filter((track) => Boolean(track?.burnIn)).map((track) => track?.sourceTrackId ?? track?.id) selectedSubtitleTracks.filter((track) => Boolean(track?.burnIn)).map((track) => track?.id)
)[0] || null; )[0] || null;
const subtitleDefaultTrackId = normalizeTrackIdList( const subtitleDefaultTrackId = normalizeTrackIdList(
selectedSubtitleTracks.filter((track) => Boolean(track?.defaultTrack)).map((track) => track?.sourceTrackId ?? track?.id) selectedSubtitleTracks.filter((track) => Boolean(track?.defaultTrack)).map((track) => track?.id)
)[0] || null; )[0] || null;
const subtitleForcedTrackId = normalizeTrackIdList( const subtitleForcedTrackId = normalizeTrackIdList(
selectedSubtitleTracks.filter((track) => Boolean(track?.forced)).map((track) => track?.sourceTrackId ?? track?.id) selectedSubtitleTracks.filter((track) => Boolean(track?.forced)).map((track) => track?.id)
)[0] || null; )[0] || null;
const subtitleForcedOnly = selectedSubtitleTracks.some((track) => Boolean(track?.forcedOnly)); const subtitleForcedOnly = selectedSubtitleTracks.some((track) => Boolean(track?.forcedOnly));

View File

@@ -1,12 +1,12 @@
{ {
"name": "ripster-frontend", "name": "ripster-frontend",
"version": "0.10.2-1", "version": "0.10.2-2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ripster-frontend", "name": "ripster-frontend",
"version": "0.10.2-1", "version": "0.10.2-2",
"dependencies": { "dependencies": {
"primeicons": "^7.0.0", "primeicons": "^7.0.0",
"primereact": "^10.9.2", "primereact": "^10.9.2",

View File

@@ -1,6 +1,6 @@
{ {
"name": "ripster-frontend", "name": "ripster-frontend",
"version": "0.10.2-1", "version": "0.10.2-2",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "ripster", "name": "ripster",
"version": "0.10.2-1", "version": "0.10.2-2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ripster", "name": "ripster",
"version": "0.10.2-1", "version": "0.10.2-2",
"devDependencies": { "devDependencies": {
"concurrently": "^9.1.2" "concurrently": "^9.1.2"
} }

View File

@@ -1,7 +1,7 @@
{ {
"name": "ripster", "name": "ripster",
"private": true, "private": true,
"version": "0.10.2-1", "version": "0.10.2-2",
"scripts": { "scripts": {
"dev": "concurrently \"npm run dev --prefix backend\" \"npm run dev --prefix frontend\"", "dev": "concurrently \"npm run dev --prefix backend\" \"npm run dev --prefix frontend\"",
"dev:backend": "npm run dev --prefix backend", "dev:backend": "npm run dev --prefix backend",