Add discs to album

This commit is contained in:
Deluan 2023-12-08 19:29:16 -05:00
parent 0ca0d5da22
commit af7eead037
7 changed files with 165 additions and 14 deletions

View file

@ -1,6 +1,7 @@
package model
import (
"strconv"
"time"
"github.com/navidrome/navidrome/utils/slice"
@ -33,6 +34,7 @@ type Album struct {
Size int64 `structs:"size" json:"size"`
Genre string `structs:"genre" json:"genre"`
Genres Genres `structs:"-" json:"genres"`
Discs Discs `structs:"discs" json:"discs,omitempty"`
FullText string `structs:"full_text" json:"fullText"`
SortAlbumName string `structs:"sort_album_name" json:"sortAlbumName,omitempty"`
SortArtistName string `structs:"sort_artist_name" json:"sortArtistName,omitempty"`
@ -60,6 +62,15 @@ func (a Album) CoverArtID() ArtworkID {
return artworkIDFromAlbum(a)
}
type Discs map[string]string
func (d *Discs) Add(discNumber int, discSubtitle string) {
if *d == nil {
*d = Discs{}
}
(*d)[strconv.Itoa(discNumber)] = discSubtitle
}
type DiscID struct {
AlbumID string `json:"albumId"`
ReleaseDate string `json:"releaseDate"`