2020-01-15 04:22:34 +01:00
|
|
|
package model
|
2016-02-26 07:32:31 +01:00
|
|
|
|
2020-10-30 21:08:43 +01:00
|
|
|
import "time"
|
|
|
|
|
2016-02-26 07:32:31 +01:00
|
|
|
type Artist struct {
|
2021-08-01 07:21:20 +02:00
|
|
|
Annotations `structs:"-"`
|
|
|
|
|
2024-02-08 02:45:08 +01:00
|
|
|
ID string `structs:"id" json:"id"`
|
|
|
|
Name string `structs:"name" json:"name"`
|
|
|
|
AlbumCount int `structs:"album_count" json:"albumCount"`
|
|
|
|
SongCount int `structs:"song_count" json:"songCount"`
|
|
|
|
Genres Genres `structs:"-" json:"genres"`
|
|
|
|
FullText string `structs:"full_text" json:"fullText"`
|
|
|
|
SortArtistName string `structs:"sort_artist_name" json:"sortArtistName,omitempty"`
|
|
|
|
OrderArtistName string `structs:"order_artist_name" json:"orderArtistName"`
|
|
|
|
Size int64 `structs:"size" json:"size"`
|
|
|
|
MbzArtistID string `structs:"mbz_artist_id" json:"mbzArtistId,omitempty"`
|
|
|
|
Biography string `structs:"biography" json:"biography,omitempty"`
|
|
|
|
SmallImageUrl string `structs:"small_image_url" json:"smallImageUrl,omitempty"`
|
|
|
|
MediumImageUrl string `structs:"medium_image_url" json:"mediumImageUrl,omitempty"`
|
|
|
|
LargeImageUrl string `structs:"large_image_url" json:"largeImageUrl,omitempty"`
|
|
|
|
ExternalUrl string `structs:"external_url" json:"externalUrl,omitempty"`
|
|
|
|
SimilarArtists Artists `structs:"similar_artists" json:"-"`
|
|
|
|
ExternalInfoUpdatedAt *time.Time `structs:"external_info_updated_at" json:"externalInfoUpdatedAt"`
|
2020-10-30 21:08:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a Artist) ArtistImageUrl() string {
|
|
|
|
if a.LargeImageUrl != "" {
|
|
|
|
return a.LargeImageUrl
|
|
|
|
}
|
2023-04-10 21:34:22 +02:00
|
|
|
if a.MediumImageUrl != "" {
|
|
|
|
return a.MediumImageUrl
|
|
|
|
}
|
2020-10-30 21:08:43 +01:00
|
|
|
return a.SmallImageUrl
|
2016-03-02 15:33:49 +01:00
|
|
|
}
|
2020-01-28 14:22:17 +01:00
|
|
|
|
2022-12-31 22:58:07 +01:00
|
|
|
func (a Artist) CoverArtID() ArtworkID {
|
|
|
|
return artworkIDFromArtist(a)
|
|
|
|
}
|
|
|
|
|
2020-01-18 02:46:19 +01:00
|
|
|
type Artists []Artist
|
|
|
|
|
|
|
|
type ArtistIndex struct {
|
|
|
|
ID string
|
|
|
|
Artists Artists
|
|
|
|
}
|
|
|
|
type ArtistIndexes []ArtistIndex
|
2016-03-02 15:33:49 +01:00
|
|
|
|
|
|
|
type ArtistRepository interface {
|
2020-01-28 14:22:17 +01:00
|
|
|
CountAll(options ...QueryOptions) (int64, error)
|
2020-01-15 14:21:32 +01:00
|
|
|
Exists(id string) (bool, error)
|
2023-11-17 01:20:37 +01:00
|
|
|
Put(m *Artist, colsToUpdate ...string) error
|
2016-03-02 15:33:49 +01:00
|
|
|
Get(id string) (*Artist, error)
|
2020-10-30 21:08:43 +01:00
|
|
|
GetAll(options ...QueryOptions) (Artists, error)
|
2020-01-13 22:02:49 +01:00
|
|
|
Search(q string, offset int, size int) (Artists, error)
|
2020-01-18 02:46:19 +01:00
|
|
|
GetIndex() (ArtistIndexes, error)
|
2020-02-01 03:09:23 +01:00
|
|
|
AnnotatedRepository
|
2016-03-02 15:33:49 +01:00
|
|
|
}
|