Expand GetArtists with album details, download info, and generic MonitorState enum
This commit is contained in:
@@ -20,7 +20,7 @@ type Album struct {
|
|||||||
Label string
|
Label string
|
||||||
Genres []string
|
Genres []string
|
||||||
CoverURL string
|
CoverURL string
|
||||||
IsMonitored bool
|
MonitorState MonitorState
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ func NewAlbumRepository(pool *pgxpool.Pool) *AlbumRepository {
|
|||||||
|
|
||||||
func (r *AlbumRepository) Create(ctx context.Context, a *Album) error {
|
func (r *AlbumRepository) Create(ctx context.Context, a *Album) error {
|
||||||
_, err := r.pool.Exec(ctx,
|
_, err := r.pool.Exec(ctx,
|
||||||
`INSERT INTO albums (external_id, artist_id, title, album_type, release_date, total_tracks, total_discs, label, genres, cover_url, is_monitored)
|
`INSERT INTO albums (external_id, artist_id, title, album_type, release_date, total_tracks, total_discs, label, genres, cover_url, monitor_state)
|
||||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
|
||||||
ON CONFLICT (external_id) DO UPDATE SET
|
ON CONFLICT (external_id) DO UPDATE SET
|
||||||
title = EXCLUDED.title,
|
title = EXCLUDED.title,
|
||||||
@@ -46,8 +46,12 @@ func (r *AlbumRepository) Create(ctx context.Context, a *Album) error {
|
|||||||
label = EXCLUDED.label,
|
label = EXCLUDED.label,
|
||||||
genres = EXCLUDED.genres,
|
genres = EXCLUDED.genres,
|
||||||
cover_url = EXCLUDED.cover_url,
|
cover_url = EXCLUDED.cover_url,
|
||||||
|
monitor_state = CASE
|
||||||
|
WHEN albums.monitor_state = 'excluded' THEN albums.monitor_state
|
||||||
|
ELSE EXCLUDED.monitor_state
|
||||||
|
END,
|
||||||
updated_at = NOW()`,
|
updated_at = NOW()`,
|
||||||
a.ExternalID, a.ArtistID, a.Title, a.AlbumType, a.ReleaseDate, a.TotalTracks, a.TotalDiscs, a.Label, a.Genres, a.CoverURL, a.IsMonitored,
|
a.ExternalID, a.ArtistID, a.Title, a.AlbumType, a.ReleaseDate, a.TotalTracks, a.TotalDiscs, a.Label, a.Genres, a.CoverURL, a.MonitorState,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating album: %w", err)
|
return fmt.Errorf("creating album: %w", err)
|
||||||
@@ -58,9 +62,9 @@ func (r *AlbumRepository) Create(ctx context.Context, a *Album) error {
|
|||||||
func (r *AlbumRepository) GetByExternalID(ctx context.Context, externalID string) (*Album, error) {
|
func (r *AlbumRepository) GetByExternalID(ctx context.Context, externalID string) (*Album, error) {
|
||||||
a := &Album{}
|
a := &Album{}
|
||||||
err := r.pool.QueryRow(ctx,
|
err := r.pool.QueryRow(ctx,
|
||||||
`SELECT id, external_id, artist_id, title, album_type, release_date, total_tracks, total_discs, label, genres, cover_url, is_monitored, created_at, updated_at
|
`SELECT id, external_id, artist_id, title, album_type, release_date, total_tracks, total_discs, label, genres, cover_url, monitor_state, created_at, updated_at
|
||||||
FROM albums WHERE external_id = $1`, externalID,
|
FROM albums WHERE external_id = $1`, externalID,
|
||||||
).Scan(&a.ID, &a.ExternalID, &a.ArtistID, &a.Title, &a.AlbumType, &a.ReleaseDate, &a.TotalTracks, &a.TotalDiscs, &a.Label, &a.Genres, &a.CoverURL, &a.IsMonitored, &a.CreatedAt, &a.UpdatedAt)
|
).Scan(&a.ID, &a.ExternalID, &a.ArtistID, &a.Title, &a.AlbumType, &a.ReleaseDate, &a.TotalTracks, &a.TotalDiscs, &a.Label, &a.Genres, &a.CoverURL, &a.MonitorState, &a.CreatedAt, &a.UpdatedAt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("getting album: %w", err)
|
return nil, fmt.Errorf("getting album: %w", err)
|
||||||
}
|
}
|
||||||
@@ -70,9 +74,9 @@ func (r *AlbumRepository) GetByExternalID(ctx context.Context, externalID string
|
|||||||
func (r *AlbumRepository) GetByID(ctx context.Context, id string) (*Album, error) {
|
func (r *AlbumRepository) GetByID(ctx context.Context, id string) (*Album, error) {
|
||||||
a := &Album{}
|
a := &Album{}
|
||||||
err := r.pool.QueryRow(ctx,
|
err := r.pool.QueryRow(ctx,
|
||||||
`SELECT id, external_id, artist_id, title, album_type, release_date, total_tracks, total_discs, label, genres, cover_url, is_monitored, created_at, updated_at
|
`SELECT id, external_id, artist_id, title, album_type, release_date, total_tracks, total_discs, label, genres, cover_url, monitor_state, created_at, updated_at
|
||||||
FROM albums WHERE id = $1`, id,
|
FROM albums WHERE id = $1`, id,
|
||||||
).Scan(&a.ID, &a.ExternalID, &a.ArtistID, &a.Title, &a.AlbumType, &a.ReleaseDate, &a.TotalTracks, &a.TotalDiscs, &a.Label, &a.Genres, &a.CoverURL, &a.IsMonitored, &a.CreatedAt, &a.UpdatedAt)
|
).Scan(&a.ID, &a.ExternalID, &a.ArtistID, &a.Title, &a.AlbumType, &a.ReleaseDate, &a.TotalTracks, &a.TotalDiscs, &a.Label, &a.Genres, &a.CoverURL, &a.MonitorState, &a.CreatedAt, &a.UpdatedAt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("getting album: %w", err)
|
return nil, fmt.Errorf("getting album: %w", err)
|
||||||
}
|
}
|
||||||
@@ -81,7 +85,7 @@ func (r *AlbumRepository) GetByID(ctx context.Context, id string) (*Album, error
|
|||||||
|
|
||||||
func (r *AlbumRepository) GetByArtistID(ctx context.Context, artistID string) ([]*Album, error) {
|
func (r *AlbumRepository) GetByArtistID(ctx context.Context, artistID string) ([]*Album, error) {
|
||||||
rows, err := r.pool.Query(ctx,
|
rows, err := r.pool.Query(ctx,
|
||||||
`SELECT id, external_id, artist_id, title, album_type, release_date, total_tracks, total_discs, label, genres, cover_url, is_monitored, created_at, updated_at
|
`SELECT id, external_id, artist_id, title, album_type, release_date, total_tracks, total_discs, label, genres, cover_url, monitor_state, created_at, updated_at
|
||||||
FROM albums WHERE artist_id = $1 ORDER BY release_date DESC`, artistID,
|
FROM albums WHERE artist_id = $1 ORDER BY release_date DESC`, artistID,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -92,7 +96,7 @@ func (r *AlbumRepository) GetByArtistID(ctx context.Context, artistID string) ([
|
|||||||
var albums []*Album
|
var albums []*Album
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
a := &Album{}
|
a := &Album{}
|
||||||
if err := rows.Scan(&a.ID, &a.ExternalID, &a.ArtistID, &a.Title, &a.AlbumType, &a.ReleaseDate, &a.TotalTracks, &a.TotalDiscs, &a.Label, &a.Genres, &a.CoverURL, &a.IsMonitored, &a.CreatedAt, &a.UpdatedAt); err != nil {
|
if err := rows.Scan(&a.ID, &a.ExternalID, &a.ArtistID, &a.Title, &a.AlbumType, &a.ReleaseDate, &a.TotalTracks, &a.TotalDiscs, &a.Label, &a.Genres, &a.CoverURL, &a.MonitorState, &a.CreatedAt, &a.UpdatedAt); err != nil {
|
||||||
return nil, fmt.Errorf("scanning album: %w", err)
|
return nil, fmt.Errorf("scanning album: %w", err)
|
||||||
}
|
}
|
||||||
albums = append(albums, a)
|
albums = append(albums, a)
|
||||||
@@ -102,8 +106,8 @@ func (r *AlbumRepository) GetByArtistID(ctx context.Context, artistID string) ([
|
|||||||
|
|
||||||
func (r *AlbumRepository) GetMonitored(ctx context.Context) ([]*Album, error) {
|
func (r *AlbumRepository) GetMonitored(ctx context.Context) ([]*Album, error) {
|
||||||
rows, err := r.pool.Query(ctx,
|
rows, err := r.pool.Query(ctx,
|
||||||
`SELECT id, external_id, artist_id, title, album_type, release_date, total_tracks, total_discs, label, genres, cover_url, is_monitored, created_at, updated_at
|
`SELECT id, external_id, artist_id, title, album_type, release_date, total_tracks, total_discs, label, genres, cover_url, monitor_state, created_at, updated_at
|
||||||
FROM albums WHERE is_monitored = TRUE ORDER BY release_date DESC`,
|
FROM albums WHERE monitor_state = 'monitored' ORDER BY release_date DESC`,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("listing monitored albums: %w", err)
|
return nil, fmt.Errorf("listing monitored albums: %w", err)
|
||||||
@@ -113,7 +117,7 @@ func (r *AlbumRepository) GetMonitored(ctx context.Context) ([]*Album, error) {
|
|||||||
var albums []*Album
|
var albums []*Album
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
a := &Album{}
|
a := &Album{}
|
||||||
if err := rows.Scan(&a.ID, &a.ExternalID, &a.ArtistID, &a.Title, &a.AlbumType, &a.ReleaseDate, &a.TotalTracks, &a.TotalDiscs, &a.Label, &a.Genres, &a.CoverURL, &a.IsMonitored, &a.CreatedAt, &a.UpdatedAt); err != nil {
|
if err := rows.Scan(&a.ID, &a.ExternalID, &a.ArtistID, &a.Title, &a.AlbumType, &a.ReleaseDate, &a.TotalTracks, &a.TotalDiscs, &a.Label, &a.Genres, &a.CoverURL, &a.MonitorState, &a.CreatedAt, &a.UpdatedAt); err != nil {
|
||||||
return nil, fmt.Errorf("scanning album: %w", err)
|
return nil, fmt.Errorf("scanning album: %w", err)
|
||||||
}
|
}
|
||||||
albums = append(albums, a)
|
albums = append(albums, a)
|
||||||
@@ -121,12 +125,12 @@ func (r *AlbumRepository) GetMonitored(ctx context.Context) ([]*Album, error) {
|
|||||||
return albums, nil
|
return albums, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *AlbumRepository) SetMonitored(ctx context.Context, id string, monitored bool) error {
|
func (r *AlbumRepository) SetMonitorState(ctx context.Context, id string, state MonitorState) error {
|
||||||
_, err := r.pool.Exec(ctx,
|
_, err := r.pool.Exec(ctx,
|
||||||
`UPDATE albums SET is_monitored = $1, updated_at = NOW() WHERE id = $2`, monitored, id,
|
`UPDATE albums SET monitor_state = $1, updated_at = NOW() WHERE id = $2`, state, id,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("updating monitored state: %w", err)
|
return fmt.Errorf("updating monitor state: %w", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,6 @@ import (
|
|||||||
"github.com/jackc/pgx/v5/pgxpool"
|
"github.com/jackc/pgx/v5/pgxpool"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ArtistMonitorState string
|
|
||||||
|
|
||||||
const (
|
|
||||||
ArtistMonitored ArtistMonitorState = "monitored"
|
|
||||||
ArtistUnmonitored ArtistMonitorState = "unmonitored"
|
|
||||||
ArtistExcluded ArtistMonitorState = "excluded"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Artist struct {
|
type Artist struct {
|
||||||
ID string
|
ID string
|
||||||
ExternalID string
|
ExternalID string
|
||||||
@@ -24,7 +16,7 @@ type Artist struct {
|
|||||||
Country string
|
Country string
|
||||||
Genres []string
|
Genres []string
|
||||||
ImageURL string
|
ImageURL string
|
||||||
MonitorState ArtistMonitorState
|
MonitorState MonitorState
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,14 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type MonitorState string
|
||||||
|
|
||||||
|
const (
|
||||||
|
Monitored MonitorState = "monitored"
|
||||||
|
Unmonitored MonitorState = "unmonitored"
|
||||||
|
Excluded MonitorState = "excluded"
|
||||||
|
)
|
||||||
|
|
||||||
type DB struct {
|
type DB struct {
|
||||||
Pool *pgxpool.Pool
|
Pool *pgxpool.Pool
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,16 @@ func (s *MetadataService) GetAlbum(ctx context.Context, albumID string) (*metada
|
|||||||
return album, nil
|
return album, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *MetadataService) GetArtistAlbums(ctx context.Context, artistExternalID string) ([]*metadataPb.Album, error) {
|
||||||
|
resp, err := s.client.GetArtistAlbums(ctx, &metadataPb.GetArtistAlbumsRequest{
|
||||||
|
ArtistId: artistExternalID,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("fetching artist albums: %w", err)
|
||||||
|
}
|
||||||
|
return resp.GetAlbums(), nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *MetadataService) GetArtistByExternalID(ctx context.Context, externalID string) (*database.Artist, error) {
|
func (s *MetadataService) GetArtistByExternalID(ctx context.Context, externalID string) (*database.Artist, error) {
|
||||||
return s.artists.GetByExternalID(ctx, externalID)
|
return s.artists.GetByExternalID(ctx, externalID)
|
||||||
}
|
}
|
||||||
@@ -50,6 +60,10 @@ func (s *MetadataService) GetAlbumByExternalID(ctx context.Context, externalID s
|
|||||||
return s.albums.GetByExternalID(ctx, externalID)
|
return s.albums.GetByExternalID(ctx, externalID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *MetadataService) GetAlbumsByArtistID(ctx context.Context, artistID string) ([]*database.Album, error) {
|
||||||
|
return s.albums.GetByArtistID(ctx, artistID)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *MetadataService) persistArtist(ctx context.Context, album *metadataPb.Album) {
|
func (s *MetadataService) persistArtist(ctx context.Context, album *metadataPb.Album) {
|
||||||
if len(album.GetArtists()) == 0 {
|
if len(album.GetArtists()) == 0 {
|
||||||
return
|
return
|
||||||
@@ -68,7 +82,7 @@ func (s *MetadataService) persistArtist(ctx context.Context, album *metadataPb.A
|
|||||||
Country: artist.GetCountry(),
|
Country: artist.GetCountry(),
|
||||||
Genres: genres,
|
Genres: genres,
|
||||||
ImageURL: artist.GetImageUrl(),
|
ImageURL: artist.GetImageUrl(),
|
||||||
MonitorState: database.ArtistMonitored,
|
MonitorState: database.Monitored,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn().Err(err).Str("name", artist.GetName()).Msg("failed to persist artist")
|
log.Warn().Err(err).Str("name", artist.GetName()).Msg("failed to persist artist")
|
||||||
@@ -109,7 +123,7 @@ func (s *MetadataService) persistAlbum(ctx context.Context, album *metadataPb.Al
|
|||||||
Label: labelName,
|
Label: labelName,
|
||||||
Genres: genres,
|
Genres: genres,
|
||||||
CoverURL: album.GetCoverUrl(),
|
CoverURL: album.GetCoverUrl(),
|
||||||
IsMonitored: true,
|
MonitorState: database.Monitored,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn().Err(err).Str("title", album.GetTitle()).Msg("failed to persist album")
|
log.Warn().Err(err).Str("title", album.GetTitle()).Msg("failed to persist album")
|
||||||
|
|||||||
+74
-8
@@ -96,6 +96,11 @@ func (service *MusicAgregatorService) GetArtists(ctx context.Context, _ *pb.GetA
|
|||||||
|
|
||||||
artists := make([]*pb.ArtistSummary, 0, len(dbArtists))
|
artists := make([]*pb.ArtistSummary, 0, len(dbArtists))
|
||||||
for _, a := range dbArtists {
|
for _, a := range dbArtists {
|
||||||
|
albums, err := service.buildAlbumsForArtist(ctx, a)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn().Err(err).Str("artist", a.Name).Msg("failed to build album details, returning artist without albums")
|
||||||
|
}
|
||||||
|
|
||||||
artists = append(artists, &pb.ArtistSummary{
|
artists = append(artists, &pb.ArtistSummary{
|
||||||
Id: a.ID,
|
Id: a.ID,
|
||||||
ExternalId: a.ExternalID,
|
ExternalId: a.ExternalID,
|
||||||
@@ -105,12 +110,73 @@ func (service *MusicAgregatorService) GetArtists(ctx context.Context, _ *pb.GetA
|
|||||||
Genres: a.Genres,
|
Genres: a.Genres,
|
||||||
ImageUrl: a.ImageURL,
|
ImageUrl: a.ImageURL,
|
||||||
MonitorState: toProtoMonitorState(a.MonitorState),
|
MonitorState: toProtoMonitorState(a.MonitorState),
|
||||||
|
Albums: albums,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pb.GetArtistsResponse{Artists: artists}, nil
|
return &pb.GetArtistsResponse{Artists: artists}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (service *MusicAgregatorService) buildAlbumsForArtist(ctx context.Context, artist *database.Artist) ([]*pb.AlbumDetail, error) {
|
||||||
|
metadataAlbums, err := service.metadata.GetArtistAlbums(ctx, artist.ExternalID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("fetching metadata albums: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
dbAlbums, err := service.metadata.GetAlbumsByArtistID(ctx, artist.ID)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn().Err(err).Str("artist_id", artist.ID).Msg("failed to get local albums")
|
||||||
|
dbAlbums = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
dbAlbumsByExternalID := make(map[string]*database.Album, len(dbAlbums))
|
||||||
|
for _, a := range dbAlbums {
|
||||||
|
dbAlbumsByExternalID[a.ExternalID] = a
|
||||||
|
}
|
||||||
|
|
||||||
|
albums := make([]*pb.AlbumDetail, 0, len(metadataAlbums))
|
||||||
|
for _, ma := range metadataAlbums {
|
||||||
|
detail := &pb.AlbumDetail{
|
||||||
|
ExternalId: ma.GetId(),
|
||||||
|
Title: ma.GetTitle(),
|
||||||
|
AlbumType: ma.GetAlbumType(),
|
||||||
|
ReleaseDate: ma.GetReleaseDate(),
|
||||||
|
TotalTracks: ma.GetTotalTracks(),
|
||||||
|
TotalDiscs: ma.GetTotalDiscs(),
|
||||||
|
CoverUrl: ma.GetCoverUrl(),
|
||||||
|
}
|
||||||
|
|
||||||
|
if ma.GetLabel() != nil {
|
||||||
|
detail.Label = ma.GetLabel().GetName()
|
||||||
|
}
|
||||||
|
for _, g := range ma.GetGenres() {
|
||||||
|
detail.Genres = append(detail.Genres, g.GetName())
|
||||||
|
}
|
||||||
|
|
||||||
|
if dbAlbum, ok := dbAlbumsByExternalID[ma.GetId()]; ok {
|
||||||
|
detail.Id = dbAlbum.ID
|
||||||
|
detail.MonitorState = toProtoMonitorState(dbAlbum.MonitorState)
|
||||||
|
|
||||||
|
downloads, err := service.downloads.GetByAlbumID(ctx, dbAlbum.ID)
|
||||||
|
if err == nil && len(downloads) > 0 {
|
||||||
|
best := downloads[0]
|
||||||
|
detail.Download = &pb.DownloadInfo{
|
||||||
|
State: best.State,
|
||||||
|
Format: best.Format,
|
||||||
|
Quality: best.Quality,
|
||||||
|
SavePath: best.SavePath,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
detail.MonitorState = pb.MonitorState_MONITOR_STATE_UNMONITORED
|
||||||
|
}
|
||||||
|
|
||||||
|
albums = append(albums, detail)
|
||||||
|
}
|
||||||
|
|
||||||
|
return albums, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (service *MusicAgregatorService) MonitorAlbum(ctx context.Context, req *pb.MonitorAlbumRequest) (*pb.MonitorAlbumResponse, error) {
|
func (service *MusicAgregatorService) MonitorAlbum(ctx context.Context, req *pb.MonitorAlbumRequest) (*pb.MonitorAlbumResponse, error) {
|
||||||
album, err := service.metadata.GetAlbum(ctx, req.GetAlbumId())
|
album, err := service.metadata.GetAlbum(ctx, req.GetAlbumId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -404,16 +470,16 @@ func buildMonitoredRelease(p parsedItem) *pb.MonitoredRelease {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func toProtoMonitorState(state database.ArtistMonitorState) pb.ArtistMonitorState {
|
func toProtoMonitorState(state database.MonitorState) pb.MonitorState {
|
||||||
switch state {
|
switch state {
|
||||||
case database.ArtistMonitored:
|
case database.Monitored:
|
||||||
return pb.ArtistMonitorState_ARTIST_MONITOR_STATE_MONITORED
|
return pb.MonitorState_MONITOR_STATE_MONITORED
|
||||||
case database.ArtistUnmonitored:
|
case database.Unmonitored:
|
||||||
return pb.ArtistMonitorState_ARTIST_MONITOR_STATE_UNMONITORED
|
return pb.MonitorState_MONITOR_STATE_UNMONITORED
|
||||||
case database.ArtistExcluded:
|
case database.Excluded:
|
||||||
return pb.ArtistMonitorState_ARTIST_MONITOR_STATE_EXCLUDED
|
return pb.MonitorState_MONITOR_STATE_EXCLUDED
|
||||||
default:
|
default:
|
||||||
return pb.ArtistMonitorState_ARTIST_MONITOR_STATE_UNSPECIFIED
|
return pb.MonitorState_MONITOR_STATE_UNSPECIFIED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ message GetArtistsResponse {
|
|||||||
repeated ArtistSummary artists = 1;
|
repeated ArtistSummary artists = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ArtistMonitorState {
|
enum MonitorState {
|
||||||
ARTIST_MONITOR_STATE_UNSPECIFIED = 0;
|
MONITOR_STATE_UNSPECIFIED = 0;
|
||||||
ARTIST_MONITOR_STATE_MONITORED = 1;
|
MONITOR_STATE_MONITORED = 1;
|
||||||
ARTIST_MONITOR_STATE_UNMONITORED = 2;
|
MONITOR_STATE_UNMONITORED = 2;
|
||||||
ARTIST_MONITOR_STATE_EXCLUDED = 3;
|
MONITOR_STATE_EXCLUDED = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ArtistSummary {
|
message ArtistSummary {
|
||||||
@@ -48,7 +48,30 @@ message ArtistSummary {
|
|||||||
string country = 5;
|
string country = 5;
|
||||||
repeated string genres = 6;
|
repeated string genres = 6;
|
||||||
string image_url = 7;
|
string image_url = 7;
|
||||||
ArtistMonitorState monitor_state = 8;
|
MonitorState monitor_state = 8;
|
||||||
|
repeated AlbumDetail albums = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AlbumDetail {
|
||||||
|
string id = 1;
|
||||||
|
string external_id = 2;
|
||||||
|
string title = 3;
|
||||||
|
string album_type = 4;
|
||||||
|
string release_date = 5;
|
||||||
|
int32 total_tracks = 6;
|
||||||
|
int32 total_discs = 7;
|
||||||
|
string cover_url = 8;
|
||||||
|
repeated string genres = 9;
|
||||||
|
string label = 10;
|
||||||
|
MonitorState monitor_state = 11;
|
||||||
|
DownloadInfo download = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DownloadInfo {
|
||||||
|
string state = 1;
|
||||||
|
string format = 2;
|
||||||
|
string quality = 3;
|
||||||
|
string save_path = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message MonitoredRelease {
|
message MonitoredRelease {
|
||||||
|
|||||||
Reference in New Issue
Block a user