extragear/multimedia/amarok/src/meta

Jeff Mitchell kde-dev at emailgoeshere.com
Sat Aug 9 15:11:39 CEST 2008


SVN commit 844356 by mitchell:

Ian pointed out we're abusing the location attribute of XSPF.  This fixes that, and also some weird, possibly buggy behavior when saving the URL.  It seems to still work fine 
with the services I've tried, but sending it to the list for a checkover...

CCMAIL:amarok-devel at kde.org


 M  +12 -4     XSPFPlaylist.cpp  


--- trunk/extragear/multimedia/amarok/src/meta/XSPFPlaylist.cpp #844355:844356
@@ -156,7 +156,14 @@
 
         TrackPtr trackPtr = CollectionManager::instance()->trackForUrl( track.location );
         if ( trackPtr ){
-            tracks << trackPtr;
+            if( !trackPtr->isPlayable() )
+            {
+                trackPtr = CollectionManager::instance()->trackForUrl( track.identifier );
+                if( trackPtr )
+                    tracks << trackPtr;
+            }
+            else
+                tracks << trackPtr;
         }
         // why do we need this? sqlplaylist is not doing this
         // we don't want (probably) unplayable tracks
@@ -516,10 +523,8 @@
         QDomNode trackNum = createElement( "trackNum" );
 //The time to render a resource, in milliseconds. It MUST be a nonNegativeInteger.
         QDomNode duration = createElement( "duration" );
-
-//identifier - Canonical ID for this resource. Likely to be a hash or other
 // location-independent name, such as a MusicBrainz identifier.  MUST be a legal URI.
-//        QDomNode identifier = createElement( "identifier" );
+        QDomNode identifier = createElement( "identifier" );
 //info - URI of a place where this resource can be bought or more info can be found.
 //     QDomNode info = createElement( "info" );
 //image - URI of an image to display for the duration of the track.
@@ -536,7 +541,10 @@
     }
 
         if ( !track->playableUrl().url().isEmpty() )
+            APPENDNODE( location, track->playableUrl().url() )
+        else
             APPENDNODE( location, track->uidUrl() )
+        APPENDNODE( identifier, track->uidUrl() )
         Meta::StreamInfoCapability *streamInfo = track->as<Meta::StreamInfoCapability>();
         if( streamInfo ) // We have a stream, use it's metadata instead of the tracks.
         {


More information about the Amarok-devel mailing list