Skip to content

Commit

Permalink
album/release-group support
Browse files Browse the repository at this point in the history
  • Loading branch information
Lombardoc4 authored and Borewit committed Feb 26, 2024
1 parent bd375b3 commit d4a7376
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/coverartarchive-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export class CoverArtArchiveApi {
*
* @param releaseId MusicBrainz Release MBID
*/
public async getReleaseCovers(releaseId: string, coverType?: 'front' | 'back'): Promise<ICoverInfo> {
const path = ['release', releaseId];
public async getReleaseCovers(releaseId: string, releaseType: 'release' | 'release-group' = 'release', coverType?: 'front' | 'back'): Promise<ICoverInfo> {
const path = [releaseType, releaseId];
if (coverType) {
path.push(coverType);
}
Expand Down
9 changes: 9 additions & 0 deletions test/test-musicbrainz-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,4 +907,13 @@ describe('Cover Art Archive API', function() {
assert.ok(releaseCoverInfo.images.length > 0, 'releaseCoverInfo.images.length > 0');
});

it('Get front cover for release group Formidable', async () => {
const coverArtArchiveApiClient = new CoverArtArchiveApi();
const releaseCoverInfo = await coverArtArchiveApiClient.getReleaseCovers(mbid.releaseGroup.Formidable);
assert.isDefined(releaseCoverInfo);
assert.strictEqual(releaseCoverInfo.release, releaseMusicBrainzBaseUrl + mbid.releaseGroup.Formidable, 'releaseCoverInfo.release');
assert.isDefined(releaseCoverInfo.images, 'releaseCoverInfo.images');
assert.ok(releaseCoverInfo.images.length > 0, 'releaseCoverInfo.images.length > 0');
});

});

0 comments on commit d4a7376

Please sign in to comment.