feat(S02/T01): Added CoverArtGroupURL for release-group cover art, conc…
- backend/explore/coverart.go - backend/explore/explore.go - backend/explore/coverart_test.go - frontend/wailsjs/go/explore/Service.js - frontend/wailsjs/go/explore/Service.d.ts
This commit is contained in:
@@ -2,7 +2,10 @@ package explore
|
||||
|
||||
import "fmt"
|
||||
|
||||
const coverArtBaseURL = "https://coverartarchive.org/release"
|
||||
const (
|
||||
coverArtBaseURL = "https://coverartarchive.org/release"
|
||||
coverArtGroupBaseURL = "https://coverartarchive.org/release-group"
|
||||
)
|
||||
|
||||
// CoverArtURL returns the Cover Art Archive URL for the 250px
|
||||
// front cover of the given release MBID.
|
||||
@@ -16,3 +19,18 @@ func CoverArtURL(releaseMBID string) string {
|
||||
func CoverArtURLSize(releaseMBID string, size int) string {
|
||||
return fmt.Sprintf("%s/%s/front-%d", coverArtBaseURL, releaseMBID, size)
|
||||
}
|
||||
|
||||
// CoverArtGroupURL returns the Cover Art Archive URL for the 250px
|
||||
// front cover of the given release group MBID. Search results
|
||||
// return release group MBIDs (not release MBIDs), so this is the
|
||||
// correct endpoint for displaying cover art in search results.
|
||||
func CoverArtGroupURL(releaseGroupMBID string) string {
|
||||
return fmt.Sprintf("%s/%s/front-250", coverArtGroupBaseURL, releaseGroupMBID)
|
||||
}
|
||||
|
||||
// CoverArtGroupURLSize returns the Cover Art Archive URL for the
|
||||
// front cover of the given release group MBID at the specified
|
||||
// pixel size. Common sizes are 250, 500, and 1200.
|
||||
func CoverArtGroupURLSize(releaseGroupMBID string, size int) string {
|
||||
return fmt.Sprintf("%s/%s/front-%d", coverArtGroupBaseURL, releaseGroupMBID, size)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user