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