1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

* Don't sync empty DbCmd_DeleteFiles & irrelevant DbCmd_LogPlaybacks.

This commit is contained in:
Christian Muehlhaeuser
2011-05-25 04:17:53 +02:00
parent caa8878b25
commit b2c9028b54
4 changed files with 19 additions and 19 deletions

View File

@@ -55,6 +55,7 @@ public:
virtual void exec( DatabaseImpl* ); virtual void exec( DatabaseImpl* );
virtual bool doesMutates() const { return true; } virtual bool doesMutates() const { return true; }
virtual bool localOnly() const { return m_files.isEmpty(); }
virtual void postCommitHook(); virtual void postCommitHook();
QStringList files() const { return m_files; } QStringList files() const { return m_files; }

View File

@@ -28,16 +28,10 @@
using namespace Tomahawk; using namespace Tomahawk;
// After changing a collection, we need to tell other bits of the system:
void void
DatabaseCommand_LogPlayback::postCommitHook() DatabaseCommand_LogPlayback::postCommitHook()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( source().isNull() || source()->collection().isNull() )
{
qDebug() << "Source has gone offline, not emitting to GUI.";
return;
}
connect( this, SIGNAL( trackPlaying( Tomahawk::query_ptr ) ), connect( this, SIGNAL( trackPlaying( Tomahawk::query_ptr ) ),
source().data(), SLOT( onPlaybackStarted( Tomahawk::query_ptr ) ), Qt::QueuedConnection ); source().data(), SLOT( onPlaybackStarted( Tomahawk::query_ptr ) ), Qt::QueuedConnection );
@@ -58,10 +52,6 @@ DatabaseCommand_LogPlayback::postCommitHook()
if ( source()->isLocal() ) if ( source()->isLocal() )
{ {
// Only tell remote sources about tracks that we listen to long enough
if ( m_secsPlayed < 20 )
return;
Servent::instance()->triggerDBSync(); Servent::instance()->triggerDBSync();
} }
} }
@@ -103,3 +93,11 @@ DatabaseCommand_LogPlayback::exec( DatabaseImpl* dbi )
query.exec(); query.exec();
} }
bool
DatabaseCommand_LogPlayback::localOnly() const
{
return m_secsPlayed < 20;
}

View File

@@ -68,6 +68,7 @@ public:
virtual bool doesMutates() const { return true; } virtual bool doesMutates() const { return true; }
virtual bool singletonCmd() const { return ( m_action == Started ); } virtual bool singletonCmd() const { return ( m_action == Started ); }
virtual bool localOnly() const;
QString artist() const { return m_artist; } QString artist() const { return m_artist; }
void setArtist( const QString& s ) { m_artist = s; } void setArtist( const QString& s ) { m_artist = s; }