|
||||||
| Forums FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Interesting, I had not seen qdbus in use before.
However on trying it here, I don't see Amarok on the dbus list. From some tutes, it appears that this requires Amarok 2. I'm still running Amarok 1.4. Do you have Amarok 2? What do you get when you just run qdbus ? Is org.kde.amarok in the output? It isn't on mine. |
|
||||
|
Code:
#! /bin/bash BITRATE="$(qdbus org.kde.amarok /Player GetMetadata | grep bitrate | sed 's/audio-bitrate: //')" ARTIST="$(qdbus org.kde.amarok /Player GetMetadata | grep artist | sed 's/artist: //')" ALBUM="$(qdbus org.kde.amarok /Player GetMetadata | grep album | head -n 1 | sed 's/album: //')" TITLE="$(qdbus org.kde.amarok /Player GetMetadata | grep title | tail -n 1 | sed 's/title: //')" YEAR="$(qdbus org.kde.amarok /Player GetMetadata | grep year | sed 's/year: //')" SAMPLERATE="$(qdbus org.kde.amarok /Player GetMetadata | grep audio-samplerate | sed 's/audio-samplerate: //')" echo -e "np: $ARTIST - $TITLE <$ALBUM ($YEAR)> [$FILETYPE @ $BITRATE kbps | $SAMPLERATE hz ] [$NOW/$TIME]"
__________________
My site: http://microchip.bplaced.net My repo: http://download.opensuse.org/repositories/home:/microchip8 SUSE Unbound Forum: http://suseunbound.lefora.com Do coders dream of sheep() ? |
|
|||
|
I would also add that you should avoid calling qdbus multiple times. It's easy enough to save the output in a shell variable and then grep that. Or pipe the output to a script which will do the parsing in one pass.
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|