aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Garrelou <simon@sixfoisneuf.fr>2024-09-15 17:11:53 +0200
committerSimon Garrelou <simon@sixfoisneuf.fr>2024-09-15 17:11:53 +0200
commit93328e0ca6c0ed2424550c7a164b4b1212a554b6 (patch)
tree863df40f473d7ca3f301de60de924a4dd81a90ac
parent27846cc74ad0524f7701effb969c66bff2167c22 (diff)
downloadtermsonic-93328e0ca6c0ed2424550c7a164b4b1212a554b6.tar.gz
termsonic-93328e0ca6c0ed2424550c7a164b4b1212a554b6.zip
Use GetAlbum / GetArtist instead of GetMusicDirectory
-rw-r--r--src/page_artists.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/page_artists.go b/src/page_artists.go
index 0b5a0be..eeb10b7 100644
--- a/src/page_artists.go
+++ b/src/page_artists.go
@@ -29,15 +29,15 @@ func (a *app) artistsPage() tview.Primitive {
29 sel := node.GetReference().(selection) 29 sel := node.GetReference().(selection)
30 if sel.entryType == "artist" { 30 if sel.entryType == "artist" {
31 if node.GetChildren() != nil || len(node.GetChildren()) == 0 { 31 if node.GetChildren() != nil || len(node.GetChildren()) == 0 {
32 artist, err := a.sub.GetMusicDirectory(sel.id) 32 artist, err := a.sub.GetArtist(sel.id)
33 if err != nil { 33 if err != nil {
34 LogErrorf("loading album '%s': %v", sel.id, err) 34 LogErrorf("loading artist '%s': %v", sel.id, err)
35 a.alert("Error: %v", err) 35 a.alert("Error: %v", err)
36 return 36 return
37 } 37 }
38 38
39 for _, album := range artist.Child { 39 for _, album := range artist.Album {
40 subnode := tview.NewTreeNode(album.Title) 40 subnode := tview.NewTreeNode(album.Name)
41 subnode.SetReference(selection{"album", album.ID}) 41 subnode.SetReference(selection{"album", album.ID})
42 subnode.SetColor(tcell.ColorBlue) 42 subnode.SetColor(tcell.ColorBlue)
43 subnode.SetSelectable(true) 43 subnode.SetSelectable(true)
@@ -113,14 +113,15 @@ func (a *app) refreshArtists() error {
113} 113}
114 114
115func (a *app) loadAlbumInPanel(id string) error { 115func (a *app) loadAlbumInPanel(id string) error {
116 album, err := a.sub.GetMusicDirectory(id) 116 album, err := a.sub.GetAlbum(id)
117 if err != nil { 117 if err != nil {
118 panic(err)
118 return err 119 return err
119 } 120 }
120 121
121 a.songsList.Clear() 122 a.songsList.Clear()
122 a.currentSongs = album.Child 123 a.currentSongs = album.Song
123 for _, song := range album.Child { 124 for _, song := range album.Song {
124 txt := fmt.Sprintf("%-2d - %s", song.Track, song.Title) 125 txt := fmt.Sprintf("%-2d - %s", song.Track, song.Title)
125 126
126 a.songsList.AddItem(txt, "", 0, func() { 127 a.songsList.AddItem(txt, "", 0, func() {