File tree Expand file tree Collapse file tree 4 files changed +18
-6
lines changed
Expand file tree Collapse file tree 4 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 1+ # Set default line ending behavior for all text files
2+ * text =auto
Original file line number Diff line number Diff line change 66 "info" : {
77 "name" : " Spotify Search" ,
88 "id" : " spotify-search" ,
9- "version" : " 1.2.0 " ,
9+ "version" : " 1.2.1 " ,
1010 "url" : " https://github.com/TychoTheTaco/Beat-Saber-Spotify-Search" ,
1111 "additionalData" : {
1212 "overrideSoName" : " libspotify-search.so" ,
Original file line number Diff line number Diff line change 77 "info" : {
88 "name" : " Spotify Search" ,
99 "id" : " spotify-search" ,
10- "version" : " 1.2.0 " ,
10+ "version" : " 1.2.1 " ,
1111 "url" : " https://github.com/TychoTheTaco/Beat-Saber-Spotify-Search" ,
1212 "additionalData" : {
1313 "overrideSoName" : " libspotify-search.so" ,
Original file line number Diff line number Diff line change @@ -143,11 +143,21 @@ std::vector<Image> getImagesFromJson(const rapidjson::Value& json) {
143143Playlist getPlaylistFromJson (const rapidjson::Value& json) {
144144 Playlist playlist;
145145
146- playlist.id = json[ " id" ]. GetString ( );
147- playlist.name = json[ " name" ]. GetString ( );
146+ playlist.id = getString ( json, " id" );
147+ playlist.name = getString ( json, " name" );
148148
149- playlist.tracksUrl = json[" tracks" ][" href" ].GetString ();
150- playlist.totalItemCount = json[" tracks" ][" total" ].GetUint64 ();
149+ const rapidjson::Value* tracksJson = nullptr ;
150+ try {
151+ tracksJson = &getObject (json, " items" );
152+ } catch (const std::exception& exception) {
153+ tracksJson = &getObject (json, " tracks" );
154+ }
155+ if (!tracksJson) {
156+ throw std::runtime_error (" Failed to find tracks JSON in playlist" );
157+ }
158+
159+ playlist.tracksUrl = getString (*tracksJson, " href" );
160+ playlist.totalItemCount = (*tracksJson)[" total" ].GetUint64 ();
151161
152162 if (json.HasMember (" images" )) {
153163 if (json[" images" ].IsArray ()) {
You can’t perform that action at this time.
0 commit comments