mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-02 20:28:14 +02:00
* Only log playbacks which were played for at least 10 seconds (locally) and 20 seconds (remotely).
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -38,7 +38,7 @@ DatabaseCommand_LogPlayback::postCommitHook()
|
|||||||
qDebug() << "Source has gone offline, not emitting to GUI.";
|
qDebug() << "Source has gone offline, not emitting to GUI.";
|
||||||
return;
|
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 );
|
||||||
connect( this, SIGNAL( trackPlayed( Tomahawk::query_ptr ) ),
|
connect( this, SIGNAL( trackPlayed( Tomahawk::query_ptr ) ),
|
||||||
@@ -57,7 +57,13 @@ 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -69,6 +75,8 @@ DatabaseCommand_LogPlayback::exec( DatabaseImpl* dbi )
|
|||||||
|
|
||||||
if ( m_action != Finished )
|
if ( m_action != Finished )
|
||||||
return;
|
return;
|
||||||
|
if ( m_secsPlayed < 10 )
|
||||||
|
return;
|
||||||
|
|
||||||
TomahawkSqlQuery query = dbi->newquery();
|
TomahawkSqlQuery query = dbi->newquery();
|
||||||
query.prepare( "INSERT INTO playback_log(source, track, playtime, secs_played) "
|
query.prepare( "INSERT INTO playback_log(source, track, playtime, secs_played) "
|
||||||
|
Reference in New Issue
Block a user