Add all images found for each album in the database
This commit is contained in:
@@ -34,6 +34,7 @@ type Album struct {
|
||||
MbzAlbumArtistID string `structs:"mbz_album_artist_id" json:"mbzAlbumArtistId,omitempty" orm:"column(mbz_album_artist_id)"`
|
||||
MbzAlbumType string `structs:"mbz_album_type" json:"mbzAlbumType,omitempty"`
|
||||
MbzAlbumComment string `structs:"mbz_album_comment" json:"mbzAlbumComment,omitempty"`
|
||||
ImageFiles string `structs:"image_files" json:"imageFiles,omitempty"`
|
||||
CreatedAt time.Time `structs:"created_at" json:"createdAt"`
|
||||
UpdatedAt time.Time `structs:"updated_at" json:"updatedAt"`
|
||||
}
|
||||
|
||||
@@ -71,6 +71,16 @@ func (mf *MediaFile) ContentType() string {
|
||||
|
||||
type MediaFiles []MediaFile
|
||||
|
||||
func (mfs MediaFiles) Dirs() []string {
|
||||
var dirs []string
|
||||
for _, mf := range mfs {
|
||||
dir, _ := filepath.Split(mf.Path)
|
||||
dirs = append(dirs, filepath.Clean(dir))
|
||||
}
|
||||
slices.Sort(dirs)
|
||||
return slices.Compact(dirs)
|
||||
}
|
||||
|
||||
func (mfs MediaFiles) ToAlbum() Album {
|
||||
a := Album{SongCount: len(mfs)}
|
||||
var fullText []string
|
||||
|
||||
Reference in New Issue
Block a user