diff --git a/src/SpotifyArduino.cpp b/src/SpotifyArduino.cpp index e3fe108..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) { @@ -615,6 +622,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..ed6dfb7 100644 --- a/src/SpotifyArduino.h +++ b/src/SpotifyArduino.h @@ -97,6 +97,7 @@ enum SpotifyPlayingType { track, episode, + ad, other }; @@ -226,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);