mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 09:04:33 +02:00
Don't repeat scriptcollection queries when an album has no tracks.
This should never happen with sane data.
This commit is contained in:
@@ -43,6 +43,7 @@ AlbumPlaylistInterface::AlbumPlaylistInterface( Tomahawk::Album* album, Tomahawk
|
|||||||
, m_mode( mode )
|
, m_mode( mode )
|
||||||
, m_collection( collection )
|
, m_collection( collection )
|
||||||
, m_album( QPointer< Tomahawk::Album >( album ) )
|
, m_album( QPointer< Tomahawk::Album >( album ) )
|
||||||
|
, m_lastQueryTimestamp( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@ AlbumPlaylistInterface::setCurrentTrack( unsigned int albumpos )
|
|||||||
QList< Tomahawk::query_ptr >
|
QList< Tomahawk::query_ptr >
|
||||||
AlbumPlaylistInterface::tracks() const
|
AlbumPlaylistInterface::tracks() const
|
||||||
{
|
{
|
||||||
if ( m_queries.isEmpty() && m_album )
|
if ( m_queries.isEmpty() && m_album && QDateTime::currentMSecsSinceEpoch() - m_lastQueryTimestamp > 10000 /*10s*/ )
|
||||||
{
|
{
|
||||||
if ( ( m_mode == Mixed || m_mode == InfoSystemMode ) && !m_infoSystemLoaded )
|
if ( ( m_mode == Mixed || m_mode == InfoSystemMode ) && !m_infoSystemLoaded )
|
||||||
{
|
{
|
||||||
@@ -131,6 +132,8 @@ AlbumPlaylistInterface::tracks() const
|
|||||||
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
|
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
|
||||||
SIGNAL( finished( QString ) ),
|
SIGNAL( finished( QString ) ),
|
||||||
SLOT( infoSystemFinished( QString ) ) );
|
SLOT( infoSystemFinished( QString ) ) );
|
||||||
|
|
||||||
|
const_cast< int& >( m_lastQueryTimestamp ) = QDateTime::currentMSecsSinceEpoch();
|
||||||
}
|
}
|
||||||
else if ( m_mode == DatabaseMode && !m_databaseLoaded )
|
else if ( m_mode == DatabaseMode && !m_databaseLoaded )
|
||||||
{
|
{
|
||||||
@@ -153,6 +156,7 @@ AlbumPlaylistInterface::tracks() const
|
|||||||
|
|
||||||
cmd->enqueue();
|
cmd->enqueue();
|
||||||
}
|
}
|
||||||
|
const_cast< int& >( m_lastQueryTimestamp ) = QDateTime::currentMSecsSinceEpoch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -82,6 +82,8 @@ private:
|
|||||||
Tomahawk::collection_ptr m_collection;
|
Tomahawk::collection_ptr m_collection;
|
||||||
|
|
||||||
QPointer< Tomahawk::Album > m_album;
|
QPointer< Tomahawk::Album > m_album;
|
||||||
|
|
||||||
|
int m_lastQueryTimestamp; //To prevent infinite loops on empty responses. This should not happen, but let's make sure.
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // ns
|
}; // ns
|
||||||
|
Reference in New Issue
Block a user