diff --git a/model/album.go b/model/album.go index c9dc022cb..a8dcfe682 100644 --- a/model/album.go +++ b/model/album.go @@ -14,6 +14,8 @@ type Album struct { ID string `structs:"id" json:"id"` LibraryID int `structs:"library_id" json:"libraryId"` + LibraryPath string `structs:"-" json:"libraryPath" hash:"ignore"` + LibraryName string `structs:"-" json:"libraryName" hash:"ignore"` Name string `structs:"name" json:"name"` EmbedArtPath string `structs:"embed_art_path" json:"-"` AlbumArtistID string `structs:"album_artist_id" json:"albumArtistId"` // Deprecated, use Participants diff --git a/model/folder.go b/model/folder.go index 12e0d711e..f715f8c11 100644 --- a/model/folder.go +++ b/model/folder.go @@ -17,7 +17,7 @@ import ( type Folder struct { ID string `structs:"id"` LibraryID int `structs:"library_id"` - LibraryPath string `structs:"-" json:"-" hash:"-"` + LibraryPath string `structs:"-" json:"-" hash:"ignore"` Path string `structs:"path"` Name string `structs:"name"` ParentID string `structs:"parent_id"` diff --git a/model/mediafile.go b/model/mediafile.go index 3350c633c..eb98c8979 100644 --- a/model/mediafile.go +++ b/model/mediafile.go @@ -26,8 +26,8 @@ type MediaFile struct { ID string `structs:"id" json:"id" hash:"ignore"` PID string `structs:"pid" json:"-" hash:"ignore"` LibraryID int `structs:"library_id" json:"libraryId" hash:"ignore"` - LibraryPath string `structs:"-" json:"libraryPath" hash:"-"` - LibraryName string `structs:"-" json:"libraryName" hash:"-"` + LibraryPath string `structs:"-" json:"libraryPath" hash:"ignore"` + LibraryName string `structs:"-" json:"libraryName" hash:"ignore"` FolderID string `structs:"folder_id" json:"folderId" hash:"ignore"` Path string `structs:"path" json:"path" hash:"ignore"` Title string `structs:"title" json:"title"` diff --git a/persistence/album_repository.go b/persistence/album_repository.go index 5fe5a7bc3..c291098f9 100644 --- a/persistence/album_repository.go +++ b/persistence/album_repository.go @@ -216,7 +216,8 @@ func (r *albumRepository) UpdateExternalInfo(al *model.Album) error { } func (r *albumRepository) selectAlbum(options ...model.QueryOptions) SelectBuilder { - sql := r.newSelect(options...).Columns("album.*") + sql := r.newSelect(options...).Columns("album.*", "library.path as library_path", "library.name as library_name"). + LeftJoin("library on album.library_id = library.id") sql = r.withAnnotation(sql, "album.id") return r.applyLibraryFilter(sql) } @@ -292,7 +293,6 @@ func (r *albumRepository) TouchByMissingFolder() (int64, error) { // It does not need to load participants, as they are not used by the scanner. func (r *albumRepository) GetTouchedAlbums(libID int) (model.AlbumCursor, error) { query := r.selectAlbum(). - Join("library on library.id = album.library_id"). Where(And{ Eq{"library.id": libID}, ConcatExpr("album.imported_at > library.last_scan_at"), diff --git a/persistence/persistence_suite_test.go b/persistence/persistence_suite_test.go index e196ddd8a..d13b5d9c0 100644 --- a/persistence/persistence_suite_test.go +++ b/persistence/persistence_suite_test.go @@ -48,6 +48,8 @@ func mf(mf model.MediaFile) model.MediaFile { func al(al model.Album) model.Album { al.LibraryID = 1 + al.LibraryPath = "music" + al.LibraryName = "Music Library" al.Discs = model.Discs{} al.Tags = model.Tags{} al.Participants = model.Participants{} diff --git a/ui/src/album/AlbumInfo.jsx b/ui/src/album/AlbumInfo.jsx index 453dbb167..e71cd3d33 100644 --- a/ui/src/album/AlbumInfo.jsx +++ b/ui/src/album/AlbumInfo.jsx @@ -38,6 +38,7 @@ const AlbumInfo = (props) => { const record = useRecordContext(props) const data = { album: , + libraryName: , albumArtist: ( ), diff --git a/ui/src/common/SongInfo.jsx b/ui/src/common/SongInfo.jsx index 9b9ca18cd..1b1a014f1 100644 --- a/ui/src/common/SongInfo.jsx +++ b/ui/src/common/SongInfo.jsx @@ -59,6 +59,7 @@ export const SongInfo = (props) => { ] const data = { path: , + libraryName: , album: ( ), diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json index 2f5c7b6ec..5693c11ed 100644 --- a/ui/src/i18n/en.json +++ b/ui/src/i18n/en.json @@ -12,6 +12,7 @@ "artist": "Artist", "album": "Album", "path": "File path", + "libraryName": "Library", "genre": "Genre", "compilation": "Compilation", "year": "Year", @@ -58,6 +59,7 @@ "playCount": "Plays", "size": "Size", "name": "Name", + "libraryName": "Library", "genre": "Genre", "compilation": "Compilation", "year": "Year",