Commit 143c96f6 authored by Matěj Laitl's avatar Matěj Laitl
Browse files

LastFmService: fix track recreation on startup

...and add a warning to ServiceBase so that we know quicker next time.

BUGFIXES:
 * Fix Last.fm streams not being correctly recreated on startup.

BUG: 305576
FIXED-IN: 2.7
parent 78ccd8e3
......@@ -9,6 +9,7 @@ VERSION 2.7
* Removed alpha state and not really working spectrum analyzer applet.
BUGFIXES:
* Fix Last.fm streams not being correctly recreated on startup. (BR 305576)
* Fix Ampache albums & track not being shown, a recent regression. (BR 310862)
* Fix crash in Network Requests Viewer. (BR 311760)
* Prevent crash when using File Browser breadcrumbs. (BR 265626)
......
......@@ -64,11 +64,13 @@ ServiceFactory::trackForUrl( const KUrl &url )
m_tracksToLocate.enqueue( trackptr );
return Meta::TrackPtr::staticCast( trackptr );
}
else if ( service->collection() )
else if( service->collection() )
{
debug() << "Service Ready. Collection is: " << service->collection();
return service->collection()->trackForUrl( url );
}
else
warning() << __PRETTY_FUNCTION__ << "service is ready, but service->collection() is null!";
}
return Meta::TrackPtr();
}
......@@ -83,8 +85,10 @@ void ServiceFactory::slotServiceReady()
while( !m_tracksToLocate.isEmpty() )
{
MetaProxy::TrackPtr track = m_tracksToLocate.dequeue();
if( track )
track->lookupTrack( this );
if( !track )
continue;
track->lookupTrack( this );
}
}
......
......@@ -173,22 +173,24 @@ void
LastFmService::slotReconfigure()
{
lastfm::ws::Username = m_config->username();
setServiceReady( !m_config->username().isEmpty() ); // core features require just username
bool ready = !m_config->username().isEmpty(); // core features require just username
/* create ServiceCollection only once the username is known (remember, getting
* username from KWallet is async! */
if( !m_collection && serviceReady() )
if( !m_collection && ready )
{
m_collection = new Collections::LastFmServiceCollection( m_config->username() );
CollectionManager::instance()->addUnmanagedCollection( m_collection, CollectionManager::CollectionDisabled );
}
// create Model once the username is known, it depends on it implicitly
if( !model() && serviceReady() )
if( !model() && ready )
{
setModel( new LastFmTreeModel( this ) );
}
setServiceReady( ready ); // emits ready(), which needs to be done *after* creating collection
// now authenticate w/ last.fm and get our session key if we don't have one
if( !m_config->sessionKey().isEmpty() )
{
......
......@@ -36,7 +36,6 @@ Track::Track( const QString &lastFmUri )
d->lastFmUri = QUrl( lastFmUri );
d->t = this;
init();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment