minor fixes
Signed-off-by: ari melody <ari@arimelody.me>
This commit is contained in:
parent
5eecef1d78
commit
ae7477f86f
4 changed files with 99 additions and 67 deletions
|
@ -21,9 +21,6 @@ var loudar = Artist{
|
|||
Name: "Loudar",
|
||||
Website: "https://alex.targoninc.com",
|
||||
}
|
||||
var red = Artist{
|
||||
Name: "smoljorb",
|
||||
}
|
||||
|
||||
func make_date_work(date string) time.Time {
|
||||
res, err := time.Parse("2-Jan-2006", date)
|
||||
|
@ -142,29 +139,29 @@ var placeholders = []Album{
|
|||
and the trees in the breeze
|
||||
living my best life`,
|
||||
},
|
||||
{
|
||||
Id: "free2play",
|
||||
Title: "free2play",
|
||||
Type: "upcoming",
|
||||
ReleaseDate: make_date_work("17-Mar-2024"),
|
||||
Buyname: "pre-order",
|
||||
Buylink: "https://arimelody.me/",
|
||||
Description: "hello from your local SPACEGIRL! 💫",
|
||||
Credits: []AlbumCredit{
|
||||
AlbumCredit{
|
||||
Artist: &ari,
|
||||
Role: "vocals",
|
||||
},
|
||||
AlbumCredit{
|
||||
Artist: &ari,
|
||||
Role: "production",
|
||||
},
|
||||
AlbumCredit{
|
||||
Artist: &ari,
|
||||
Role: "artwork",
|
||||
},
|
||||
},
|
||||
},
|
||||
// {
|
||||
// Id: "free2play",
|
||||
// Title: "free2play",
|
||||
// Type: "upcoming",
|
||||
// ReleaseDate: make_date_work("17-Mar-2024"),
|
||||
// Buyname: "pre-order",
|
||||
// Buylink: "https://arimelody.me/",
|
||||
// Description: "hello from your local SPACEGIRL! 💫",
|
||||
// Credits: []AlbumCredit{
|
||||
// AlbumCredit{
|
||||
// Artist: &ari,
|
||||
// Role: "vocals",
|
||||
// },
|
||||
// AlbumCredit{
|
||||
// Artist: &ari,
|
||||
// Role: "production",
|
||||
// },
|
||||
// AlbumCredit{
|
||||
// Artist: &ari,
|
||||
// Role: "artwork",
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
{
|
||||
Id: "dream",
|
||||
Title: "Dream",
|
||||
|
@ -539,10 +536,6 @@ var placeholders = []Album{
|
|||
Artist: &ari,
|
||||
Role: "production",
|
||||
},
|
||||
AlbumCredit{
|
||||
Artist: &red,
|
||||
Role: "artwork",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -568,10 +561,6 @@ var placeholders = []Album{
|
|||
Artist: &ari,
|
||||
Role: "production",
|
||||
},
|
||||
AlbumCredit{
|
||||
Artist: &red,
|
||||
Role: "artwork",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -620,6 +609,6 @@ func QueryAllAlbums() ([]Album) {
|
|||
}
|
||||
|
||||
func QueryAllArtists() ([]Artist) {
|
||||
return []Artist{ ari, zaire, mae, loudar, red }
|
||||
return []Artist{ ari, zaire, mae, loudar }
|
||||
}
|
||||
|
||||
|
|
|
@ -43,26 +43,32 @@ func (album Album) GetUniqueArtists() []Artist {
|
|||
}
|
||||
|
||||
// create a map of artists to prevent duplicates
|
||||
m := map[string]Artist{}
|
||||
res := []Artist{}
|
||||
for _, credit := range album.Credits {
|
||||
artist := *credit.Artist
|
||||
m[artist.Name] = artist
|
||||
exists := false
|
||||
for _, c := range res {
|
||||
if c == *credit.Artist {
|
||||
exists = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if exists {
|
||||
continue
|
||||
}
|
||||
res = append(res, artist)
|
||||
}
|
||||
|
||||
// now create the actual array to send
|
||||
res := []Artist{}
|
||||
for _, artist := range m {
|
||||
res = append(res, artist)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func (album Album) PrintArtists() string {
|
||||
if len(album.Credits) == 1 {
|
||||
return album.Credits[0].Artist.Name
|
||||
artists := album.GetUniqueArtists()
|
||||
if len(artists) == 1 {
|
||||
return artists[0].Name
|
||||
}
|
||||
|
||||
artists := album.GetUniqueArtists()
|
||||
names := []string{}
|
||||
for _, artist := range artists {
|
||||
names = append(names, artist.Name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue