HEAVY: finish music service migration, tidy up services, more tests

This commit is contained in:
ari melody 2026-08-01 00:29:31 +01:00
parent 9e311df462
commit 90a671982c
Signed by: ari
GPG key ID: CF99829C92678188
47 changed files with 2698 additions and 902 deletions

View file

@ -34,6 +34,8 @@ const (
EP ReleaseType = "EP"
Compilation ReleaseType = "compilation"
Upcoming ReleaseType = "upcoming"
DEFAULT_RELEASE_ARTWORK_URL = "/img/default-cover-art.png"
)
// GETTERS
@ -52,7 +54,7 @@ func (release Release) PrintReleaseDate() string {
func (release Release) GetArtwork() string {
if release.Artwork == "" {
return "/img/default-cover-art.png"
return DEFAULT_RELEASE_ARTWORK_URL
}
return release.Artwork
}
@ -93,3 +95,20 @@ func (release Release) PrintArtists(only_primary bool, ampersand bool) string {
return strings.Join(names[:], ", ")
}
}
func ValidReleaseType(releaseType string) (ReleaseType, bool) {
switch releaseType {
case "single":
return Single, true
case "album":
return Album, true
case "EP":
return EP, true
case "compilation":
return Compilation, true
case "upcoming":
return Upcoming, true
default:
return "", false
}
}