Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/SpotifyArduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions src/SpotifyArduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ enum SpotifyPlayingType
{
track,
episode,
ad,
other
};

Expand Down Expand Up @@ -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);
Expand Down