mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 07:36:48 +02:00
Merge remote-tracking branch 'origin' into phonon
This commit is contained in:
@@ -10,7 +10,7 @@ using namespace Tomahawk;
|
|||||||
|
|
||||||
|
|
||||||
album_ptr
|
album_ptr
|
||||||
Album::get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist, const Tomahawk::collection_ptr& collection )
|
Album::get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist )
|
||||||
{
|
{
|
||||||
static QHash< unsigned int, album_ptr > s_albums;
|
static QHash< unsigned int, album_ptr > s_albums;
|
||||||
static QMutex s_mutex;
|
static QMutex s_mutex;
|
||||||
@@ -21,19 +21,18 @@ Album::get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& ar
|
|||||||
return s_albums.value( id );
|
return s_albums.value( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
album_ptr a = album_ptr( new Album( id, name, artist, collection ) );
|
album_ptr a = album_ptr( new Album( id, name, artist ) );
|
||||||
s_albums.insert( id, a );
|
s_albums.insert( id, a );
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Album::Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist, const Tomahawk::collection_ptr& collection )
|
Album::Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist )
|
||||||
: PlaylistInterface( this )
|
: PlaylistInterface( this )
|
||||||
, m_id( id )
|
, m_id( id )
|
||||||
, m_name( name )
|
, m_name( name )
|
||||||
, m_artist( artist )
|
, m_artist( artist )
|
||||||
, m_collection( collection )
|
|
||||||
, m_currentTrack( 0 )
|
, m_currentTrack( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -71,7 +70,7 @@ Album::tracks()
|
|||||||
{
|
{
|
||||||
if ( m_queries.isEmpty() )
|
if ( m_queries.isEmpty() )
|
||||||
{
|
{
|
||||||
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( m_collection );
|
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks();
|
||||||
cmd->setAlbum( this );
|
cmd->setAlbum( this );
|
||||||
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
|
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
|
||||||
|
|
||||||
|
@@ -19,15 +19,14 @@ class DLLEXPORT Album : public QObject, public PlaylistInterface
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static album_ptr get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist, const Tomahawk::collection_ptr& collection );
|
static album_ptr get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist );
|
||||||
|
|
||||||
Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist, const Tomahawk::collection_ptr& collection );
|
Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr& artist );
|
||||||
|
|
||||||
unsigned int id() const { return m_id; }
|
unsigned int id() const { return m_id; }
|
||||||
QString name() const { return m_name; }
|
QString name() const { return m_name; }
|
||||||
artist_ptr artist() const { return m_artist; }
|
artist_ptr artist() const { return m_artist; }
|
||||||
|
|
||||||
Tomahawk::collection_ptr collection() const { return m_collection; }
|
|
||||||
QList<Tomahawk::query_ptr> tracks();
|
QList<Tomahawk::query_ptr> tracks();
|
||||||
|
|
||||||
virtual int trackCount() const { return m_queries.count(); }
|
virtual int trackCount() const { return m_queries.count(); }
|
||||||
@@ -60,7 +59,6 @@ private:
|
|||||||
|
|
||||||
artist_ptr m_artist;
|
artist_ptr m_artist;
|
||||||
QList<Tomahawk::query_ptr> m_queries;
|
QList<Tomahawk::query_ptr> m_queries;
|
||||||
Tomahawk::collection_ptr m_collection;
|
|
||||||
|
|
||||||
unsigned int m_currentTrack;
|
unsigned int m_currentTrack;
|
||||||
};
|
};
|
||||||
|
@@ -13,7 +13,7 @@ Artist::Artist() {}
|
|||||||
Artist::~Artist() {}
|
Artist::~Artist() {}
|
||||||
|
|
||||||
artist_ptr
|
artist_ptr
|
||||||
Artist::get( unsigned int id, const QString& name, const Tomahawk::collection_ptr& collection )
|
Artist::get( unsigned int id, const QString& name )
|
||||||
{
|
{
|
||||||
static QHash< unsigned int, artist_ptr > s_artists;
|
static QHash< unsigned int, artist_ptr > s_artists;
|
||||||
static QMutex s_mutex;
|
static QMutex s_mutex;
|
||||||
@@ -24,7 +24,7 @@ Artist::get( unsigned int id, const QString& name, const Tomahawk::collection_pt
|
|||||||
return s_artists.value( id );
|
return s_artists.value( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
artist_ptr a = artist_ptr( new Artist( id, name, collection ) );
|
artist_ptr a = artist_ptr( new Artist( id, name ) );
|
||||||
|
|
||||||
if ( id > 0 )
|
if ( id > 0 )
|
||||||
s_artists.insert( id, a );
|
s_artists.insert( id, a );
|
||||||
@@ -33,23 +33,15 @@ Artist::get( unsigned int id, const QString& name, const Tomahawk::collection_pt
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Artist::Artist( unsigned int id, const QString& name, const Tomahawk::collection_ptr& collection )
|
Artist::Artist( unsigned int id, const QString& name )
|
||||||
: PlaylistInterface( this )
|
: PlaylistInterface( this )
|
||||||
, m_id( id )
|
, m_id( id )
|
||||||
, m_name( name )
|
, m_name( name )
|
||||||
, m_currentTrack( 0 )
|
, m_currentTrack( 0 )
|
||||||
, m_collection( collection )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Tomahawk::collection_ptr
|
|
||||||
Artist::collection() const
|
|
||||||
{
|
|
||||||
return m_collection;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Artist::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks )
|
Artist::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks )
|
||||||
{
|
{
|
||||||
@@ -82,7 +74,7 @@ Artist::tracks()
|
|||||||
{
|
{
|
||||||
if ( m_queries.isEmpty() )
|
if ( m_queries.isEmpty() )
|
||||||
{
|
{
|
||||||
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( m_collection );
|
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks();
|
||||||
cmd->setArtist( this );
|
cmd->setArtist( this );
|
||||||
cmd->setSortOrder( DatabaseCommand_AllTracks::Album );
|
cmd->setSortOrder( DatabaseCommand_AllTracks::Album );
|
||||||
|
|
||||||
|
@@ -18,8 +18,8 @@ class DLLEXPORT Artist : public QObject, public PlaylistInterface
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static artist_ptr get( unsigned int id, const QString& name, const Tomahawk::collection_ptr& collection );
|
static artist_ptr get( unsigned int id, const QString& name );
|
||||||
Artist( unsigned int id, const QString& name, const Tomahawk::collection_ptr& collection );
|
Artist( unsigned int id, const QString& name );
|
||||||
|
|
||||||
Artist();
|
Artist();
|
||||||
virtual ~Artist();
|
virtual ~Artist();
|
||||||
@@ -27,8 +27,6 @@ public:
|
|||||||
unsigned int id() const { return m_id; }
|
unsigned int id() const { return m_id; }
|
||||||
QString name() const { return m_name; }
|
QString name() const { return m_name; }
|
||||||
|
|
||||||
Tomahawk::collection_ptr collection() const;
|
|
||||||
|
|
||||||
virtual QList<Tomahawk::query_ptr> tracks();
|
virtual QList<Tomahawk::query_ptr> tracks();
|
||||||
|
|
||||||
virtual int trackCount() const { return 0; }
|
virtual int trackCount() const { return 0; }
|
||||||
@@ -61,7 +59,6 @@ private:
|
|||||||
|
|
||||||
QList<Tomahawk::query_ptr> m_queries;
|
QList<Tomahawk::query_ptr> m_queries;
|
||||||
unsigned int m_currentTrack;
|
unsigned int m_currentTrack;
|
||||||
Tomahawk::collection_ptr m_collection;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // ns
|
}; // ns
|
||||||
|
@@ -166,8 +166,8 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
|
|||||||
Tomahawk::query_ptr query = Tomahawk::Query::get( artist, track, album );
|
Tomahawk::query_ptr query = Tomahawk::Query::get( artist, track, album );
|
||||||
attr["releaseyear"] = m.value( "year" );
|
attr["releaseyear"] = m.value( "year" );
|
||||||
|
|
||||||
Tomahawk::artist_ptr artistptr = Tomahawk::Artist::get( artistid, artist, source()->collection() );
|
Tomahawk::artist_ptr artistptr = Tomahawk::Artist::get( artistid, artist );
|
||||||
Tomahawk::album_ptr albumptr = Tomahawk::Album::get( albumid, album, artistptr, source()->collection() );
|
Tomahawk::album_ptr albumptr = Tomahawk::Album::get( albumid, album, artistptr );
|
||||||
Tomahawk::result_ptr result = Tomahawk::result_ptr( new Tomahawk::Result() );
|
Tomahawk::result_ptr result = Tomahawk::result_ptr( new Tomahawk::Result() );
|
||||||
result->setModificationTime( mtime );
|
result->setModificationTime( mtime );
|
||||||
result->setSize( size );
|
result->setSize( size );
|
||||||
|
@@ -41,8 +41,8 @@ DatabaseCommand_AllAlbums::exec( DatabaseImpl* dbi )
|
|||||||
|
|
||||||
while( query.next() )
|
while( query.next() )
|
||||||
{
|
{
|
||||||
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 2 ).toUInt(), query.value( 3 ).toString(), m_collection );
|
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 2 ).toUInt(), query.value( 3 ).toString() );
|
||||||
Tomahawk::album_ptr album = Tomahawk::Album::get( query.value( 0 ).toUInt(), query.value( 1 ).toString(), artist, m_collection );
|
Tomahawk::album_ptr album = Tomahawk::Album::get( query.value( 0 ).toUInt(), query.value( 1 ).toString(), artist );
|
||||||
|
|
||||||
al << album;
|
al << album;
|
||||||
}
|
}
|
||||||
|
@@ -5,17 +5,16 @@
|
|||||||
#include "databaseimpl.h"
|
#include "databaseimpl.h"
|
||||||
#include "artist.h"
|
#include "artist.h"
|
||||||
#include "album.h"
|
#include "album.h"
|
||||||
|
#include "sourcelist.h"
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||||
{
|
{
|
||||||
Q_ASSERT( !m_collection->source().isNull() );
|
|
||||||
|
|
||||||
TomahawkSqlQuery query = dbi->newquery();
|
TomahawkSqlQuery query = dbi->newquery();
|
||||||
QList<Tomahawk::query_ptr> ql;
|
QList<Tomahawk::query_ptr> ql;
|
||||||
QString m_orderToken;
|
|
||||||
|
|
||||||
|
QString m_orderToken, sourceToken;
|
||||||
switch ( m_sortOrder )
|
switch ( m_sortOrder )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@@ -34,6 +33,10 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( !m_collection.isNull() )
|
||||||
|
sourceToken = QString( "AND file.source %1" ).arg( m_collection->source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( m_collection->source()->id() ) );
|
||||||
|
|
||||||
QString sql = QString(
|
QString sql = QString(
|
||||||
"SELECT file.id, artist.name, album.name, track.name, file.size, "
|
"SELECT file.id, artist.name, album.name, track.name, file.size, "
|
||||||
"file.duration, file.bitrate, file.url, file.source, file.mtime, file.mimetype, file_join.albumpos, artist.id, album.id, track.id "
|
"file.duration, file.bitrate, file.url, file.source, file.mtime, file.mimetype, file_join.albumpos, artist.id, album.id, track.id "
|
||||||
@@ -43,10 +46,10 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
|||||||
"WHERE file.id = file_join.file "
|
"WHERE file.id = file_join.file "
|
||||||
"AND file_join.artist = artist.id "
|
"AND file_join.artist = artist.id "
|
||||||
"AND file_join.track = track.id "
|
"AND file_join.track = track.id "
|
||||||
"AND file.source %1 "
|
"%1 "
|
||||||
"%2 %3 "
|
"%2 %3 "
|
||||||
"%4 %5 %6"
|
"%4 %5 %6"
|
||||||
).arg( m_collection->source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( m_collection->source()->id() ) )
|
).arg( sourceToken )
|
||||||
.arg( !m_artist ? QString() : QString( "AND artist.id = %1" ).arg( m_artist->id() ) )
|
.arg( !m_artist ? QString() : QString( "AND artist.id = %1" ).arg( m_artist->id() ) )
|
||||||
.arg( !m_album ? QString() : QString( "AND album.id = %1" ).arg( m_album->id() ) )
|
.arg( !m_album ? QString() : QString( "AND album.id = %1" ).arg( m_album->id() ) )
|
||||||
.arg( m_sortOrder > 0 ? QString( "ORDER BY %1" ).arg( m_orderToken ) : QString() )
|
.arg( m_sortOrder > 0 ? QString( "ORDER BY %1" ).arg( m_orderToken ) : QString() )
|
||||||
@@ -63,11 +66,24 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
|||||||
|
|
||||||
QVariantMap attr;
|
QVariantMap attr;
|
||||||
TomahawkSqlQuery attrQuery = dbi->newquery();
|
TomahawkSqlQuery attrQuery = dbi->newquery();
|
||||||
|
Tomahawk::source_ptr s;
|
||||||
|
|
||||||
if( m_collection->source()->isLocal() )
|
if( query.value( 8 ).toUInt() == 0 )
|
||||||
|
{
|
||||||
|
s = SourceList::instance()->getLocal();
|
||||||
result->setUrl( query.value( 7 ).toString() );
|
result->setUrl( query.value( 7 ).toString() );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
result->setUrl( QString( "servent://%1\t%2" ).arg( m_collection->source()->userName() ).arg( query.value( 7 ).toString() ) );
|
{
|
||||||
|
s = SourceList::instance()->get( query.value( 8 ).toUInt() );
|
||||||
|
if( s.isNull() )
|
||||||
|
{
|
||||||
|
Q_ASSERT( false );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
result->setUrl( QString( "servent://%1\t%2" ).arg( s->userName() ).arg( query.value( 7 ).toString() ) );
|
||||||
|
}
|
||||||
|
|
||||||
QString artist, track, album;
|
QString artist, track, album;
|
||||||
artist = query.value( 1 ).toString();
|
artist = query.value( 1 ).toString();
|
||||||
@@ -75,8 +91,8 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
|||||||
track = query.value( 3 ).toString();
|
track = query.value( 3 ).toString();
|
||||||
|
|
||||||
Tomahawk::query_ptr qry = Tomahawk::Query::get( artist, track, album );
|
Tomahawk::query_ptr qry = Tomahawk::Query::get( artist, track, album );
|
||||||
Tomahawk::artist_ptr artistptr = Tomahawk::Artist::get( query.value( 12 ).toUInt(), artist, m_collection );
|
Tomahawk::artist_ptr artistptr = Tomahawk::Artist::get( query.value( 12 ).toUInt(), artist );
|
||||||
Tomahawk::album_ptr albumptr = Tomahawk::Album::get( query.value( 13 ).toUInt(), album, artistptr, m_collection );
|
Tomahawk::album_ptr albumptr = Tomahawk::Album::get( query.value( 13 ).toUInt(), album, artistptr );
|
||||||
|
|
||||||
result->setId( query.value( 14 ).toUInt() );
|
result->setId( query.value( 14 ).toUInt() );
|
||||||
result->setArtist( artistptr );
|
result->setArtist( artistptr );
|
||||||
@@ -89,7 +105,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
|||||||
result->setMimetype( query.value( 10 ).toString() );
|
result->setMimetype( query.value( 10 ).toString() );
|
||||||
result->setAlbumPos( query.value( 11 ).toUInt() );
|
result->setAlbumPos( query.value( 11 ).toUInt() );
|
||||||
result->setScore( 1.0 );
|
result->setScore( 1.0 );
|
||||||
result->setCollection( m_collection );
|
result->setCollection( s->collection() );
|
||||||
|
|
||||||
attrQuery.prepare( "SELECT k, v FROM track_attributes WHERE id = ?" );
|
attrQuery.prepare( "SELECT k, v FROM track_attributes WHERE id = ?" );
|
||||||
attrQuery.bindValue( 0, result->dbid() );
|
attrQuery.bindValue( 0, result->dbid() );
|
||||||
|
@@ -22,7 +22,7 @@ public:
|
|||||||
AlbumPosition = 3
|
AlbumPosition = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit DatabaseCommand_AllTracks( const Tomahawk::collection_ptr& collection, QObject* parent = 0 )
|
explicit DatabaseCommand_AllTracks( const Tomahawk::collection_ptr& collection = Tomahawk::collection_ptr(), QObject* parent = 0 )
|
||||||
: DatabaseCommand( parent )
|
: DatabaseCommand( parent )
|
||||||
, m_collection( collection )
|
, m_collection( collection )
|
||||||
, m_artist( 0 )
|
, m_artist( 0 )
|
||||||
|
@@ -15,7 +15,7 @@ void DatabaseCommand_LoadAllPlaylists::exec( DatabaseImpl* dbi )
|
|||||||
query.exec( QString( "SELECT guid, title, info, creator, lastmodified, shared, currentrevision "
|
query.exec( QString( "SELECT guid, title, info, creator, lastmodified, shared, currentrevision "
|
||||||
"FROM playlist WHERE source %1 AND dynplaylist = 'false'" )
|
"FROM playlist WHERE source %1 AND dynplaylist = 'false'" )
|
||||||
.arg( source()->isLocal() ? "IS NULL" :
|
.arg( source()->isLocal() ? "IS NULL" :
|
||||||
QString( "=%1" ).arg( source()->id() )
|
QString( "= %1" ).arg( source()->id() )
|
||||||
) );
|
) );
|
||||||
|
|
||||||
QList<playlist_ptr> plists;
|
QList<playlist_ptr> plists;
|
||||||
|
@@ -16,7 +16,9 @@ DatabaseCommand_LoadPlaylistEntries::exec( DatabaseImpl* dbi )
|
|||||||
emit done( m_revguid, m_guids, m_oldentries, m_islatest, m_entrymap, true );
|
emit done( m_revguid, m_guids, m_oldentries, m_islatest, m_entrymap, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
|
|
||||||
|
void
|
||||||
|
DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
|
||||||
{
|
{
|
||||||
TomahawkSqlQuery query_entries = dbi->newquery();
|
TomahawkSqlQuery query_entries = dbi->newquery();
|
||||||
query_entries.prepare("SELECT entries, playlist, author, timestamp, previous_revision "
|
query_entries.prepare("SELECT entries, playlist, author, timestamp, previous_revision "
|
||||||
|
@@ -15,7 +15,7 @@ Q_OBJECT
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DatabaseCommand_LoadPlaylistEntries( QString revision_guid, QObject* parent = 0 )
|
explicit DatabaseCommand_LoadPlaylistEntries( QString revision_guid, QObject* parent = 0 )
|
||||||
: DatabaseCommand( parent ), m_revguid( revision_guid )
|
: DatabaseCommand( parent ), m_revguid( revision_guid ), m_islatest( true )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void exec( DatabaseImpl* );
|
virtual void exec( DatabaseImpl* );
|
||||||
|
@@ -108,8 +108,8 @@ DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
|
|||||||
result->setUrl( QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url_str ) );
|
result->setUrl( QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url_str ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( files_query.value( 15 ).toUInt(), files_query.value( 10 ).toString(), s->collection() );
|
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( files_query.value( 15 ).toUInt(), files_query.value( 10 ).toString() );
|
||||||
Tomahawk::album_ptr album = Tomahawk::Album::get( files_query.value( 16 ).toUInt(), files_query.value( 11 ).toString(), artist, s->collection() );
|
Tomahawk::album_ptr album = Tomahawk::Album::get( files_query.value( 16 ).toUInt(), files_query.value( 11 ).toString(), artist );
|
||||||
|
|
||||||
result->setModificationTime( files_query.value( 1 ).toUInt() );
|
result->setModificationTime( files_query.value( 1 ).toUInt() );
|
||||||
result->setSize( files_query.value( 2 ).toUInt() );
|
result->setSize( files_query.value( 2 ).toUInt() );
|
||||||
|
@@ -191,8 +191,8 @@ DatabaseImpl::file( int fid )
|
|||||||
r->setUrl( QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url_str ) );
|
r->setUrl( QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url_str ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 7 ).toUInt(), query.value( 10 ).toString(), s->collection() );
|
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 7 ).toUInt(), query.value( 10 ).toString() );
|
||||||
Tomahawk::album_ptr album = Tomahawk::Album::get( query.value( 8 ).toUInt(), query.value( 11 ).toString(), artist, s->collection() );
|
Tomahawk::album_ptr album = Tomahawk::Album::get( query.value( 8 ).toUInt(), query.value( 11 ).toString(), artist );
|
||||||
|
|
||||||
r->setUrl( query.value( 0 ).toString() );
|
r->setUrl( query.value( 0 ).toString() );
|
||||||
r->setModificationTime( query.value( 1 ).toUInt() );
|
r->setModificationTime( query.value( 1 ).toUInt() );
|
||||||
@@ -530,8 +530,8 @@ DatabaseImpl::result( const QString& url )
|
|||||||
res->setUrl( QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url_str ) );
|
res->setUrl( QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url_str ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 15 ).toUInt(), query.value( 10 ).toString(), s->collection() );
|
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 15 ).toUInt(), query.value( 10 ).toString() );
|
||||||
Tomahawk::album_ptr album = Tomahawk::Album::get( query.value( 16 ).toUInt(), query.value( 11 ).toString(), artist, s->collection() );
|
Tomahawk::album_ptr album = Tomahawk::Album::get( query.value( 16 ).toUInt(), query.value( 11 ).toString(), artist );
|
||||||
|
|
||||||
res->setModificationTime( query.value( 1 ).toUInt() );
|
res->setModificationTime( query.value( 1 ).toUInt() );
|
||||||
res->setSize( query.value( 2 ).toUInt() );
|
res->setSize( query.value( 2 ).toUInt() );
|
||||||
|
@@ -50,9 +50,8 @@ DatabaseWorker::enqueue( const QSharedPointer<DatabaseCommand>& cmd )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_outstanding++;
|
|
||||||
|
|
||||||
QMutexLocker lock( &m_mut );
|
QMutexLocker lock( &m_mut );
|
||||||
|
m_outstanding++;
|
||||||
m_commands << cmd;
|
m_commands << cmd;
|
||||||
|
|
||||||
if ( m_outstanding == 1 )
|
if ( m_outstanding == 1 )
|
||||||
@@ -176,6 +175,7 @@ DatabaseWorker::doWork()
|
|||||||
|
|
||||||
cmd->emitFinished();
|
cmd->emitFinished();
|
||||||
|
|
||||||
|
QMutexLocker lock( &m_mut );
|
||||||
m_outstanding--;
|
m_outstanding--;
|
||||||
if ( m_outstanding > 0 )
|
if ( m_outstanding > 0 )
|
||||||
QTimer::singleShot( 0, this, SLOT( doWork() ) );
|
QTimer::singleShot( 0, this, SLOT( doWork() ) );
|
||||||
|
@@ -217,7 +217,7 @@ Playlist::reportDeleted( const Tomahawk::playlist_ptr& self )
|
|||||||
void
|
void
|
||||||
Playlist::loadRevision( const QString& rev )
|
Playlist::loadRevision( const QString& rev )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO << currentrevision() << rev << m_title;
|
||||||
|
|
||||||
DatabaseCommand_LoadPlaylistEntries* cmd =
|
DatabaseCommand_LoadPlaylistEntries* cmd =
|
||||||
new DatabaseCommand_LoadPlaylistEntries( rev.isEmpty() ? currentrevision() : rev );
|
new DatabaseCommand_LoadPlaylistEntries( rev.isEmpty() ? currentrevision() : rev );
|
||||||
@@ -314,7 +314,7 @@ Playlist::setNewRevision( const QString& rev,
|
|||||||
bool is_newest_rev,
|
bool is_newest_rev,
|
||||||
const QMap< QString, Tomahawk::plentry_ptr >& addedmap )
|
const QMap< QString, Tomahawk::plentry_ptr >& addedmap )
|
||||||
{
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO << rev << is_newest_rev << m_title << addedmap.count() << neworderedguids.count() << oldorderedguids.count();
|
||||||
// build up correctly ordered new list of plentry_ptrs from
|
// build up correctly ordered new list of plentry_ptrs from
|
||||||
// existing ones, and the ones that have been added
|
// existing ones, and the ones that have been added
|
||||||
QMap<QString, plentry_ptr> entriesmap;
|
QMap<QString, plentry_ptr> entriesmap;
|
||||||
|
@@ -94,6 +94,8 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEn
|
|||||||
|
|
||||||
emit endInsertRows();
|
emit endInsertRows();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
qDebug() << "Playlist seems empty:" << playlist->title();
|
||||||
|
|
||||||
emit loadingFinished();
|
emit loadingFinished();
|
||||||
emit trackCountChanged( rowCount( QModelIndex() ) );
|
emit trackCountChanged( rowCount( QModelIndex() ) );
|
||||||
|
@@ -117,7 +117,6 @@ ScriptResolver::handleMsg( const QByteArray& msg )
|
|||||||
|
|
||||||
QList< Tomahawk::result_ptr > results;
|
QList< Tomahawk::result_ptr > results;
|
||||||
const QVariantList reslist = m.value( "results" ).toList();
|
const QVariantList reslist = m.value( "results" ).toList();
|
||||||
Tomahawk::collection_ptr coll = SourceList::instance()->getLocal()->collection();
|
|
||||||
|
|
||||||
foreach( const QVariant& rv, reslist )
|
foreach( const QVariant& rv, reslist )
|
||||||
{
|
{
|
||||||
@@ -125,9 +124,9 @@ ScriptResolver::handleMsg( const QByteArray& msg )
|
|||||||
qDebug() << "RES" << m;
|
qDebug() << "RES" << m;
|
||||||
|
|
||||||
Tomahawk::result_ptr rp( new Tomahawk::Result() );
|
Tomahawk::result_ptr rp( new Tomahawk::Result() );
|
||||||
Tomahawk::artist_ptr ap = Tomahawk::Artist::get( 0, m.value( "artist" ).toString(), coll );
|
Tomahawk::artist_ptr ap = Tomahawk::Artist::get( 0, m.value( "artist" ).toString() );
|
||||||
rp->setArtist( ap );
|
rp->setArtist( ap );
|
||||||
rp->setAlbum( Tomahawk::Album::get( 0, m.value( "album" ).toString(), ap, coll ) );
|
rp->setAlbum( Tomahawk::Album::get( 0, m.value( "album" ).toString(), ap ) );
|
||||||
rp->setTrack( m.value( "track" ).toString() );
|
rp->setTrack( m.value( "track" ).toString() );
|
||||||
rp->setDuration( m.value( "duration" ).toUInt() );
|
rp->setDuration( m.value( "duration" ).toUInt() );
|
||||||
rp->setBitrate( m.value( "bitrate" ).toUInt() );
|
rp->setBitrate( m.value( "bitrate" ).toUInt() );
|
||||||
|
Reference in New Issue
Block a user