docs.kde.org
The DCOP Interface
Prev
Next

The DCOP Interface

The Amarok DCOP interface provides you with an easy way to control Amarok with your own custom scripts.

The DCOP interface for Amarok has many generic calls that may be found in other KDE applications. This section is divided into six tables and is intended to describe the DCOP calls of the collection, contextbrowser, player, playlist, playlistbrowser and scripts. An example of the “pause” dcop call would look like:

%dcop amarok player pause

dcop amarok collection

DCOP CallAction
int totalAlbums()Returns the total of albums in the collection.
int totalArtists()Returns the total of artists in the collection.
int totalCompilations()Returns the total of compilations in the collection.
int totalGenres()Returns the total of genres in the collection.
int totalTracks()Returns the total of tracks in the collection.
QString query( QString sql)Queries the database via SQL.
QStringList similarArtists( int artists )Return similar artists of the current tracks, limit to int artists.
void migrateFile( QString oldURL, QString newURL )Move a file in the collection, keeping stats intact.
void scanCollection()Scan the collection.
void scanCollectionChanges()Scan the collection for changes only.

dcop amarok contextbrowser

DCOP CallAction
void showCurrentTrack()Show the current track in the context browser.
void showLyrics()Show the lyrics tab in the context browser.
void showWiki()Show the wikipedia tab in the context browser.

dcop amarok player

DCOP CallAction
bool dynamicModeStatus()Return dynamic mode status.
bool equalizerEnabled()Return the equalizer status.
bool isPlaying()Return true if something is playing now.
bool randomModeStatus()Return random mode status.
bool repeatPlaylistStatus()Return repeat playlist status.
bool repeatTrackStatus()Return repeat track status.
int getVolume()Return volume in range 0-100%.
int sampleRate()Return the sample rate of the currently playing track.
int score()Return the score of the currently playing track.
int status()Return playback status: 0 - stopped, 1 - paused, 2 - playing.
int trackCurrentTime()Return current play position in seconds.
int trackPlayCounter()Return play counter for current song.
int trackTotalTime()Return track length in seconds.
QString album()Return the album of the currently playing track.
QString artist()Return the artist of the currently playing track.
QString bitrate()Return the bitrate of the currently playing track (XX kbps).
QString comment()Return the comment of the currently playing track.
QString coverImage()Return the encoded URL of the current track's cover image
QString currentTime()Return the position of the currently playing track ([h:]mm:ss format).
QString encodedURL()Return the encoded URL of the currently playing track.
QString engine()Return the current sound engine.
QString genre()Return the genre of the currently playing track.
QString lyrics()Return the lyrics of the currently playing track.
QString lyricsByPath( QString path )Return the lyrics of a track by path.
QString nowPlaying()The title of now playing media.
QString path()Return the unencoded path of the currently playing track.
QString setContextStyle( QString )Set the CSS style for the context browser.
QString title()Return the title of the currently playing track.
QString totalTime()Return the total length of the currently playing track ([h:]mm:ss format).
QString track()Return the track number.
QString type()Return the file type.
QString year()Return the year of the currently playing track.
void configEqualizer()Toggle equalizer config dialog.
void enableDynamicMode(bool enable)Switch Dynamic Mode on or off.
void enableOSD(bool enable)Switch OSD display on or off.
void enableRandomMode(bool enable)Switch Random Mode on or off.
void enableRepeatPlaylist(bool enable)Switch Repeat Playlist on or off.
void enableRepeatTrack(bool enable)Switch Repeat Track on or off.
void mediaDeviceMount()Sets the command used for mounting media device.
void mediaDeviceUmount()Sets the command used for unmounting media device.
void mute()Toggle mute.
void next()Equivalent to pressing "Next" button.
void pause()Equivalent to pressing "Pause" button.
void play()Equivalent to pressing "Play" button.
void playPause()Toggle play/pause state (good for mm keyboard users)
void prev()Equivalent to pressing "Prev" button.
void queueForTransfer( KURL url )Queue file for transfer to Media Device.
void seek(int s)Seek track to seconds position.
void seekRelative(int s)Seek to a position relative to the current track position.
void setEqualizer(int, int, int, int, int, int, int, int, int, int, int)Set the equalizer bands
void setEqualizerEnabled( bool active )Toggle equalizer.
void setEqualizerPreset( QString name )Set the equalizer preset
void setLyricsByPath( QString url, QString lyrics )Set the lyrics of a track by it's path.
void setScore( int score )Set the score of the currently playing track.
void setScoreByPath( QString url, int score )Set the score of a track by it's path.
void setVolume(int volume)Set volume in range 0-100%.
void showBrowser( QString browser )Shows browsers in the playlist window
void showOSD()Show the OSD display on the screen.
void stop()Equivalent to pressing "Stop" button.
void transferDeviceFiles()Transfer files to media device.
void volumeDown()Decrease volume by a reasonable step.
void volumeUp()Increase volume by a reasonable step.

dcop amarok playlist

DCOP CallAction
int getActiveIndex()Return the index of the currently active track. -1 if none.
int getTotalTrackCount()Return number of tracks in playlist. 0 if none.
QString saveCurrentPlaylist()Saves the current playlist to current.xml and returns its path.
void addMedia( KURL )Add audio media specified by the url.
void addMediaList( KURL::List )Add some audio media specified by the url.
void clearPlaylist()Clears the playlist.
void playByIndex(int)Starts playing the track at the specified index.
void playMedia( KURL )Add audio media specified by the url.
void popupMessage( QString)Shows a temporary popup message.
void removeCurrentTrack()Removes the current-track item from the playlist.
void repopulate()Repopulate the playlist with random tracks.
void saveM3u( QString path, bool relativePaths)Saves the current playlist as m3u.
void setStopAfterCurrent( bool )Enables/disables the "Stop After Current Track" feature.
void shortStatusMessage( QString)Shows a temporary message on the statusbar.
void shufflePlaylist()Shuffles the playlist.
void togglePlaylist()Toggle the Playlist-window.

dcop amarok playlistbrowser

DCOP CallAction
void addPodcast( QString )Add a podcast entry to the playlist browser.
void scanPodcasts()Scan all podcasts for updates.
void addPlaylist( QString )Add a playlist to the playlist browser.

dcop amarok script

DCOP CallAction
bool runScript( QString name)Starts the script with the given name. Returns true on success.
bool stopScript( QString name)Stops the script with the given name. Returns true on success.
QStringList listRunningScripts()Returns a list of all currently running scripts.
void addCustomMenuItem(QString submenu, QString itemTitle )Enables and sets custom menu item title.
void removeCustomMenuItem(QString submenu, QString itemTitle )Removes the custom menu item.
QString readConfig( QString key)Returns a AmarokConfig configuration entry value from the given key.
Prev
Next
Contents


docs.kde.org