Hi Andy,

I've made some progress, but have run into a(nother) roadblock.  With
the attached diff, the metabundle url is now being set properly.  I had
to add an argument to RioKarmaTrack::readMetaData to pass in the
mountpoint of the karma -- I couldn't find any way to determine this
(ie. call mountPoint()) inside this function.

However, because of the way files are named on the karma, the
xine-engine doesn't recognize it as a playable music file -- see the
attached karma_music_unrecognized_by_xine.log.  I could, of course, add
an appropriate extension to the url so that it is identified properly --
but this would no doubt lead to a "file not found" error...

Any ideas?

--Joe
Index: riokarmamediadevice.cpp
===================================================================
--- riokarmamediadevice.cpp	(revision 626049)
+++ riokarmamediadevice.cpp	(working copy)
@@ -116,6 +116,14 @@ MediaItem
     }
 
     MetaBundle temp( bundle );
+
+    // Set up taggedTrack url for local playing
+    QString url;
+    url.sprintf( "/fids0/_%05x/%03x", fid >> 12, fid & 0x00000FFF );
+    url = "file://" + mountPoint() + url;
+    temp.setUrl( url );
+    debug() << "Set item #" << fid << " url = '" << temp.url() << "'" << endl;
+
     RioKarmaTrack *taggedTrack = new RioKarmaTrack( fid );
     taggedTrack->setBundle( temp );
 
@@ -507,7 +515,7 @@ RioKarmaMediaDevice::readKarmaMusic()
         else
         {
             RioKarmaTrack *track = new RioKarmaTrack( ret[i] );
-            track->readMetaData();
+            track->readMetaData(this->mountPoint());
             addTrackToView( track );
         }
         progress++;
@@ -552,10 +560,25 @@ RioKarmaTrack::~RioKarmaTrack()
  * Read track properties from the Karma and set it on the track
  */
 void
-RioKarmaTrack::readMetaData()
+RioKarmaTrack::readMetaData(const QString mountpoint)
 {
     MetaBundle *bundle = new MetaBundle();
 
+    // Set up url for local playing
+/*  Only works in Qt >= 4.0:
+    QString url = QString( "file://%1/fids0/_%2/%3" )
+                  .arg( mountpoint )
+                  .arg( m_id >> 12, 5, 16, '0' )
+                  .arg( m_id & 0x00000FFF, 3, 16, '0' )
+                  ;
+*/
+    QString url;
+    url.sprintf( "/fids0/_%05x/%03x", m_id >> 12, m_id & 0x00000FFF );
+    url = "file://" + mountpoint + url;
+
+    bundle->setUrl( url );
+    debug() << "Set item #" << m_id << " url = '" << bundle->url() << "'" << endl;
+
     bundle->setGenre( AtomicString( QString::fromUtf8( lk_properties_get_property( m_id, "genre" ) ) ) );
     bundle->setArtist( AtomicString( QString::fromUtf8( lk_properties_get_property( m_id, "artist" ) ) ) );
     bundle->setAlbum( AtomicString( QString::fromUtf8( lk_properties_get_property( m_id, "source" ) ) ) );
Index: riokarmamediadevice.h
===================================================================
--- riokarmamediadevice.h	(revision 626049)
+++ riokarmamediadevice.h	(working copy)
@@ -42,7 +42,7 @@ class RioKarmaTrack {
         MetaBundle                  *bundle() { return new MetaBundle( m_bundle ); }
         void                        setBundle( MetaBundle &bundle );
         void                        setId( int id ) { m_id = id; }
-        void                        readMetaData();
+        void                        readMetaData(const QString mountpoint);
         void                        addItem( const RioKarmaMediaItem *item );
         bool                        removeItem( const RioKarmaMediaItem *item );
     private:
amarok: BEGIN: UrlLoader
amarok:   [KDE::ProgressBar::ProgressBar(QWidget*, QLabel*)]
[New Thread -1312769104 (LWP 14228)]
amarok: BEGIN: virtual void ThreadWeaver::Thread::run()
amarok: BEGIN: virtual void UrlLoader::completeJob()
amarok:       [PlaylistLoader] The following urls were not suitable for the 
playlist:
amarok:       [PlaylistLoader]  file:///media/karma/fids0/_00004/760
amarok: END__: virtual void UrlLoader::completeJob() - Took 0.013s
amarok:     [ThreadWeaver] Job completed: UrlLoader. Jobs pending: 0
amarok: END__: UrlLoader - Took 1.2s
amarok:   [virtual KDE::ProgressBar::~ProgressBar()]
amarok: END__: virtual void ThreadWeaver::Thread::run() - Took 0.42s
[Thread -1312769104 (LWP 14228) exited]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-karma-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-karma-devel

Reply via email to