1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 06:36:55 +02:00

* Filter out tracks with bogus mtime when trying to load recent albums.

This commit is contained in:
Christian Muehlhaeuser
2013-06-22 12:38:30 +02:00
parent bc6194c14e
commit 1879101c48

View File

@@ -39,7 +39,8 @@ DatabaseCommand_AllAlbums::DatabaseCommand_AllAlbums( const Tomahawk::collection
DatabaseCommand_AllAlbums::~DatabaseCommand_AllAlbums() DatabaseCommand_AllAlbums::~DatabaseCommand_AllAlbums()
{} {
}
void void
@@ -54,7 +55,7 @@ DatabaseCommand_AllAlbums::execForArtist( DatabaseImpl* dbi )
{ {
TomahawkSqlQuery query = dbi->newquery(); TomahawkSqlQuery query = dbi->newquery();
QList<Tomahawk::album_ptr> al; QList<Tomahawk::album_ptr> al;
QString orderToken, sourceToken, filterToken, tables; QString orderToken, sourceToken, filterToken, timeToken, tables;
switch ( m_sortOrder ) switch ( m_sortOrder )
{ {
@@ -63,6 +64,7 @@ DatabaseCommand_AllAlbums::execForArtist( DatabaseImpl* dbi )
case ModificationTime: case ModificationTime:
orderToken = "file.mtime"; orderToken = "file.mtime";
timeToken = QString( "AND file.mtime <= %1" ).arg( QDateTime::currentDateTimeUtc().toTime_t() );
} }
if ( !m_collection.isNull() ) if ( !m_collection.isNull() )
@@ -89,10 +91,11 @@ DatabaseCommand_AllAlbums::execForArtist( DatabaseImpl* dbi )
"LEFT OUTER JOIN album ON file_join.album = album.id " "LEFT OUTER JOIN album ON file_join.album = album.id "
"WHERE file.id = file_join.file " "WHERE file.id = file_join.file "
"AND file_join.artist = %2 " "AND file_join.artist = %2 "
"%3 %4 %5 %6 %7" "%3 %4 %5 %6 %7 %8"
).arg( tables ) ).arg( tables )
.arg( m_artist->id() ) .arg( m_artist->id() )
.arg( sourceToken ) .arg( sourceToken )
.arg( timeToken )
.arg( filterToken ) .arg( filterToken )
.arg( m_sortOrder > 0 ? QString( "ORDER BY %1" ).arg( orderToken ) : QString() ) .arg( m_sortOrder > 0 ? QString( "ORDER BY %1" ).arg( orderToken ) : QString() )
.arg( m_sortDescending ? "DESC" : QString() ) .arg( m_sortDescending ? "DESC" : QString() )