Skip to content

Commit

Permalink
fixed subsonic struct
Browse files Browse the repository at this point in the history
  • Loading branch information
LumePart committed Jan 1, 2025
1 parent 2b7843c commit 4ab032d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/subsonic.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ type SubResponse struct {
} `json:"song"`
} `json:"searchResult3,omitempty"`
Playlists struct {
Playlist []Playlist `json:"playlist"`
Playlist []Playlist `json:"playlist,omitempty"`
} `json:"playlists,omitempty"`
Playlist Playlist `json:"playlist,omitempty"`
} `json:"subsonic-response"`
}

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

body, err := subsonicRequest(reqParam, cfg)

var playlist Playlist
if err := parseResp(body, &playlist); err != nil {
var resp SubResponse
if err := parseResp(body, &resp); err != nil {
return "", err
}
if err != nil {
return "", err
}
return playlist.ID, nil
return resp.SubsonicResponse.Playlist.ID, nil
}

func subsonicScan(cfg Config) error {
Expand Down

0 comments on commit 4ab032d

Please sign in to comment.