This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Script to query data from Amarok 2?

Tags: None
(comma "," separated)
User avatar
Oceanwaves
Registered Member
Posts
64
Karma
0
OS

Script to query data from Amarok 2?

Mon Nov 16, 2009 11:25 pm
Hi,

back in good old KDE3 times I used a script to check if Amarok is running and query some information about the current song when Amarok was playing.

This is the relevant part of the script:
Code: Select all
pgrep -x -u $USER $PLAYER 2>&1 >/dev/null && PLAYING=`dcop amarok player isPlaying`
if [ "$PLAYING" = "true" ]
then
        ALBUM=`dcop amarok player album`
        ARTIST=`dcop amarok player artist`
        TITLE=`dcop amarok player title`
        YEAR=`dcop amarok player year`
        echo "Just listening to: $ARTIST - $TITLE ($ALBUM, $YEAR)"
fi


Now that DCOP is gone, how can I get the same result using dbus? I'm not a programmer and don't know very much about dbus.

Oliver
User avatar
Mamarok
Manager
Posts
6071
Karma
16
OS
You should have a look here:

http://amarok.kde.org/wiki/Development/ ... _HowTo_2.0

There is also a link to the MPRIS reference in that page.


Running Kubuntu 22.10 with Plasma 5.26.3, Frameworks 5.100.0, Qt 5.15.6, kernel 5.19.0-23 on Ryzen 5 4600H, AMD Renoir, X11
FWIW: it's always useful to state the exact Plasma version (+ distribution) when asking questions, makes it easier to help ...
User avatar
Oceanwaves
Registered Member
Posts
64
Karma
0
OS
Mamarok wrote:You should have a look here:

http://amarok.kde.org/wiki/Development/ ... _HowTo_2.0

There is also a link to the MPRIS reference in that page.

Thanks for your reply. If I understand correct I have to use MPRIS to talk to Amarok. Unfortunately I'm not a programmer and I don't understand how to use it from a shell script. I'll try to search for some example scripts using MPRIS...

Oliver


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell