add getAlbumList2

This commit is contained in:
sentriz
2019-05-15 16:03:31 +01:00
parent 4a5b36ccee
commit 5fae510958
7 changed files with 62 additions and 29 deletions

View File

@@ -61,7 +61,7 @@ func readTags(fullPath string) (tag.Metadata, error) {
return tags, nil
}
func updateAlbum(fullPath string, albumArtistID int, title string) {
func updateAlbum(fullPath string, album *db.Album) {
if currentAlbum.ID != 0 {
return
}
@@ -76,8 +76,9 @@ func updateAlbum(fullPath string, albumArtistID int, title string) {
}
currentAlbum = &db.Album{
Path: directory,
AlbumArtistID: albumArtistID,
Title: title,
Title: album.Title,
AlbumArtistID: album.AlbumArtistID,
Year: album.Year,
}
tx.Save(currentAlbum)
}
@@ -182,7 +183,11 @@ func handleTrack(fullPath string, stat os.FileInfo, mime, exten string) error {
//
// set temporary album's basics - will be updated with
// cover after the tracks inserted when we exit the folder
updateAlbum(fullPath, albumArtist.ID, tags.Album())
updateAlbum(fullPath, &db.Album{
AlbumArtistID: albumArtist.ID,
Title: tags.Album(),
Year: tags.Year(),
})
//
// update the track with our new album and finally save
track.AlbumID = currentAlbum.ID

View File

@@ -70,8 +70,8 @@ func setSubsonicRoutes(cont handler.Controller, mux *http.ServeMux) {
// browse by tag
mux.HandleFunc("/rest/getAlbum", withWare(cont.GetAlbum))
mux.HandleFunc("/rest/getAlbum.view", withWare(cont.GetAlbum))
mux.HandleFunc("/rest/getAlbumList2", withWare(cont.GetAlbumList))
mux.HandleFunc("/rest/getAlbumList2.view", withWare(cont.GetAlbumList))
mux.HandleFunc("/rest/getAlbumList2", withWare(cont.GetAlbumListTwo))
mux.HandleFunc("/rest/getAlbumList2.view", withWare(cont.GetAlbumListTwo))
mux.HandleFunc("/rest/getArtist", withWare(cont.GetArtist))
mux.HandleFunc("/rest/getArtist.view", withWare(cont.GetArtist))
mux.HandleFunc("/rest/getArtists", withWare(cont.GetArtists))