Summary: | [PATCH] Enable playing audio CDs in Amarok on CD insert | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Will Stephenson <wstephenson> |
Component: | general | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Patch implementing feature |
Description
Will Stephenson
2006-10-21 22:44:32 UTC
Created attachment 18219 [details]
Patch implementing feature
SVN commit 597863 by aumuell: apply patch for playing audio cds on insertion BUG: 136106 M +1 -0 ChangeLog M +2 -1 src/Makefile.am A src/amarok_play_audiocd.desktop M +3 -0 src/app.cpp M +22 -0 src/devicemanager.cpp M +6 -0 src/devicemanager.h --- trunk/extragear/multimedia/amarok/ChangeLog #597862:597863 @@ -29,6 +29,7 @@ CHANGES: + * Enable playing audio CDs on CD insert. (BR 136106) * Bring Amarok main window to front when starting amarok again without arguments. (BR 135396) * Don't switch to playlist browser after saving a playlist from files tab. --- trunk/extragear/multimedia/amarok/src/Makefile.am #597862:597863 @@ -224,7 +224,8 @@ servicemenu_DATA = \ amarok_addaspodcast.desktop \ - amarok_append.desktop + amarok_append.desktop \ + amarok_play_audiocd.desktop profiledatadir = \ --- trunk/extragear/multimedia/amarok/src/app.cpp #597862:597863 @@ -25,6 +25,7 @@ #include "collectionbrowser.h" #include "dbsetup.h" //firstRunWizard() #include "debug.h" +#include "devicemanager.h" #include "mediadevicemanager.h" #include "enginebase.h" #include "enginecontroller.h" @@ -277,6 +278,7 @@ { haveArgs = true; QString device = args->getOption("cdplay"); + device = DeviceManager::instance()->convertMediaUrlToDevice( device ); KURL::List urls; if (EngineController::engine()->getAudioCDContents(device, urls)) { Playlist::instance()->insertMedia( @@ -335,6 +337,7 @@ { "engine <name>", I18N_NOOP( "Use the <name> engine" ), 0 }, { "cwd <directory>", I18N_NOOP( "Base for relative filenames/URLs" ), 0 }, { "cdplay <device>", I18N_NOOP("Play an AudioCD from <device>"), 0 }, + //FIXME: after string freeze { "cdplay <device>", I18N_NOOP("Play an AudioCD from <device> or system:/media/<device>"), 0 }, { 0, 0, 0 } }; --- trunk/extragear/multimedia/amarok/src/devicemanager.cpp #597862:597863 @@ -24,6 +24,7 @@ #include <dcopclient.h> #include <dcopobject.h> +#include <dcopref.h> #include <kapplication.h> typedef Medium::List MediumList; @@ -226,4 +227,25 @@ return returnedMedium; } +QString DeviceManager::convertMediaUrlToDevice( QString url ) +{ + QString device; + if ( url.startsWith( "media:" ) || url.startsWith( "system:" ) ) + { + KURL devicePath( url ); + DCOPRef mediamanager( "kded", "mediamanager" ); + DCOPReply reply = mediamanager.call( "properties(QString)", devicePath.fileName() ); + if ( reply.isValid() ) { + QStringList properties = reply; + device = properties[ 5 ]; + //kdDebug() << "DeviceManager::convertMediaUrlToDevice() munged to: " << device << "\n"; + } else + device = QString(); + } + else + device = url; + + return device; +} + #include "devicemanager.moc" --- trunk/extragear/multimedia/amarok/src/devicemanager.h #597862:597863 @@ -54,6 +54,12 @@ //warning about getDeviceList() QStringList getDeviceStringList(); + // Converts a media://media/hdc URL as provided by the KDE media + // manager on CD insert to /dev/hdc so amarok can play it. + // This method is safe to call with a device path, it returns it + // unchanged. + QString convertMediaUrlToDevice( QString url ); + signals: void mediumAdded( const Medium*, QString ); void mediumChanged( const Medium*, QString ); SVN commit 597963 by seb: SVN_SILENT Give bille the credit he deserves for his audiocd patch. CCBUG: 136106 M +2 -1 ChangeLog --- trunk/extragear/multimedia/amarok/ChangeLog #597962:597963 @@ -29,7 +29,8 @@ CHANGES: - * Enable playing audio CDs on CD insert. (BR 136106) + * Enable playing audio CDs on CD insert. Patch by Will Stephenson + <wstephenson@kde.org>. (BR 136106) * Bring Amarok main window to front when starting amarok again without arguments. (BR 135396) * Don't switch to playlist browser after saving a playlist from files tab. |