From 8b622ad49a47f79cfc4ca2d270491bc55e18bad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Fri, 13 Jun 2025 07:21:35 +0200 Subject: [PATCH 1/3] Support currently_playing_type=ad Fixes #76 --- src/SpotifyArduino.cpp | 4 ++++ src/SpotifyArduino.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/SpotifyArduino.cpp b/src/SpotifyArduino.cpp index e3fe108..b007e3b 100644 --- a/src/SpotifyArduino.cpp +++ b/src/SpotifyArduino.cpp @@ -615,6 +615,10 @@ int SpotifyArduino::getCurrentlyPlaying(processCurrentlyPlaying currentlyPlaying { current.currentlyPlayingType = episode; } + else if (strcmp(currently_playing_type, "ad") == 0) + { + current.currentlyPlayingType = ad; + } else { current.currentlyPlayingType = other; diff --git a/src/SpotifyArduino.h b/src/SpotifyArduino.h index 102ca46..56fd263 100644 --- a/src/SpotifyArduino.h +++ b/src/SpotifyArduino.h @@ -97,6 +97,7 @@ enum SpotifyPlayingType { track, episode, + ad, other }; From c366aebb8e4bba88497edc1971ee5ac8a951d4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Fri, 13 Jun 2025 07:23:38 +0200 Subject: [PATCH 2/3] Fix SSL sending empty body Fixes #69 --- src/SpotifyArduino.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/SpotifyArduino.cpp b/src/SpotifyArduino.cpp index b007e3b..a0ea7db 100644 --- a/src/SpotifyArduino.cpp +++ b/src/SpotifyArduino.cpp @@ -83,7 +83,14 @@ int SpotifyArduino::makeRequestWithBody(const char *type, const char *command, c client->println(); - client->print(body); + if (strlen(body) == 0) + { + client->println(); + } + else + { + client->print(body); + } if (client->println() == 0) { From fbd70805fe932e4562b85c46c45530c42a98936a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Fri, 13 Jun 2025 07:27:58 +0200 Subject: [PATCH 3/3] Initialize pointer instance variables --- src/SpotifyArduino.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SpotifyArduino.h b/src/SpotifyArduino.h index 56fd263..ed6dfb7 100644 --- a/src/SpotifyArduino.h +++ b/src/SpotifyArduino.h @@ -227,9 +227,9 @@ class SpotifyArduino private: char _bearerToken[SPOTIFY_ACCESS_TOKEN_LENGTH + 10]; //10 extra is for "bearer " at the start - char *_refreshToken; - const char *_clientId; - const char *_clientSecret; + char *_refreshToken = nullptr; + const char *_clientId = nullptr; + const char *_clientSecret = nullptr; unsigned int timeTokenRefreshed; unsigned int tokenTimeToLiveMs; int commonGetImage(char *imageUrl);