mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-27 21:57:17 +01:00
feat(library): add library path and name fields to album and mediafile models
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
b4c3590bfe
commit
8c8ef7836a
8 changed files with 13 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"`
|
||||
|
|
|
|||
|
|
@ -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"`
|
||||
|
|
|
|||
|
|
@ -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"),
|
||||
|
|
|
|||
|
|
@ -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{}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ const AlbumInfo = (props) => {
|
|||
const record = useRecordContext(props)
|
||||
const data = {
|
||||
album: <TextField source={'name'} />,
|
||||
libraryName: <TextField source="libraryName" />,
|
||||
albumArtist: (
|
||||
<ArtistLinkField source="albumArtist" record={record} limit={Infinity} />
|
||||
),
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ export const SongInfo = (props) => {
|
|||
]
|
||||
const data = {
|
||||
path: <PathField />,
|
||||
libraryName: <TextField source="libraryName" />,
|
||||
album: (
|
||||
<AlbumLinkField source="album" sortByOrder={'ASC'} record={record} />
|
||||
),
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue