check for no items in library
This commit is contained in:
parent
7ec0ebb83b
commit
ea69ad6310
@ -278,21 +278,28 @@ func MainView(ctx *gctx.Context, client *spotify.Client) ([]list.Item, error) {
|
|||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
items := []list.Item{}
|
items := []list.Item{}
|
||||||
|
if saved_items != nil && saved_items.Total != 0 {
|
||||||
items = append(items, mainItem{
|
items = append(items, mainItem{
|
||||||
Name: "Saved Tracks",
|
Name: "Saved Tracks",
|
||||||
Desc: fmt.Sprintf("%d saved songs", saved_items.Total),
|
Desc: fmt.Sprintf("%d saved songs", saved_items.Total),
|
||||||
SpotifyItem: saved_items,
|
SpotifyItem: saved_items,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
if albums != nil && albums.Total != 0 {
|
||||||
items = append(items, mainItem{
|
items = append(items, mainItem{
|
||||||
Name: "Albums",
|
Name: "Albums",
|
||||||
Desc: fmt.Sprintf("%d albums", albums.Total),
|
Desc: fmt.Sprintf("%d albums", albums.Total),
|
||||||
SpotifyItem: albums,
|
SpotifyItem: albums,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
if artists != nil && artists.Total != 0 {
|
||||||
items = append(items, mainItem{
|
items = append(items, mainItem{
|
||||||
Name: "Artists",
|
Name: "Artists",
|
||||||
Desc: fmt.Sprintf("%d artists", artists.Total),
|
Desc: fmt.Sprintf("%d artists", artists.Total),
|
||||||
SpotifyItem: artists,
|
SpotifyItem: artists,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
if playlists != nil && playlists.Total != 0 {
|
||||||
for _, playlist := range playlists.Playlists {
|
for _, playlist := range playlists.Playlists {
|
||||||
items = append(items, mainItem{
|
items = append(items, mainItem{
|
||||||
Name: playlist.Name,
|
Name: playlist.Name,
|
||||||
@ -300,5 +307,6 @@ func MainView(ctx *gctx.Context, client *spotify.Client) ([]list.Item, error) {
|
|||||||
SpotifyItem: playlist,
|
SpotifyItem: playlist,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return items, nil
|
return items, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user