Skip to content

Commit 4efb66e

Browse files
committed
Release v1.2.1
1 parent 7c6978b commit 4efb66e

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Set default line ending behavior for all text files
2+
* text=auto

qpm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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",

qpm.shared.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
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",

src/Spotify/Json.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,21 @@ std::vector<Image> getImagesFromJson(const rapidjson::Value& json) {
143143
Playlist 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()) {

0 commit comments

Comments
 (0)