Monday, February 26, 2007

Amarok playing directly from MTP device - part 1

For the past couple of days I have been hacking into Amarok so that I can play media files directly from my MTP device by doubleclicking instead of first moving them to the collection and then to the playlist as I was led to believe in this post. It is working now and I will release the code in another post.
On the way I found this peculiar problem with KTempDir. When I use it to cache the media files, Amarok loses the metadata info associated with that MediaItem but if I use /tmp/ then it retains them. Here is the screenshot of the playlist ...

and here is the debugging output. Wrong one in red and right one in green.

amarok: [MtpMediaDevice] Proxy for: file://First_Of_May.mp3 is mtpcacheFosog7/First_Of_May.mp3
amarok: BEGIN: UrlLoader
amarok: [KDE::ProgressBar::ProgressBar(QWidget*, QLabel*)]
amarok: BEGIN: virtual void ThreadManager::Thread::run()
amarok: BEGIN: void EngineController::play(const MetaBundle&, uint)
amarok: [controller] Loading URL: mtpcacheFosog7/First_Of_May.mp3
amarok: [controller] Connecting to protocol:
amarok: BEGIN: virtual bool XineEngine::load(const KURL&, bool)
amarok: [xine-engine] Before xine_open() *****
amarok: [xine-engine] After xine_open() *****
amarok: [xine-engine] XINE_PARAM_EARLY_FINISHED_EVENT disabled
amarok: END__: virtual bool XineEngine::load(const KURL&, bool) - Took 0.048s
amarok: BEGIN: virtual bool XineEngine::play(uint)
amarok: BEGIN: void EngineSubject::stateChangedNotify(Engine::State)
amarok: [virtual void Amarok::StatusBar::engineStateChanged(Engine::State, Engine::State)] Line: 153
amarok: BEGIN: virtual void ContextBrowser::engineStateChanged(Engine::State, Engine::State)
amarok: END__: virtual void ContextBrowser::engineStateChanged(Engine::State, Engine::State) - Took 0.00069s
amarok: END__: void EngineSubject::stateChangedNotify(Engine::State) - Took 0.0048s
amarok: END__: virtual bool XineEngine::play(uint) - Took 0.0055s
amarok: BEGIN: void EngineSubject::newMetaDataNotify(const MetaBundle&, bool)
amarok: [Moodbar] Resetting moodbar:
amarok: END__: void EngineSubject::newMetaDataNotify(const MetaBundle&, bool) - Took 0.19s
amarok: END__: void EngineController::play(const MetaBundle&, uint) - Took 0.25s
amarok: [xine-engine] XINE_PARAM_EARLY_FINISHED_EVENT disabled
amarok: BEGIN: virtual void UrlLoader::completeJob()
amarok: END__: virtual void UrlLoader::completeJob() - Took 0.0003s
amarok: [ThreadManager] Job completed: UrlLoader. Jobs pending: 0
amarok: END__: UrlLoader - Took 0.47s


amarok: [MtpMediaDevice] Proxy for: file://Who S Crying Now.mp3 is /tmp/Who S Crying Now.mp3
amarok: BEGIN: UrlLoader
amarok: [KDE::ProgressBar::ProgressBar(QWidget*, QLabel*)]
amarok: BEGIN: virtual void ThreadManager::Thread::run()
amarok: BEGIN: void EngineController::play(const MetaBundle&, uint)
amarok: [controller] Loading URL: file:///tmp/Who%20S%20Crying%20Now.mp3
amarok: BEGIN: virtual bool XineEngine::load(const KURL&, bool)
amarok: [xine-engine] Before xine_open() *****
amarok: [xine-engine] After xine_open() *****
amarok: [xine-engine] XINE_PARAM_EARLY_FINISHED_EVENT disabled
amarok: END__: virtual bool XineEngine::load(const KURL&, bool) - Took 0.047s
amarok: BEGIN: virtual bool XineEngine::play(uint)
amarok: BEGIN: void EngineSubject::stateChangedNotify(Engine::State)
amarok: [virtual void Amarok::StatusBar::engineStateChanged(Engine::State, Engine::State)] Line: 153
amarok: BEGIN: virtual void ContextBrowser::engineStateChanged(Engine::State, Engine::State)
amarok: END__: virtual void ContextBrowser::engineStateChanged(Engine::State, Engine::State) - Took 0.00083s
amarok: END__: void EngineSubject::stateChangedNotify(Engine::State) - Took 0.0051s
amarok: END__: virtual bool XineEngine::play(uint) - Took 0.0059s
amarok: BEGIN: void EngineSubject::newMetaDataNotify(const MetaBundle&, bool)
amarok: [Moodbar] Resetting moodbar: /tmp/Who S Crying Now.mp3
amarok: [Moodbar] Moodbar::readFile: Trying to read /home/swapan/.kde/share/apps/amarok/moods/-1,.,tmp,Who S Crying Now.mood
amarok: [Moodbar] Moodbar::readFile: Trying to read /home/swapan/.kde/share/apps/amarok/moods/-1,.,tmp,Who S Crying Now.mood
amarok: [Moodbar] MoodServer::queueJob: Queued job for /tmp/Who S Crying Now.mp3, 1 jobs in queue.
amarok: [ContextBrowser] [CUEFILE]: /tmp/Who S Crying Now.cue - Shoot blindly and missed, searching for other cue files.
amarok: [ContextBrowser] [CUEFILE]: - Didn't find any matching cue file.
amarok: END__: virtual void ThreadManager::Thread::run() - Took 0.11s
amarok: BEGIN: virtual void ThreadManager::Thread::run()
amarok: END__: void EngineSubject::newMetaDataNotify(const MetaBundle&, bool) - Took 0.65s
amarok: END__: void EngineController::play(const MetaBundle&, uint) - Took 0.71s
amarok: BEGIN: virtual void UrlLoader::completeJob()
amarok: END__: virtual void UrlLoader::completeJob() - Took 0.00033s

No comments: