[amarok] Load all XSPF tracks (kde#295199)
Rex Dieter
rdieter at fedoraproject.org
Thu Mar 15 13:26:25 UTC 2012
commit 885e2d5feaf77471b32fb2644319464dd0dc0683
Author: Rex Dieter <rdieter at fedoraproject.org>
Date: Thu Mar 15 08:28:10 2012 -0500
Load all XSPF tracks (kde#295199)
...Load-all-tracks-from-XSPF-using-MetaProxy.patch | 753 ++++++++++++++++++++
amarok.spec | 9 +-
2 files changed, 761 insertions(+), 1 deletions(-)
---
diff --git a/0001-Load-all-tracks-from-XSPF-using-MetaProxy.patch b/0001-Load-all-tracks-from-XSPF-using-MetaProxy.patch
new file mode 100644
index 0000000..6ee7849
--- /dev/null
+++ b/0001-Load-all-tracks-from-XSPF-using-MetaProxy.patch
@@ -0,0 +1,753 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 4241e69..bbe3f75 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -284,6 +284,7 @@ set(libmetaimpl_SRCS
+ core-impl/meta/multi/MultiTrack.cpp
+ core-impl/meta/cue/CueFileSupport.cpp
+ core-impl/meta/proxy/MetaProxy.cpp
++ core-impl/meta/proxy/MetaProxyWorker.cpp
+ core-impl/meta/stream/Stream.cpp
+ core-impl/playlists/types/file/PlaylistFile.cpp
+ core-impl/statistics/providers/url/PermanentUrlStatisticsProvider.cpp
+diff --git a/src/core-impl/collections/support/CollectionManager.cpp b/src/core-impl/collections/support/CollectionManager.cpp
+index 37fe03a..9085b5a 100644
+--- a/src/core-impl/collections/support/CollectionManager.cpp
++++ b/src/core-impl/collections/support/CollectionManager.cpp
+@@ -463,6 +463,7 @@ CollectionManager::trackForUrl( const KUrl &url )
+ }
+ }
+
++ //TODO: create specific TrackProviders for these:
+ if( url.protocol() == QLatin1String("http") || url.protocol() == QLatin1String("mms") ||
+ url.protocol() == QLatin1String("smb") )
+ return Meta::TrackPtr( new MetaStream::Track( url ) );
+diff --git a/src/core-impl/meta/proxy/MetaProxy.h b/src/core-impl/meta/proxy/MetaProxy.h
+index d8329be..060223f 100644
+--- a/src/core-impl/meta/proxy/MetaProxy.h
++++ b/src/core-impl/meta/proxy/MetaProxy.h
+@@ -17,6 +17,8 @@
+ #ifndef AMAROK_METAPROXY_H
+ #define AMAROK_METAPROXY_H
+
++#include "MetaProxyWorker.h"
++
+ #include "core/meta/Meta.h"
+ #include "core/capabilities/Capability.h"
+
+@@ -82,6 +84,7 @@ namespace MetaProxy
+ virtual void setDiscNumber( int discNumber );
+
+ virtual qint64 length() const;
++ virtual void setLength( qint64 length );
+ virtual int filesize() const;
+ virtual int sampleRate() const;
+ virtual int bitrate() const;
+@@ -110,11 +113,12 @@ namespace MetaProxy
+ * allows subclasses to create an instance of trackprovider which will only check the TrackProvider
+ * passed to lookupTrack(TrackProvider*) for the real track.
+ */
+- Track( const KUrl &url, bool awaitLookupNotification);
++ Track( const KUrl &url, bool awaitLookupNotification );
++
+ /**
+ * MetaProxy will check the given trackprovider if it can provide the track for the proxy's url.
+ */
+- void lookupTrack(Collections::TrackProvider *provider);
++ void lookupTrack( Collections::TrackProvider *provider );
+
+ /**
+ * MetaProxy will update the proxy with the track.
+@@ -123,7 +127,7 @@ namespace MetaProxy
+
+ private:
+ void init( const KUrl &url, bool awaitLookupNotification );
+- Private * const d;
++ Private *const d;
+ };
+
+ }
+diff --git a/src/core-impl/meta/proxy/MetaProxy.cpp b/src/core-impl/meta/proxy/MetaProxy.cpp
+index d1577a2..6a27f0e 100644
+--- a/src/core-impl/meta/proxy/MetaProxy.cpp
++++ b/src/core-impl/meta/proxy/MetaProxy.cpp
+@@ -17,6 +17,7 @@
+ #include "core-impl/meta/proxy/MetaProxy.h"
+ #include "core-impl/meta/proxy/MetaProxy_p.h"
+ #include "core-impl/meta/proxy/MetaProxy_p.moc"
++#include "core-impl/meta/proxy/MetaProxyWorker.h"
+
+ #include "core/capabilities/EditCapability.h"
+
+@@ -27,6 +28,7 @@
+ #include <QTimer>
+
+ #include <KSharedPtr>
++#include <threadweaver/ThreadWeaver.h>
+
+ using namespace MetaProxy;
+
+@@ -83,18 +85,20 @@ MetaProxy::Track::init( const KUrl &url, bool awaitLookupNotification )
+ d->url = url;
+ d->proxy = this;
+ d->cachedLength = 0;
+-
+- if( !awaitLookupNotification )
+- {
+- QObject::connect( CollectionManager::instance(), SIGNAL( trackProviderAdded( Collections::TrackProvider* ) ), d, SLOT( slotNewTrackProvider( Collections::TrackProvider* ) ) );
+- QObject::connect( CollectionManager::instance(), SIGNAL( collectionAdded( Collections::Collection* ) ), d, SLOT( slotNewCollection( Collections::Collection* ) ) );
+- }
+-
+ d->albumPtr = Meta::AlbumPtr( new ProxyAlbum( d ) );
+ d->artistPtr = Meta::ArtistPtr( new ProxyArtist( d ) );
+ d->genrePtr = Meta::GenrePtr( new ProxyGenre( d ) );
+ d->composerPtr = Meta::ComposerPtr( new ProxyComposer( d ) );
+ d->yearPtr = Meta::YearPtr( new ProxyYear( d ) );
++
++ if( !awaitLookupNotification )
++ {
++ Worker *worker = new Worker( d->url );
++ QObject::connect( worker, SIGNAL(finishedLookup( const Meta::TrackPtr & )),
++ d, SLOT(slotUpdateTrack(Meta::TrackPtr)) );
++
++ ThreadWeaver::Weaver::instance()->enqueue( worker );
++ }
+ }
+
+ MetaProxy::Track::~Track()
+@@ -345,6 +349,12 @@ MetaProxy::Track::length() const
+ return d->cachedLength;
+ }
+
++void
++MetaProxy::Track::setLength( qint64 length )
++{
++ d->cachedLength = length;
++}
++
+ int
+ MetaProxy::Track::filesize() const
+ {
+@@ -424,7 +434,7 @@ MetaProxy::Track::inCollection() const
+ return false;
+ }
+
+-Collections::Collection*
++Collections::Collection *
+ MetaProxy::Track::collection() const
+ {
+ if( d->realTrack )
+@@ -450,7 +460,11 @@ MetaProxy::Track::unsubscribe( Meta::Observer *observer )
+ void
+ MetaProxy::Track::lookupTrack( Collections::TrackProvider *provider )
+ {
+- d->slotNewTrackProvider( provider );
++ if( provider->possiblyContainsTrack( d->url ) )
++ {
++ Meta::TrackPtr track = provider->trackForUrl( d->url );
++ d->slotUpdateTrack( track );
++ }
+ }
+
+ void
+@@ -470,7 +484,7 @@ MetaProxy::Track::hasCapabilityInterface( Capabilities::Capability::Type type )
+ return false;
+ }
+
+-Capabilities::Capability*
++Capabilities::Capability *
+ MetaProxy::Track::createCapabilityInterface( Capabilities::Capability::Type type )
+ {
+ if( d->realTrack )
+@@ -484,7 +498,7 @@ MetaProxy::Track::createCapabilityInterface( Capabilities::Capability::Type type
+ bool
+ MetaProxy::Track::operator==( const Meta::Track &track ) const
+ {
+- const MetaProxy::Track *proxy = dynamic_cast<const MetaProxy::Track*>( &track );
++ const MetaProxy::Track *proxy = dynamic_cast<const MetaProxy::Track *>( &track );
+ if( proxy && d->realTrack )
+ return d->realTrack == proxy->d->realTrack;
+ else if( proxy )
+diff --git a/src/core-impl/meta/proxy/MetaProxyWorker.h b/src/core-impl/meta/proxy/MetaProxyWorker.h
+new file mode 100644
+index 0000000..557f29d
+--- /dev/null
++++ b/src/core-impl/meta/proxy/MetaProxyWorker.h
+@@ -0,0 +1,42 @@
++/****************************************************************************************
++ * Copyright (c) 2012 Bart Cerneels <bart.cerneels at kde.org> *
++ * *
++ * This program is free software; you can redistribute it and/or modify it under *
++ * the terms of the GNU General Public License as published by the Free Software *
++ * Foundation; either version 2 of the License, or (at your option) any later *
++ * version. *
++ * *
++ * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
++ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
++ * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
++ * *
++ * You should have received a copy of the GNU General Public License along with *
++ * this program. If not, see <http://www.gnu.org/licenses/>. *
++ ****************************************************************************************/
++
++#ifndef METAPROXY_METAPROXYWORKER_H
++#define METAPROXY_METAPROXYWORKER_H
++
++#include <core/collections/support/TrackForUrlWorker.h>
++#include <core/collections/Collection.h>
++
++namespace MetaProxy {
++
++class Worker : public Amarok::TrackForUrlWorker
++{
++ Q_OBJECT
++ public:
++ explicit Worker( const KUrl &url );
++
++ //TrackForUrlWorker virtual methods
++ virtual void run();
++
++ private slots:
++ void slotNewTrackProvider( Collections::TrackProvider *newTrackProvider );
++ void slotNewCollection( Collections::Collection *newCollection );
++
++};
++
++} // namespace MetaProxy
++
++#endif // METAPROXY_METAPROXYWORKER_H
+diff --git a/src/core-impl/meta/proxy/MetaProxyWorker.cpp b/src/core-impl/meta/proxy/MetaProxyWorker.cpp
+new file mode 100644
+index 0000000..0cde280
+--- /dev/null
++++ b/src/core-impl/meta/proxy/MetaProxyWorker.cpp
+@@ -0,0 +1,82 @@
++/****************************************************************************************
++ * Copyright (c) 2012 Bart Cerneels <bart.cerneels at kde.org> *
++ * *
++ * This program is free software; you can redistribute it and/or modify it under *
++ * the terms of the GNU General Public License as published by the Free Software *
++ * Foundation; either version 2 of the License, or (at your option) any later *
++ * version. *
++ * *
++ * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
++ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
++ * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
++ * *
++ * You should have received a copy of the GNU General Public License along with *
++ * this program. If not, see <http://www.gnu.org/licenses/>. *
++ ****************************************************************************************/
++
++#include "MetaProxyWorker.h"
++
++#include "core-impl/collections/support/CollectionManager.h"
++
++namespace MetaProxy {
++
++Worker::Worker( const KUrl &url )
++ : Amarok::TrackForUrlWorker( url )
++{
++
++}
++
++void
++Worker::run()
++{
++ Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( m_url );
++
++ //no TrackProvider has a track for us yet, query new ones that are added.
++ if( track.isNull() )
++ {
++ //TODO: should only have to connecto to TrackProvider signals.
++ //Each Collection contains a TrackProvider
++ connect( CollectionManager::instance(),
++ SIGNAL(trackProviderAdded( Collections::TrackProvider * )),
++ SLOT(slotNewTrackProvider( Collections::TrackProvider * )) );
++ connect( CollectionManager::instance(),
++ SIGNAL(collectionAdded( Collections::Collection * )),
++ SLOT(slotNewCollection( Collections::Collection * )) );
++
++ return;
++ }
++
++ emit( finishedLookup( track ) );
++}
++
++void
++Worker::slotNewTrackProvider( Collections::TrackProvider *newTrackProvider )
++{
++ if( !newTrackProvider )
++ {
++ return;
++ }
++
++ if( newTrackProvider->possiblyContainsTrack( m_url ) )
++ {
++ Meta::TrackPtr track = newTrackProvider->trackForUrl( m_url );
++ emit( finishedLookup( track ) );
++ }
++}
++
++void
++Worker::slotNewCollection( Collections::Collection *newCollection )
++{
++ if( !newCollection )
++ {
++ return;
++ }
++
++ if( newCollection->possiblyContainsTrack( m_url ) )
++ {
++ Meta::TrackPtr track = newCollection->trackForUrl( m_url );
++ emit( finishedLookup( track ) );
++ }
++}
++
++} // namespace MetaProxy
+diff --git a/src/core-impl/meta/proxy/MetaProxy_p.h b/src/core-impl/meta/proxy/MetaProxy_p.h
+index 792675d..ac8efb0 100644
+--- a/src/core-impl/meta/proxy/MetaProxy_p.h
++++ b/src/core-impl/meta/proxy/MetaProxy_p.h
+@@ -43,7 +43,7 @@ class MetaProxy::Track::Private : public QObject, public Meta::Observer
+
+ Meta::TrackPtr realTrack;
+
+- QList<Meta::Observer*> observers;
++ QList<Meta::Observer *> observers;
+
+ QString cachedArtist;
+ QString cachedAlbum;
+@@ -82,34 +82,6 @@ class MetaProxy::Track::Private : public QObject, public Meta::Observer
+ }
+
+ public slots:
+- void slotNewTrackProvider( Collections::TrackProvider *newTrackProvider )
+- {
+- if ( !newTrackProvider )
+- {
+- return;
+- }
+-
+- if( newTrackProvider->possiblyContainsTrack( url ) )
+- {
+- Meta::TrackPtr track = newTrackProvider->trackForUrl( url );
+- slotUpdateTrack( track );
+- }
+- }
+-
+- void slotNewCollection( Collections::Collection *newCollection )
+- {
+- if ( !newCollection )
+- {
+- return;
+- }
+-
+- if( newCollection->possiblyContainsTrack( url ) )
+- {
+- Meta::TrackPtr track = newCollection->trackForUrl( url );
+- slotUpdateTrack( track );
+- }
+- }
+-
+ void slotUpdateTrack( Meta::TrackPtr track )
+ {
+ if( track )
+diff --git a/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.cpp b/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.cpp
+index 4cb49fb..01cf1e6 100644
+--- a/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.cpp
++++ b/src/core-impl/playlists/types/file/xspf/XSPFPlaylist.cpp
+@@ -233,8 +233,7 @@ XSPFPlaylist::trackCount() const
+ Meta::TrackList
+ XSPFPlaylist::tracks()
+ {
+- //If you do not load before, m_tracks
+- //can be empty before usage.
++ //If you do not load, m_tracks can be empty before usage.
+ triggerTrackLoad();
+
+ return m_tracks;
+@@ -251,76 +250,14 @@ XSPFPlaylist::triggerTrackLoad()
+
+ foreach( const XSPFTrack &track, xspfTracks )
+ {
+- Meta::TrackPtr trackPtr;
+- if( !track.identifier.isEmpty() )
+- trackPtr = CollectionManager::instance()->trackForUrl( track.identifier );
+- else
+- trackPtr = CollectionManager::instance()->trackForUrl( track.location );
+- if( trackPtr )
+- {
+- /**
+- * NOTE: If this is a MetaProxy::Track, it probably isn't playable yet,
+- * but that's okay. However, it's not a good idea to get another
+- * one from the same provider, since the proxy probably means that
+- * making one involves quite a bit of work.
+- * - Andy Coder <andrew.coder at gmail.com>
+- */
+- if( !trackPtr->isPlayable() && ( typeid( * trackPtr.data() ) != typeid( MetaProxy::Track ) ) )
+- trackPtr = CollectionManager::instance()->trackForUrl( track.identifier );
+- }
+-
+- if( trackPtr )
+- {
+- if( typeid( * trackPtr.data() ) == typeid( MetaStream::Track ) )
+- {
+- MetaStream::Track * streamTrack = dynamic_cast<MetaStream::Track *> ( trackPtr.data() );
+- if ( streamTrack )
+- {
+- streamTrack->setTitle( track.title );
+- streamTrack->setAlbum( track.album );
+- streamTrack->setArtist( track.creator );
+- }
+- }
+- else if( typeid( * trackPtr.data() ) == typeid( Meta::TimecodeTrack ) )
+- {
+- Meta::TimecodeTrack * timecodeTrack =
+- dynamic_cast<Meta::TimecodeTrack *>( trackPtr.data() );
+- if( timecodeTrack )
+- {
+- timecodeTrack->beginMetaDataUpdate();
+- timecodeTrack->setTitle( track.title );
+- timecodeTrack->setAlbum( track.album );
+- timecodeTrack->setArtist( track.creator );
+- timecodeTrack->endMetaDataUpdate();
+- }
+- }
+-
+- m_tracks << trackPtr;
+- }
+-
+-
+- // why do we need this? sqlplaylist is not doing this
+- // we don't want (probably) unplayable tracks
+- // and it causes problems for me (DanielW) as long
+- // amarok not respects Track::isPlayable()
+- /*else {
+-
+- MetaProxy::Track *proxyTrack = new MetaProxy::Track( track.location );
+- {
+- //Fill in values from xspf..
+- QVariantMap map;
+- map.insert( Meta::Field::TITLE, track.title );
+- map.insert( Meta::Field::ALBUM, track.album );
+- map.insert( Meta::Field::ARTIST, track.creator );
+- map.insert( Meta::Field::LENGTH, track.duration );
+- map.insert( Meta::Field::TRACKNUMBER, track.trackNum );
+- map.insert( Meta::Field::URL, track.location );
+- Meta::Field::updateTrack( proxyTrack, map );
+- }
+- m_tracks << Meta::TrackPtr( proxyTrack );
+- // m_tracks << CollectionManager::instance()->trackForUrl( track.location );
+- }*/
+-
++ MetaProxy::Track *proxyTrack = new MetaProxy::Track( track.location );
++ //Fill in values from xspf..
++ proxyTrack->setName( track.title );
++ proxyTrack->setAlbum( track.album );
++ proxyTrack->setArtist( track.creator );
++ proxyTrack->setLength( track.duration );
++ proxyTrack->setTrackNumber( track.trackNum );
++ m_tracks << Meta::TrackPtr( proxyTrack );
+ }
+
+ m_tracksLoaded = true;
+diff --git a/src/core/collections/support/TrackForUrlWorker.h b/src/core/collections/support/TrackForUrlWorker.h
+index 64d23bd..16d764e 100644
+--- a/src/core/collections/support/TrackForUrlWorker.h
++++ b/src/core/collections/support/TrackForUrlWorker.h
+@@ -35,17 +35,17 @@ class AMAROK_CORE_EXPORT TrackForUrlWorker : public ThreadWeaver::Job
+ {
+ Q_OBJECT
+ public:
+- TrackForUrlWorker ( const KUrl &url );
+- TrackForUrlWorker ( const QString &url );
++ TrackForUrlWorker( const KUrl &url );
++ TrackForUrlWorker( const QString &url );
+ ~TrackForUrlWorker();
+
+- virtual void run () = 0;
++ virtual void run() = 0;
+ signals:
+- void finishedLookup ( const Meta::TrackPtr &track );
++ void finishedLookup( const Meta::TrackPtr &track );
+
+ protected:
+- KUrl mUrl;
+- Meta::TrackPtr mTrack;
++ KUrl m_url;
++ Meta::TrackPtr m_track;
+
+ private slots:
+ void completeJob();
+diff --git a/src/core/collections/support/TrackForUrlWorker.cpp b/src/core/collections/support/TrackForUrlWorker.cpp
+index 7e8f289..28d92bb 100644
+--- a/src/core/collections/support/TrackForUrlWorker.cpp
++++ b/src/core/collections/support/TrackForUrlWorker.cpp
+@@ -16,14 +16,18 @@
+
+ #include "TrackForUrlWorker.h"
+
+-Amarok::TrackForUrlWorker::TrackForUrlWorker ( const KUrl &url ) : ThreadWeaver::Job(), mUrl ( url )
++Amarok::TrackForUrlWorker::TrackForUrlWorker( const KUrl &url )
++ : ThreadWeaver::Job()
++ , m_url( url )
+ {
+- connect ( this, SIGNAL ( done ( ThreadWeaver::Job* ) ), SLOT ( completeJob() ) );
++ connect( this, SIGNAL(done( ThreadWeaver::Job * )), SLOT( completeJob()) );
+ }
+
+-Amarok::TrackForUrlWorker::TrackForUrlWorker( const QString &url ) : ThreadWeaver::Job(), mUrl ( KUrl ( url ) )
++Amarok::TrackForUrlWorker::TrackForUrlWorker( const QString &url )
++ : ThreadWeaver::Job()
++ , m_url( KUrl( url ) )
+ {
+- connect ( this, SIGNAL ( done ( ThreadWeaver::Job* ) ), SLOT ( completeJob() ) );
++ connect( this, SIGNAL(done( ThreadWeaver::Job * )), SLOT( completeJob()) );
+ }
+
+ Amarok::TrackForUrlWorker::~TrackForUrlWorker()
+@@ -32,6 +36,6 @@ Amarok::TrackForUrlWorker::~TrackForUrlWorker()
+ void
+ Amarok::TrackForUrlWorker::completeJob()
+ {
+- emit ( finishedLookup ( mTrack ) );
++ emit( finishedLookup( m_track ) );
+ deleteLater();
+ }
+diff --git a/src/services/ampache/AmpacheServiceCollection.h b/src/services/ampache/AmpacheServiceCollection.h
+index a48c8f2..cc49775 100644
+--- a/src/services/ampache/AmpacheServiceCollection.h
++++ b/src/services/ampache/AmpacheServiceCollection.h
+@@ -25,14 +25,16 @@ class AmpacheTrackForUrlWorker : public Amarok::TrackForUrlWorker
+ {
+ Q_OBJECT
+ public:
+- AmpacheTrackForUrlWorker( const KUrl &url, MetaProxy::TrackPtr track, const QString &server, const QString &sessionId, ServiceBase* service);
++ AmpacheTrackForUrlWorker( const KUrl &url, MetaProxy::TrackPtr track,
++ const QString &server, const QString &sessionId,
++ ServiceBase *service);
+ ~AmpacheTrackForUrlWorker();
+- virtual void run ();
++ virtual void run();
+ void parseTrack( const QString &xml );
+ signals:
+ void authenticationNeeded();
+ private:
+- MetaProxy::TrackPtr mProxy;
++ MetaProxy::TrackPtr m_proxy;
+ int m_urlTrackId;
+ int m_urlAlbumId;
+ int m_urlArtistId;
+@@ -44,7 +46,7 @@ class AmpacheTrackForUrlWorker : public Amarok::TrackForUrlWorker
+ QString m_server;
+ QString m_sessionId;
+
+- ServiceBase* m_service;
++ ServiceBase *m_service;
+ };
+
+ namespace Collections {
+@@ -59,11 +61,12 @@ class AmpacheServiceCollection : public ServiceCollection
+ Q_OBJECT
+
+ public:
+- AmpacheServiceCollection( ServiceBase * service, const QString &server, const QString &sessionId );
++ AmpacheServiceCollection( ServiceBase *service, const QString &server,
++ const QString &sessionId );
+
+ virtual ~AmpacheServiceCollection();
+
+- virtual QueryMaker* queryMaker();
++ virtual QueryMaker *queryMaker();
+
+ virtual QString collectionId() const;
+ virtual QString prettyName() const;
+@@ -76,16 +79,13 @@ signals:
+
+ public slots:
+ void slotAuthenticationNeeded();
+- void slotLookupComplete( const Meta::TrackPtr& );
++ void slotLookupComplete( const Meta::TrackPtr & );
+
+ private:
+- /*void parseAlbum( const QString &xml );
+- void parseArtist( const QString &xml );*/
+-
+ QString m_server;
+ QString m_sessionId;
+
+- AmpacheTrackForUrlWorker * m_trackForUrlWorker;
++ AmpacheTrackForUrlWorker *m_trackForUrlWorker;
+ };
+
+ } //namespace Collections
+--
+1.7.5.4
+
+diff --git a/src/services/ampache/AmpacheServiceCollection.cpp b/src/services/ampache/AmpacheServiceCollection.cpp
+index b684e34..c3b5115 100644
+--- a/src/services/ampache/AmpacheServiceCollection.cpp
++++ b/src/services/ampache/AmpacheServiceCollection.cpp
+@@ -27,7 +27,9 @@
+
+ using namespace Collections;
+
+-AmpacheServiceCollection::AmpacheServiceCollection( ServiceBase * service, const QString &server, const QString &sessionId )
++AmpacheServiceCollection::AmpacheServiceCollection( ServiceBase *service,
++ const QString &server,
++ const QString &sessionId )
+ : ServiceCollection( service, "AmpacheCollection", "AmpacheCollection" )
+ , m_server( server )
+ , m_sessionId( sessionId )
+@@ -58,7 +60,7 @@ AmpacheServiceCollection::prettyName() const
+ }
+
+ bool
+-AmpacheServiceCollection::possiblyContainsTrack(const KUrl & url) const
++AmpacheServiceCollection::possiblyContainsTrack( const KUrl &url ) const
+ {
+ return url.url().contains( m_server );
+ }
+@@ -70,77 +72,82 @@ AmpacheServiceCollection::slotAuthenticationNeeded()
+ }
+
+ Meta::TrackPtr
+-AmpacheServiceCollection::trackForUrl( const KUrl & url )
++AmpacheServiceCollection::trackForUrl( const KUrl &url )
+ {
+- MetaProxy::Track* ptrack = new MetaProxy::Track( url.url(), true );
+- MetaProxy::TrackPtr trackptr(ptrack);
+- AmpacheTrackForUrlWorker * worker = new AmpacheTrackForUrlWorker(url, trackptr, m_server, m_sessionId, service() );
+-// connect( worker, SIGNAL( finishedLookup ( const Meta::TrackPtr& ) ), this,
+-// SLOT( slotLookupComplete( const Meta::TrackPtr& ) ) );
+- connect( worker, SIGNAL( authenticationNeeded() ), this,
+- SLOT( slotAuthenticationNeeded() ) );
++ MetaProxy::Track *ptrack = new MetaProxy::Track( url.url(), true );
++ MetaProxy::TrackPtr trackptr( ptrack );
++ AmpacheTrackForUrlWorker *worker = new AmpacheTrackForUrlWorker( url, trackptr,
++ m_server,
++ m_sessionId,
++ service() );
++ connect( worker, SIGNAL(authenticationNeeded()), SLOT(slotAuthenticationNeeded()) );
+ ThreadWeaver::Weaver::instance()->enqueue( worker );
+
+ return Meta::TrackPtr::staticCast( trackptr );
+ }
++
+ void AmpacheServiceCollection::slotLookupComplete( const Meta::TrackPtr& )
+ {
+ }
+
+ void AmpacheTrackForUrlWorker::parseTrack( const QString &xml )
+ {
+-// DEBUG_BLOCK
+-
+-// debug() << "Received track response: " << xml;
+-
+- //so lets figure out what we got here:
++ //so lets figure out what we got here:
+ QDomDocument doc( "reply" );
+ doc.setContent( xml );
+- QDomElement root = doc.firstChildElement("root");
+- QDomElement song = root.firstChildElement("song");
++ QDomElement root = doc.firstChildElement( "root" );
++ QDomElement song = root.firstChildElement( "song" );
+
+- m_urlTrackId = song.attribute( "id", "0").toInt();
++ m_urlTrackId = song.attribute( "id", "0" ).toInt();
+
+- QDomElement element = song.firstChildElement("title");
++ QDomElement element = song.firstChildElement( "title" );
+
+ QString title = element.text();
+ if ( title.isEmpty() ) title = "Unknown";
+
+- element = song.firstChildElement("url");
++ element = song.firstChildElement( "url" );
+
+ m_urlTrack = new Meta::AmpacheTrack( title, m_service );
+ Meta::TrackPtr trackPtr( m_urlTrack );
+
+- //debug() << "Adding track: " << title;
+ m_urlTrack->setUidUrl( element.text() );
+ m_urlTrack->setId( m_urlTrackId );
+
+- element = song.firstChildElement("time");
++ element = song.firstChildElement( "time" );
+ m_urlTrack->setLength( element.text().toInt() * 1000 );
+
+- element = song.firstChildElement("track");
++ element = song.firstChildElement( "track" );
+ m_urlTrack->setTrackNumber( element.text().toInt() );
+
+- QDomElement albumElement = song.firstChildElement("album");
+- //m_urlAlbumId = albumElement.attribute( "id", "0").toInt();
++ QDomElement albumElement = song.firstChildElement( "album" );
++ m_urlAlbumId = albumElement.attribute( "id", "0" ).toInt();
+
+- Meta::AmpacheAlbum * album = new Meta::AmpacheAlbum( albumElement.text() );
++ Meta::AmpacheAlbum *album = new Meta::AmpacheAlbum( albumElement.text() );
+
+- QDomElement artElement = song.firstChildElement("art");
++ QDomElement artElement = song.firstChildElement( "art" );
+ album->setCoverUrl( artElement.text() );
+
+ album->addTrack( trackPtr );
+ m_urlTrack->setAlbumPtr( Meta::AlbumPtr( album ) );
+
+- QDomElement artistElement = song.firstChildElement("artist");
+- Meta::ServiceArtist * artist = new Meta::ServiceArtist( artistElement.text() );
++ QDomElement artistElement = song.firstChildElement( "artist" );
++ Meta::ServiceArtist *artist = new Meta::ServiceArtist( artistElement.text() );
+
+ Meta::ArtistPtr artistPtr( artist );
+ m_urlTrack->setArtist( artistPtr );
+ album->setAlbumArtist( artistPtr );
+ }
+
+-AmpacheTrackForUrlWorker::AmpacheTrackForUrlWorker(const KUrl &url, MetaProxy::TrackPtr track, const QString &server, const QString &sessionId, ServiceBase* service) : Amarok::TrackForUrlWorker(url), mProxy(track), m_server(server), m_sessionId(sessionId), m_service(service)
++AmpacheTrackForUrlWorker::AmpacheTrackForUrlWorker( const KUrl &url,
++ MetaProxy::TrackPtr track,
++ const QString &server,
++ const QString &sessionId,
++ ServiceBase *service )
++ : Amarok::TrackForUrlWorker( url )
++ , m_proxy( track )
++ , m_server( server )
++ , m_sessionId( sessionId )
++ , m_service( service )
+ {
+ }
+
+@@ -150,8 +157,6 @@ AmpacheTrackForUrlWorker::~AmpacheTrackForUrlWorker()
+ void
+ AmpacheTrackForUrlWorker::run()
+ {
+- // DEBUG_BLOCK;
+-
+ m_urlTrack = 0;
+ m_urlAlbum = 0;
+ m_urlArtist = 0;
+@@ -162,9 +167,9 @@ AmpacheTrackForUrlWorker::run()
+
+ //send url_to_song to Ampache
+
+- QString requestUrl = QString( "%1/server/xml.server.php?action=url_to_song&auth=%2&url=%3")
+- . arg( m_server, m_sessionId, QUrl::toPercentEncoding( mUrl.url() ) );
+- // debug() << "request url: " << requestUrl;
++ QString requestUrl =
++ QString( "%1/server/xml.server.php?action=url_to_song&auth=%2&url=%3" )
++ .arg( m_server, m_sessionId, QUrl::toPercentEncoding( m_url.url() ) );
+
+ QNetworkRequest req( requestUrl );
+ QNetworkReply *reply = The::networkAccessManager()->get( req );
+@@ -178,7 +183,7 @@ AmpacheTrackForUrlWorker::run()
+ }
+ }
+ parseTrack( reply->readAll() );
+- mTrack = Meta::TrackPtr( m_urlTrack );
+- mProxy->updateTrack( mTrack );
++ m_track = Meta::TrackPtr( m_urlTrack );
++ m_proxy->updateTrack( m_track );
+ reply->deleteLater();
+ }
diff --git a/amarok.spec b/amarok.spec
index fbb83e5..4bdf16e 100644
--- a/amarok.spec
+++ b/amarok.spec
@@ -2,7 +2,7 @@
Name: amarok
Summary: Media player
Version: 2.5.0
-Release: 7%{?dist}
+Release: 8%{?dist}
# KDE e.V. may determine that future GPL versions are accepted
License: GPLv2 or GPLv3
@@ -19,6 +19,9 @@ Patch0: amarok-2.5.0-onlinedoc.patch
## upstream patches
# https://bugs.kde.org/show_bug.cgi?id=290123
Patch100: amarok-2.5.0-kde48_context_view.patch
+# Load all tracks from XSPF using MetaProxy.
+# https://bugs.kde.org/show_bug.cgi?id=295199
+Patch101: 0001-Load-all-tracks-from-XSPF-using-MetaProxy.patch
BuildRequires: curl-devel
BuildRequires: desktop-file-utils
@@ -90,6 +93,7 @@ BuildArch: noarch
%patch0 -p1 -b .onlinedoc
#patch50 -p1 -b .qtscript_not_required
%patch100 -p1 -b .kde48_context_view
+%patch101 -p1 -b .loadall_xspf
%build
@@ -179,6 +183,9 @@ fi
%changelog
+* Tue Mar 13 2012 Rex Dieter <rdieter at fedoraproject.org> 2.5.0-8
+- Load all XSPF tracks (kde#295199)
+
* Tue Feb 28 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.5.0-7
- Rebuilt for c++ ABI breakage
More information about the scm-commits
mailing list