1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

Write more Spotify activity to non-debug logs

This commit is contained in:
Uwe L. Korn
2014-07-20 17:25:54 +01:00
parent e61edf8ef3
commit aab5a6c550

View File

@@ -211,7 +211,7 @@ SpotifyAccount::hookupResolver()
path = data.scriptPath; path = data.scriptPath;
} }
qDebug() << "Starting spotify resolver with path:" << path; tLog( LOGVERBOSE ) << "Starting spotify resolver with path:" << path;
if ( !m_spotifyResolver.isNull() ) if ( !m_spotifyResolver.isNull() )
{ {
delete m_spotifyResolver.data(); delete m_spotifyResolver.data();
@@ -246,10 +246,10 @@ SpotifyAccount::killExistingResolvers()
QProcess p; QProcess p;
#if defined(Q_OS_UNIX) #if defined(Q_OS_UNIX)
const int ret = p.execute( "killall -9 spotify_tomahawkresolver" ); const int ret = p.execute( "killall -9 spotify_tomahawkresolver" );
qDebug() << "Tried to killall -9 spotify_tomahawkresolver with return code:" << ret; tLog( LOGVERBOSE ) << "Tried to killall -9 spotify_tomahawkresolver with return code:" << ret;
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
const int ret = p.execute( "taskkill.exe /F /im spotify_tomahawkresolver.exe" ); const int ret = p.execute( "taskkill.exe /F /im spotify_tomahawkresolver.exe" );
qDebug() << "Tried to taskkill.exe /F /im spotify_tomahawkresolver.exe with return code:" << ret; tLog( LOGVERBOSE ) << "Tried to taskkill.exe /F /im spotify_tomahawkresolver.exe with return code:" << ret;
#endif #endif
} }
@@ -296,7 +296,7 @@ SpotifyAccount::authenticate()
const Attica::Content res = AtticaManager::instance()->resolverForId( s_resolverId ); const Attica::Content res = AtticaManager::instance()->resolverForId( s_resolverId );
const AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( res ); const AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( res );
qDebug() << "Spotify account authenticating..."; tLog( LOGVERBOSE ) << "Spotify account authenticating...";
const QString path = configuration().value( "path" ).toString(); const QString path = configuration().value( "path" ).toString();
const QFileInfo info( path ); const QFileInfo info( path );
@@ -305,12 +305,12 @@ SpotifyAccount::authenticate()
if ( m_spotifyResolver.isNull() && state == AtticaManager::Installed ) if ( m_spotifyResolver.isNull() && state == AtticaManager::Installed )
{ {
// We don;t have the resolver but it has been installed via attica already, so lets just turn it on // We don;t have the resolver but it has been installed via attica already, so lets just turn it on
qDebug() << "No valid spotify resolver running, but attica reports it is installed, so start it up"; tLog( LOGVERBOSE ) << "No valid spotify resolver running, but attica reports it is installed, so start it up";
hookupResolver(); hookupResolver();
} }
else if ( m_spotifyResolver.isNull() || manualResolverRemoved ) else if ( m_spotifyResolver.isNull() || manualResolverRemoved )
{ {
qDebug() << "Got null resolver but asked to authenticate, so installing if we have one from attica:" << res.isValid() << res.id(); tLog( LOGVERBOSE ) << "Got null resolver but asked to authenticate, so installing if we have one from attica:" << res.isValid() << res.id();
if ( res.isValid() && !res.id().isEmpty() ) if ( res.isValid() && !res.id().isEmpty() )
AtticaManager::instance()->installResolver( res, false ); AtticaManager::instance()->installResolver( res, false );
else else
@@ -322,12 +322,12 @@ SpotifyAccount::authenticate()
} }
else if ( !m_spotifyResolver.data()->running() ) else if ( !m_spotifyResolver.data()->running() )
{ {
qDebug() << "Spotify resolver exists but stopped, starting"; tLog( LOGVERBOSE ) << "Spotify resolver exists but stopped, starting";
m_spotifyResolver.data()->start(); m_spotifyResolver.data()->start();
} }
else else
{ {
qDebug() << "Spotify resolver exists and is running, ignore authentication attempt"; tLog( LOGVERBOSE ) << "Spotify resolver exists and is running, ignore authentication attempt";
} }
emit connectionStateChanged( connectionState() ); emit connectionStateChanged( connectionState() );
@@ -429,7 +429,7 @@ SpotifyAccount::setManualResolverPath( const QString &resolverPath )
void void
SpotifyAccount::starTrack(const QString &artist, const QString &title, const bool starred) SpotifyAccount::starTrack(const QString &artist, const QString &title, const bool starred)
{ {
qDebug() << Q_FUNC_INFO << artist << title << starred; tLog( LOGVERBOSE ) << Q_FUNC_INFO << artist << title << starred;
QVariantMap msg; QVariantMap msg;
msg[ "_msgtype" ] = "setStarred"; msg[ "_msgtype" ] = "setStarred";
msg[ "starred" ] = starred; msg[ "starred" ] = starred;
@@ -442,7 +442,7 @@ SpotifyAccount::starTrack(const QString &artist, const QString &title, const boo
void void
SpotifyAccount::privateModeChanged() SpotifyAccount::privateModeChanged()
{ {
qDebug() << Q_FUNC_INFO << "Sending privateMode"; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Sending privateMode";
QVariantMap msg; QVariantMap msg;
msg[ "_msgtype" ] = "setPrivacyMode"; msg[ "_msgtype" ] = "setPrivacyMode";
msg[ "private" ] = ( m_configWidget.data()->persitentPrivacy() || TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::PublicListening ); msg[ "private" ] = ( m_configWidget.data()->persitentPrivacy() || TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::PublicListening );
@@ -823,7 +823,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
m_configWidget.data()->loginResponse( true, QString(), creds[ "username" ].toString() ); m_configWidget.data()->loginResponse( true, QString(), creds[ "username" ].toString() );
} }
qDebug() << "Set creds:" << creds.value( "username" ) << creds.value( "password" ) << msg.value( "username" ) << msg.value( "password" ); tLog( LOGVERBOSE ) << "Set creds:" << creds.value( "username" ) << creds.value( "password" ) << msg.value( "username" ) << msg.value( "password" );
QVariantHash config = configuration(); QVariantHash config = configuration();
config[ "hasMigrated" ] = true; config[ "hasMigrated" ] = true;
@@ -865,7 +865,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
if ( name.isNull() || plid.isNull() || revid.isNull() ) if ( name.isNull() || plid.isNull() || revid.isNull() )
{ {
qDebug() << "Did not get name and plid and revid for spotify playlist:" << name << plid << revid << plMap; tLog( LOGVERBOSE ) << "Did not get name and plid and revid for spotify playlist:" << name << plid << revid << plMap;
continue; continue;
} }
@@ -889,7 +889,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
SpotifyPlaylistInfo* info = m_allSpotifyPlaylists[ plid ]; SpotifyPlaylistInfo* info = m_allSpotifyPlaylists[ plid ];
if( (info && info->starContainer ) && loveSync() ) if( (info && info->starContainer ) && loveSync() )
{ {
qDebug() << Q_FUNC_INFO << "SKIPPING" << msgType; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "SKIPPING" << msgType;
return; return;
} }
@@ -930,7 +930,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
SpotifyPlaylistInfo* info = m_allSpotifyPlaylists[ plid ]; SpotifyPlaylistInfo* info = m_allSpotifyPlaylists[ plid ];
if( (info && info->starContainer ) && loveSync() ) if( (info && info->starContainer ) && loveSync() )
{ {
qDebug() << Q_FUNC_INFO << "SKIPPING" << msgType; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "SKIPPING" << msgType;
return; return;
} }
SpotifyPlaylistUpdater* updater = m_updaters[ plid ]; SpotifyPlaylistUpdater* updater = m_updaters[ plid ];
@@ -958,7 +958,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
SpotifyPlaylistInfo* info = m_allSpotifyPlaylists[ plid ]; SpotifyPlaylistInfo* info = m_allSpotifyPlaylists[ plid ];
if( (info && info->starContainer ) && loveSync() ) if( (info && info->starContainer ) && loveSync() )
{ {
qDebug() << Q_FUNC_INFO << "SKIPPING" << msgType; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "SKIPPING" << msgType;
return; return;
} }
SpotifyPlaylistUpdater* updater = m_updaters[ plid ]; SpotifyPlaylistUpdater* updater = m_updaters[ plid ];
@@ -991,14 +991,14 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
// We should already be syncing this playlist if we get updates for it // We should already be syncing this playlist if we get updates for it
//Q_ASSERT( m_updaters.contains( plid ) ); //Q_ASSERT( m_updaters.contains( plid ) );
qDebug() << Q_FUNC_INFO; tLog( LOGVERBOSE ) << Q_FUNC_INFO;
if ( !m_updaters.contains( plid ) ) if ( !m_updaters.contains( plid ) )
return; return;
SpotifyPlaylistInfo* info = m_allSpotifyPlaylists[ plid ]; SpotifyPlaylistInfo* info = m_allSpotifyPlaylists[ plid ];
if( (info && info->starContainer ) && loveSync() ) if( (info && info->starContainer ) && loveSync() )
{ {
qDebug() << Q_FUNC_INFO << "SKIPPING" << msgType; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "SKIPPING" << msgType;
return; return;
} }
SpotifyPlaylistUpdater* updater = m_updaters[ plid ]; SpotifyPlaylistUpdater* updater = m_updaters[ plid ];
@@ -1012,7 +1012,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
if( info && info->name != title ) if( info && info->name != title )
{ {
qDebug() << "Playlist renamed fetched in tomahawk"; tLog( LOGVERBOSE ) << "Playlist renamed fetched in tomahawk";
updater->spotifyPlaylistRenamed( title, newRev, oldRev ); updater->spotifyPlaylistRenamed( title, newRev, oldRev );
} }
@@ -1049,7 +1049,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
if ( m_configWidget.data() ) if ( m_configWidget.data() )
m_configWidget.data()->setPlaylists( QList< SpotifyPlaylistInfo* >() ); m_configWidget.data()->setPlaylists( QList< SpotifyPlaylistInfo* >() );
qDebug() << "User changed message from spotify:" << rmsg; tLog( LOGVERBOSE ) << "User changed message from spotify:" << rmsg;
} }
else if ( msgType == "loginResponse" ) else if ( msgType == "loginResponse" )
{ {
@@ -1091,7 +1091,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
const bool loggedIn = msg.value( "loggedIn" ).toBool(); const bool loggedIn = msg.value( "loggedIn" ).toBool();
const QString username = msg.value( "username" ).toString(); const QString username = msg.value( "username" ).toString();
qDebug() << "Got status message with login info:" << loggedIn << username; tLog( LOGVERBOSE ) << "Got status message with login info:" << loggedIn << username;
if ( !loggedIn || username.isEmpty() || credentials().value( "username").toString() != username ) if ( !loggedIn || username.isEmpty() || credentials().value( "username").toString() != username )
{ {
@@ -1213,7 +1213,7 @@ SpotifyAccount::saveConfig()
m_configWidget.data()->saveSettings(); m_configWidget.data()->saveSettings();
foreach ( SpotifyPlaylistInfo* pl, m_allSpotifyPlaylists.values() ) foreach ( SpotifyPlaylistInfo* pl, m_allSpotifyPlaylists.values() )
{ {
// qDebug() << "Checking changed state:" << pl->changed << "name:" << pl->name << "sync" << pl->sync << "starred:" << pl->starContainer; // tLog( LOGVERBOSE ) << "Checking changed state:" << pl->changed << "name:" << pl->name << "sync" << pl->sync << "starred:" << pl->starContainer;
if ( pl->changed ) if ( pl->changed )
{ {
pl->changed = false; pl->changed = false;
@@ -1298,7 +1298,7 @@ SpotifyAccount::startPlaylistSyncWithPlaylist( const QString& msgType, const QVa
const bool collaborative = msg.value( "collaborative" ).toBool(); const bool collaborative = msg.value( "collaborative" ).toBool();
const bool owner = msg.value( "owner" ).toBool(); const bool owner = msg.value( "owner" ).toBool();
qDebug() << "Starting sync with pl:" << id << name; tLog( LOGVERBOSE ) << "Starting sync with pl:" << id << name;
QVariantList tracks = msg.value( "tracks" ).toList(); QVariantList tracks = msg.value( "tracks" ).toList();
// create a list of query/plentries directly // create a list of query/plentries directly
@@ -1318,7 +1318,7 @@ SpotifyAccount::startPlaylistSyncWithPlaylist( const QString& msgType, const QVa
SpotifyPlaylistInfo* info = m_allSpotifyPlaylists[ id ]; SpotifyPlaylistInfo* info = m_allSpotifyPlaylists[ id ];
if ( loveSync() && ( info && info->starContainer ) ) if ( loveSync() && ( info && info->starContainer ) )
{ {
qDebug() << "Stopping playlist sync in favour for Love Sync"; tLog( LOGVERBOSE ) << "Stopping playlist sync in favour for Love Sync";
stopPlaylistSync( info, true ); stopPlaylistSync( info, true );
} }
else else
@@ -1353,7 +1353,7 @@ SpotifyAccount::playlistCopyCreated( const QString& msgType, const QVariantMap&
{ {
Q_UNUSED( msgType ); Q_UNUSED( msgType );
qDebug() << Q_FUNC_INFO << "Got response from our createCopyPlaylist command, now creating updater and attaching"; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Got response from our createCopyPlaylist command, now creating updater and attaching";
const bool success = msg.value( "success" ).toBool(); const bool success = msg.value( "success" ).toBool();
if ( !success ) if ( !success )
@@ -1367,7 +1367,7 @@ SpotifyAccount::playlistCopyCreated( const QString& msgType, const QVariantMap&
const QString qid = msg.value( "qid" ).toString(); const QString qid = msg.value( "qid" ).toString();
const QString title = msg.value( "playlistname" ).toString(); const QString title = msg.value( "playlistname" ).toString();
qDebug() << Q_FUNC_INFO << msg; tLog( LOGVERBOSE ) << Q_FUNC_INFO << msg;
if ( !m_waitingForCreateReply.contains( qid ) ) if ( !m_waitingForCreateReply.contains( qid ) )
{ {
qWarning() << "Got a createPlaylist reply for a playlist/qid we were not waiting for :-/ " << qid << m_waitingForCreateReply; qWarning() << "Got a createPlaylist reply for a playlist/qid we were not waiting for :-/ " << qid << m_waitingForCreateReply;
@@ -1384,7 +1384,7 @@ SpotifyAccount::playlistCreated( const QString& msgType, const QVariantMap& msg,
{ {
Q_UNUSED( msgType ); Q_UNUSED( msgType );
qDebug() << Q_FUNC_INFO << "Got response from our createPlaylist command, now creating updater and attaching"; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Got response from our createPlaylist command, now creating updater and attaching";
const bool success = msg.value( "success" ).toBool(); const bool success = msg.value( "success" ).toBool();
if ( !success ) if ( !success )
@@ -1510,7 +1510,7 @@ SpotifyAccount::stopPlaylistSync( SpotifyPlaylistInfo* playlist, bool forceDontD
if ( loveSync() && playlist->starContainer ) if ( loveSync() && playlist->starContainer )
{ {
qDebug() << "LoveSync in action, wont remove playlist " << playlist->name; tLog( LOGVERBOSE ) << "LoveSync in action, wont remove playlist " << playlist->name;
} }
else if( !loveSync() ) else if( !loveSync() )
{ {