Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f98af5e
feat(Spotify): initial provider implementation
phw Jun 7, 2024
a5a25b9
feat(Spotify): GTIN search
phw Jun 7, 2024
32fc11f
fix(Spotify): perform requests without region code
phw Jun 7, 2024
3be0f60
feat(Spotify): extend copyright info with ℗ or © depending on type
phw Jun 7, 2024
10ef94a
feat(Spotify): split release labels on slashes
phw Jun 7, 2024
6d13657
fix(Spotify): try UPC barcode search with prefixed zeros
phw Jun 8, 2024
faa7ce7
fix(Spotify): load full track length for releases with > 50 tracks
phw Jun 8, 2024
7549841
feat(Spotify): load extended track information to get ISRCs
phw Jun 8, 2024
b3c4d50
refactor(provider): moved Tidal / Spotify artwork selection into gene…
phw Jun 8, 2024
4f2c7c2
refactor(provider): moved caching of API access token to MetadataApiP…
phw Jun 8, 2024
eed1b38
fix(Spotify): SimplifiedTrack.is_playable is optional and often not p…
phw Jun 8, 2024
0e64616
refactor(Spotify): only pad GTIN to 14 characters once
phw Jun 9, 2024
60ecdf9
refactor(Spotify): use Array.push instead of concat.
phw Jun 9, 2024
44a31b1
feat(Spotify): only perform loading of full track info if ISRCs are r…
phw Jun 9, 2024
7da2a9a
refactor(provider): moved label splitting code into utility function …
phw Jun 9, 2024
0045aa0
feat(Spotify): throw specific SpotifyResponseError
phw Jun 10, 2024
3532ac4
fix(Spotify): set region on GTIN lookups, do ID lookups without region
phw Jun 10, 2024
75fe532
refactor(Spotify): simplify code for retrying different length GTIN
phw Jun 10, 2024
3b2e188
fix(Spotify): for GTIN search try all regions
phw Jun 10, 2024
94a0dd1
fix(Spotify): missing parameter documentation
phw Jun 10, 2024
72bbf23
refactor(Spotify): set region only on gtin lookup URLs
phw Jun 10, 2024
4f583c9
fix(Spotify): intl-* paths seem to indicate language, not region
phw Jun 10, 2024
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
6 changes: 2 additions & 4 deletions providers/Deezer/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { availableRegions } from './regions.ts';
import { type CacheEntry, MetadataApiProvider, type ProviderOptions, ReleaseApiLookup } from '@/providers/base.ts';
import { DurationPrecision, FeatureQuality, FeatureQualityMap } from '@/providers/features.ts';
import { parseHyphenatedDate, PartialDate } from '@/utils/date.ts';
import { splitLabels } from '@/utils/label.ts';
import { ResponseError } from '@/utils/errors.ts';
import { formatGtin } from '@/utils/gtin.ts';

Expand Down Expand Up @@ -174,10 +175,7 @@ export class DeezerReleaseLookup extends ReleaseApiLookup<DeezerProvider, Releas
}],
media,
releaseDate: parseHyphenatedDate(rawRelease.release_date),
// split label string using slashes if the results have at least 3 characters
labels: rawRelease.label.split(/(?<=[^/]{3,})\/(?=[^/]{3,})/).map((label) => ({
name: label.trim(),
})),
labels: splitLabels(rawRelease.label),
status: 'Official',
packaging: 'None',
images: [{
Expand Down
126 changes: 126 additions & 0 deletions providers/Spotify/api_types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
export type SimplifiedAlbum = {
id: string;
type: 'album';
href: string;
name: string;
uri: string;
artists: SimplifiedArtist[];
album_type: AlbumType;
total_tracks: number;
release_date: string;
release_date_precision: ReleaseDatePrecision;
external_urls: { spotify: string };
images: Image[];
available_markets: string[];
restrictions: { reason: string };
};

export type Album = SimplifiedAlbum & {
tracks: ResultList<SimplifiedTrack>;
copyrights: Copyright[];
external_ids: ExternalIds;
genres: string[];
label: string;
/** The popularity of the album. The value will be between 0 and 100, with 100 being the most popular. */
popularity: number;
};

export type SimplifiedArtist = {
id: string;
type: 'artist';
href: string;
name: string;
uri: string;
};

export type Artist = SimplifiedArtist & {
followers: { href: string; total: number };
};

export type LinkedTrack = {
id: string;
type: 'track';
href: string;
uri: string;
external_urls: { spotify: string };
};

export type SimplifiedTrack = LinkedTrack & {
name: string;
artists: SimplifiedArtist[];
track_number: number;
disc_number: number;
duration_ms: number;
explicit: boolean;
is_playable: boolean | undefined;
is_local: boolean;
preview_url: string;
linked_from: LinkedTrack | undefined;
available_markets: string[];
restrictions: { reason: string };
};

export type Track = SimplifiedTrack & {
album: Album;
artists: Artist[];
external_ids: ExternalIds;
popularity: number;
};

export type Image = {
url: string;
width: number;
height: number;
};

export type Copyright = {
text: string;
type: CopyrightType;
};

export type ExternalIds = {
isrc: string;
ean: string;
upc: string;
};

export type ReleaseDatePrecision = 'year' | 'month' | 'day';

export type AlbumType = 'album' | 'single' | 'compilation';

export type CopyrightType = 'C' | 'P';

export type BaseResultList = {
href: string;
limit: number;
offset: number;
total: number;
next: string;
previous: string;
};

export type TrackList = BaseResultList & {
tracks: Track[];
};

export type ResultList<T> = BaseResultList & {
items: T[];
};

export type SearchResult = {
albums: ResultList<SimplifiedAlbum>;
tracks: ResultList<SimplifiedTrack>;
artists: ResultList<SimplifiedArtist>;
// Unsupported / not needed:
// Playlists: ResultList<Playlist>;
// Shows: ResultList<Show>;
// Episodes: ResultList<Episode>;
// Audiobooks: ResultList<Audiobook>;
};

export type ApiError = {
error: {
status: number;
message: string;
};
};
Loading