mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 09:04:33 +02:00
* Fixed artist & album retrieval.
This commit is contained in:
@@ -75,7 +75,7 @@ Album::get( const Tomahawk::artist_ptr& artist, const QString& name, bool autoCr
|
|||||||
album->setWeakRef( album.toWeakRef() );
|
album->setWeakRef( album.toWeakRef() );
|
||||||
album->loadId( autoCreate );
|
album->loadId( autoCreate );
|
||||||
|
|
||||||
s_albumsByName[ key ] = album;
|
s_albumsByName.insert( key, album );
|
||||||
|
|
||||||
return album;
|
return album;
|
||||||
}
|
}
|
||||||
@@ -88,6 +88,10 @@ Album::get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& ar
|
|||||||
static QMutex s_mutex;
|
static QMutex s_mutex;
|
||||||
|
|
||||||
QMutexLocker lock( &s_idCacheMutex );
|
QMutexLocker lock( &s_idCacheMutex );
|
||||||
|
if ( s_albumsByName.contains( name ) )
|
||||||
|
{
|
||||||
|
return s_albumsByName.value( name );
|
||||||
|
}
|
||||||
if ( s_albumsById.contains( id ) )
|
if ( s_albumsById.contains( id ) )
|
||||||
{
|
{
|
||||||
return s_albumsById.value( id );
|
return s_albumsById.value( id );
|
||||||
@@ -97,7 +101,10 @@ Album::get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& ar
|
|||||||
a->setWeakRef( a.toWeakRef() );
|
a->setWeakRef( a.toWeakRef() );
|
||||||
|
|
||||||
if ( id > 0 )
|
if ( id > 0 )
|
||||||
|
{
|
||||||
s_albumsById.insert( id, a );
|
s_albumsById.insert( id, a );
|
||||||
|
s_albumsByName.insert( name, a );
|
||||||
|
}
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
@@ -73,7 +73,7 @@ Artist::get( const QString& name, bool autoCreate )
|
|||||||
artist->setWeakRef( artist.toWeakRef() );
|
artist->setWeakRef( artist.toWeakRef() );
|
||||||
artist->loadId( autoCreate );
|
artist->loadId( autoCreate );
|
||||||
|
|
||||||
s_artistsByName[ name ] = artist;
|
s_artistsByName.insert( name, artist );
|
||||||
|
|
||||||
return artist;
|
return artist;
|
||||||
}
|
}
|
||||||
@@ -83,6 +83,10 @@ artist_ptr
|
|||||||
Artist::get( unsigned int id, const QString& name )
|
Artist::get( unsigned int id, const QString& name )
|
||||||
{
|
{
|
||||||
QMutexLocker lock( &s_idCacheMutex );
|
QMutexLocker lock( &s_idCacheMutex );
|
||||||
|
if ( s_artistsByName.contains( name ) )
|
||||||
|
{
|
||||||
|
return s_artistsByName.value( name );
|
||||||
|
}
|
||||||
if ( s_artistsById.contains( id ) )
|
if ( s_artistsById.contains( id ) )
|
||||||
{
|
{
|
||||||
return s_artistsById.value( id );
|
return s_artistsById.value( id );
|
||||||
@@ -92,7 +96,10 @@ Artist::get( unsigned int id, const QString& name )
|
|||||||
a->setWeakRef( a.toWeakRef() );
|
a->setWeakRef( a.toWeakRef() );
|
||||||
|
|
||||||
if ( id > 0 )
|
if ( id > 0 )
|
||||||
|
{
|
||||||
|
s_artistsByName.insert( name, a );
|
||||||
s_artistsById.insert( id, a );
|
s_artistsById.insert( id, a );
|
||||||
|
}
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@@ -257,7 +264,6 @@ Artist::id() const
|
|||||||
|
|
||||||
if ( waiting )
|
if ( waiting )
|
||||||
{
|
{
|
||||||
|
|
||||||
#if ID_THREAD_DEBUG
|
#if ID_THREAD_DEBUG
|
||||||
qDebug() << Q_FUNC_INFO << "Asked for artist ID and NOT loaded yet" << m_name << m_idFuture.isFinished();
|
qDebug() << Q_FUNC_INFO << "Asked for artist ID and NOT loaded yet" << m_name << m_idFuture.isFinished();
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user