mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-28 03:32:27 +01:00
Send UnLove track to LastFm.
This commit is contained in:
parent
10f607b348
commit
3769ef3208
@ -510,18 +510,22 @@ AudioControls::onLoveButtonClicked( bool checked )
|
||||
trackInfo["artist"] = m_currentTrack->artist()->name();
|
||||
trackInfo["album"] = m_currentTrack->album()->name();
|
||||
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
|
||||
s_acInfoIdentifier, Tomahawk::InfoSystem::InfoLove,
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ) );
|
||||
|
||||
if ( checked )
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
|
||||
s_acInfoIdentifier, Tomahawk::InfoSystem::InfoLove,
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ) );
|
||||
|
||||
DatabaseCommand_SocialAction* cmd = new DatabaseCommand_SocialAction( m_currentTrack, QString( "Love" ), QString( "true") );
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||
ui->loveButton->setPixmap( RESPATH "images/loved.png" );
|
||||
}
|
||||
else
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
|
||||
s_acInfoIdentifier, Tomahawk::InfoSystem::InfoUnLove,
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ) );
|
||||
|
||||
DatabaseCommand_SocialAction* cmd = new DatabaseCommand_SocialAction( m_currentTrack, QString( "Love" ), QString( "false" ) );
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||
ui->loveButton->setPixmap( RESPATH "images/not-loved.png" );
|
||||
|
@ -45,8 +45,8 @@ LastFmPlugin::LastFmPlugin()
|
||||
: InfoPlugin()
|
||||
, m_scrobbler( 0 )
|
||||
{
|
||||
m_supportedGetTypes << InfoAlbumCoverArt << InfoArtistImages << InfoLove;
|
||||
m_supportedPushTypes << InfoSubmitScrobble << InfoSubmitNowPlaying << InfoLove;
|
||||
m_supportedGetTypes << InfoAlbumCoverArt << InfoArtistImages;
|
||||
m_supportedPushTypes << InfoSubmitScrobble << InfoSubmitNowPlaying << InfoLove << InfoUnLove;
|
||||
|
||||
/*
|
||||
Your API Key is 7194b85b6d1f424fe1668173a78c0c4a
|
||||
@ -146,7 +146,8 @@ LastFmPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoTy
|
||||
break;
|
||||
|
||||
case InfoLove:
|
||||
sendLoveSong( input );
|
||||
case InfoUnLove:
|
||||
sendLoveSong( type, input );
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -201,7 +202,7 @@ LastFmPlugin::scrobble()
|
||||
|
||||
|
||||
void
|
||||
LastFmPlugin::sendLoveSong( QVariant input )
|
||||
LastFmPlugin::sendLoveSong( const InfoType type, QVariant input )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
@ -224,7 +225,15 @@ LastFmPlugin::sendLoveSong( QVariant input )
|
||||
bool ok;
|
||||
track.setDuration( hash["duration"].toUInt( &ok ) );
|
||||
track.setSource( lastfm::Track::Player );
|
||||
track.love();
|
||||
|
||||
if ( type == Tomahawk::InfoSystem::InfoLove )
|
||||
{
|
||||
track.love();
|
||||
}
|
||||
else if ( type == Tomahawk::InfoSystem::InfoUnLove )
|
||||
{
|
||||
track.unlove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ private:
|
||||
void scrobble();
|
||||
|
||||
void dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData );
|
||||
void sendLoveSong( QVariant input );
|
||||
void sendLoveSong( const InfoType type, QVariant input );
|
||||
|
||||
lastfm::MutableTrack m_track;
|
||||
lastfm::Audioscrobbler* m_scrobbler;
|
||||
|
Loading…
x
Reference in New Issue
Block a user