mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
* Properly load albums from database when getting official releases.
This commit is contained in:
@@ -35,7 +35,7 @@ album_ptr
|
|||||||
Album::get( const Tomahawk::artist_ptr& artist, const QString& name, bool autoCreate )
|
Album::get( const Tomahawk::artist_ptr& artist, const QString& name, bool autoCreate )
|
||||||
{
|
{
|
||||||
int albid = Database::instance()->impl()->albumId( artist->id(), name, autoCreate );
|
int albid = Database::instance()->impl()->albumId( artist->id(), name, autoCreate );
|
||||||
if ( albid < 1 )
|
if ( albid < 1 && autoCreate )
|
||||||
return album_ptr();
|
return album_ptr();
|
||||||
|
|
||||||
return Album::get( albid, name, artist );
|
return Album::get( albid, name, artist );
|
||||||
|
@@ -43,7 +43,7 @@ artist_ptr
|
|||||||
Artist::get( const QString& name, bool autoCreate )
|
Artist::get( const QString& name, bool autoCreate )
|
||||||
{
|
{
|
||||||
int artid = Database::instance()->impl()->artistId( name, autoCreate );
|
int artid = Database::instance()->impl()->artistId( name, autoCreate );
|
||||||
if ( artid < 1 )
|
if ( artid < 1 && autoCreate )
|
||||||
return artist_ptr();
|
return artist_ptr();
|
||||||
|
|
||||||
return Artist::get( artid, name );
|
return Artist::get( artid, name );
|
||||||
|
@@ -337,7 +337,7 @@ DatabaseImpl::trackId( int artistid, const QString& name_orig, bool& isnew )
|
|||||||
query.addBindValue( sortname );
|
query.addBindValue( sortname );
|
||||||
if( !query.exec() )
|
if( !query.exec() )
|
||||||
{
|
{
|
||||||
tDebug() << "Failed to insert track:" << name_orig ;
|
tDebug() << "Failed to insert track:" << name_orig;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,7 +388,7 @@ DatabaseImpl::albumId( int artistid, const QString& name_orig, bool& isnew )
|
|||||||
query.addBindValue( sortname );
|
query.addBindValue( sortname );
|
||||||
if( !query.exec() )
|
if( !query.exec() )
|
||||||
{
|
{
|
||||||
tDebug() << "Failed to insert album: " << name_orig ;
|
tDebug() << "Failed to insert album:" << name_orig;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -835,8 +835,7 @@ TreeModel::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QV
|
|||||||
|
|
||||||
foreach ( const QString& albumName, albums )
|
foreach ( const QString& albumName, albums )
|
||||||
{
|
{
|
||||||
int albumId = 0;
|
Tomahawk::album_ptr album = Tomahawk::Album::get( artist, albumName, false );
|
||||||
Tomahawk::album_ptr album = Tomahawk::Album::get( albumId, albumName, artist );
|
|
||||||
al << album;
|
al << album;
|
||||||
}
|
}
|
||||||
onAlbumsAdded( al, requestData.customData[ "row" ] );
|
onAlbumsAdded( al, requestData.customData[ "row" ] );
|
||||||
|
Reference in New Issue
Block a user