Skip to content

Commit

Permalink
fix: adjust qualityprofile items to always include items key
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackDark committed Jan 10, 2025
1 parent f841617 commit 9ed86b3
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/quality-profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,25 @@ export const mapQualities = (qd_source: MergedQualityDefinitionResource[], value
allowed: obj.enabled ?? true,
id: 1000 + i,
name: obj.name,
items: obj.qualities?.map<MergedQualityProfileQualityItemResource>((obj2) => {
const qd = qdMap.get(obj2);

const returnObject: MergedQualityProfileQualityItemResource = {
quality: {
id: qd?.quality?.id,
name: obj2,
resolution: qd?.quality?.resolution,
source: qd?.quality?.source,
},
};

qdMap.delete(obj2);

return returnObject;
}),
items:
obj.qualities?.map<MergedQualityProfileQualityItemResource>((obj2) => {
const qd = qdMap.get(obj2);

const returnObject: MergedQualityProfileQualityItemResource = {
quality: {
id: qd?.quality?.id,
name: obj2,
resolution: qd?.quality?.resolution,
source: qd?.quality?.source,
},
allowed: obj.enabled ?? true,
items: [],
};

qdMap.delete(obj2);

return returnObject;
}) || [],
};
} else {
const serverQD = qdMap.get(obj.name);
Expand Down Expand Up @@ -136,6 +139,7 @@ export const mapQualities = (qd_source: MergedQualityDefinitionResource[], value
for (const [key, value] of qdMap.entries()) {
missingQualities.push({
allowed: false,
items: [],
//id: qualIndex++, // ID not allowed if not enabled
quality: {
id: value.quality?.id,
Expand Down

0 comments on commit 9ed86b3

Please sign in to comment.