Disable scrobble love button when playqueue is empty.
This commit is contained in:
committed by
craig.p.drummond
parent
cc163dc3a2
commit
d2b42dc53f
@@ -971,6 +971,12 @@ void MPDConnection::playListInfo()
|
||||
}
|
||||
emit cantataStreams(cStreams, false);
|
||||
emit playlistUpdated(songs);
|
||||
Response status=sendCommand("status");
|
||||
if (status.ok) {
|
||||
MPDStatusValues sv=MPDParseUtils::parseStatus(status.data);
|
||||
lastUpdatePlayQueueVersion=lastStatusPlayQueueVersion=sv.playlist;
|
||||
emit statusUpdated(sv);;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,6 +190,7 @@ Scrobbler::Scrobbler()
|
||||
loadSettings();
|
||||
connect(this, SIGNAL(clientMessage(QString,QString,QString)), MPDConnection::self(), SLOT(sendClientMessage(QString,QString,QString)));
|
||||
connect(MPDConnection::self(), SIGNAL(clientMessageFailed(QString,QString)), SLOT(clientMessageFailed(QString,QString)));
|
||||
connect(MPDConnection::self(), SIGNAL(statusUpdated(MPDStatusValues)), this, SLOT(mpdStatusUpdated(MPDStatusValues)));
|
||||
}
|
||||
|
||||
Scrobbler::~Scrobbler()
|
||||
@@ -707,6 +708,14 @@ void Scrobbler::mpdStateUpdated()
|
||||
}
|
||||
}
|
||||
|
||||
void Scrobbler::mpdStatusUpdated(const MPDStatusValues &vals)
|
||||
{
|
||||
if (!vals.playlistLength) {
|
||||
currentSong.clear();
|
||||
emit songChanged(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Scrobbler::clientMessageFailed(const QString &client, const QString &msg)
|
||||
{
|
||||
if (loveSent && client==scrobblerUrl() && msg==QLatin1String("love")) {
|
||||
|
||||
@@ -40,6 +40,7 @@ class QTimer;
|
||||
class QNetworkReply;
|
||||
class PausableTimer;
|
||||
class Song;
|
||||
struct MPDStatusValues;
|
||||
|
||||
class Scrobbler : public QObject
|
||||
{
|
||||
@@ -51,6 +52,7 @@ public:
|
||||
bool operator==(const Track &o) const { return track==o.track && title==o.title && artist==o.artist &&
|
||||
albumartist==o.albumartist && album==o.album; }
|
||||
bool operator!=(const Track &o) const { return !(*this==o); }
|
||||
void clear() { title=artist=albumartist=album=QString(); track=length=0; timestamp=0; }
|
||||
QString title;
|
||||
QString artist;
|
||||
QString albumartist;
|
||||
@@ -108,6 +110,7 @@ private Q_SLOTS:
|
||||
void authResp();
|
||||
void scrobbleFinished();
|
||||
void mpdStateUpdated();
|
||||
void mpdStatusUpdated(const MPDStatusValues &vals);
|
||||
void clientMessageFailed(const QString &client, const QString &msg);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user