Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"jsxImportSource": "preact"
},
"fmt": {
"exclude": ["**/*.svg", "./testdata/**"],
"exclude": ["**/*.svg", "./testdata/**", ".idea"],
"lineWidth": 120,
"proseWrap": "preserve",
"singleQuote": true,
Expand Down
24 changes: 16 additions & 8 deletions harmonizer/compatibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,22 @@ interface CompatibilityCheck<Entity> {
errorMessage: string;
}

const releaseCompatibilityChecks: CompatibilityCheck<HarmonyRelease>[] = [{
property: (release) => release.gtin ? Number(release.gtin) : undefined,
errorMessage: 'Providers have returned multiple different GTIN',
}, {
property: trackCountSummary,
// TODO: Support releases with the same total track count.
errorMessage: 'Providers have returned incompatible track lists',
}];
const releaseCompatibilityChecks: CompatibilityCheck<HarmonyRelease>[] = [
{
property: (release) => release.gtin ? Number(release.gtin) : undefined,
errorMessage: 'Providers have returned multiple different GTIN',
},
{
property: trackCountSummary,
// TODO: Support releases with the same total track count.
errorMessage: 'Providers have returned incompatible track lists',
},
// Explicit and clean versions should be separate releases
{
property: (release) => release.advisoryRating,
errorMessage: 'Providers have returned conflicting advisory ratings',
},
];

/** Determines whether the given releases are compatible and can be merged (with the primary provider's data). */
function determineReleaseIncompatibility(
Expand Down
2 changes: 2 additions & 0 deletions harmonizer/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ export const immutableReleaseProperties = [
'images', // TODO: make images combinable? combine if not only front covers?
'copyright',
'credits',
'advisoryRating',
] as const satisfies Array<keyof HarmonyRelease>;

/** Track properties which have to be taken from one provider and can not be combined from data of multiple providers. */
export const immutableTrackProperties = [
'isrc',
'length',
'advisoryRating',
] as const satisfies Array<keyof HarmonyTrack>;

/** Track properties which can be combined from data of multiple providers. */
Expand Down
12 changes: 12 additions & 0 deletions harmonizer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export type HarmonyRelease = {
availableIn?: CountryCode[];
excludedFrom?: CountryCode[];
releaseGroup?: ResolvableEntity;
advisoryRating?: AdvisoryRating;
info: ReleaseInfo;
};

Expand All @@ -92,6 +93,7 @@ export type HarmonyTrack = {
type?: TrackType;
isrc?: string;
availableIn?: CountryCode[];
advisoryRating?: AdvisoryRating;
recording?: ResolvableEntity;
};

Expand Down Expand Up @@ -155,6 +157,16 @@ export type TrackType = 'audio' | 'video';
/** Global Trade Item Number with 8 (EAN-8), 12 (UPC), 13 (EAN-13) or 14 digits. */
export type GTIN = number | string;

/**
* The advisory rating of a release or track:
* - `clean`: An edited version of an originally explicit release/track. This is **not** the
* same as a release that was non-explicit to begin with. In that case, no `AdvisoryRating`
* is specified.
* - `explicit`: The release/track has some sort of parental advisory warning. Possibly due
* to the contents of its lyrics and/or cover art.
*/
export type AdvisoryRating = 'clean' | 'explicit';

export type Language = {
/** ISO 639-3 three letter code. */
code: string;
Expand Down
Loading
Loading