Skip to content

Commit 4ab032d

Browse files
committed
fixed subsonic struct
1 parent 2b7843c commit 4ab032d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/subsonic.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ type SubResponse struct {
3636
} `json:"song"`
3737
} `json:"searchResult3,omitempty"`
3838
Playlists struct {
39-
Playlist []Playlist `json:"playlist"`
39+
Playlist []Playlist `json:"playlist,omitempty"`
4040
} `json:"playlists,omitempty"`
41+
Playlist Playlist `json:"playlist,omitempty"`
4142
} `json:"subsonic-response"`
4243
}
4344

@@ -129,14 +130,14 @@ func subsonicPlaylist(cfg Config, tracks []Track) (string, error) {
129130

130131
body, err := subsonicRequest(reqParam, cfg)
131132

132-
var playlist Playlist
133-
if err := parseResp(body, &playlist); err != nil {
133+
var resp SubResponse
134+
if err := parseResp(body, &resp); err != nil {
134135
return "", err
135136
}
136137
if err != nil {
137138
return "", err
138139
}
139-
return playlist.ID, nil
140+
return resp.SubsonicResponse.Playlist.ID, nil
140141
}
141142

142143
func subsonicScan(cfg Config) error {

0 commit comments

Comments
 (0)