Skip to content

Commit

Permalink
Remember last known device
Browse files Browse the repository at this point in the history
  • Loading branch information
kraxarn committed Feb 20, 2020
1 parent 7684b52 commit 81b1792
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/spotify/spotify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,15 @@ bool Spotify::setDevice(Device device)
device.id
};
put("me/player", &body);
currentDevice = device.id;
return true;
}

bool Spotify::playTracks(QStringList &trackIds)
{
QVariantMap body;
body["uris"] = trackIds;
put("me/player/play", &body);
put(QString("me/player/play?device_id=%1").arg(currentDevice), &body);
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion src/spotify/spotify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ namespace spt
void setVolume(int volume);
void setRepeat(QString state);
private:
QDateTime *lastAuth;
QDateTime *lastAuth;
QString currentDevice;
QNetworkAccessManager *networkManager;
/**
* Prepare network request with auth header
Expand Down

0 comments on commit 81b1792

Please sign in to comment.