Bug 500642 - How to use dbus-send?
Summary: How to use dbus-send?
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: D-Bus interfaces (other bugs)
Version First Reported In: 2.9.71
Platform: Other Linux
: NOR normal
Target Milestone: kf5
Assignee: Amarok Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-23 21:56 UTC by Nihin Dula
Modified: 2025-02-24 20:23 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nihin Dula 2025-02-23 21:56:22 UTC
OS: openSUSE Leap 15.6
KDE-Plasma-Version: 5.27.11
KDE-Frameworks-Version: 5.115.0
dbus-1-1.12.2-150400.18.8.1.x86_64
dbus-1-x11-1.12.2-150400.18.8.1.x86_64

Please say, how to control Amarok using dbus-send. It's essential to control Amarok with IR remote Control:
lirc --> irexec --> dbus-send --> amarok

No command I found works. For example:
"dbus-send --type=method_call --dest=org.kde.amarok /Player org.freedesktop.MediaPlayer.Play"
Nothing happens.

I read all the Amarok docs, howtos and FAQs but didn't find anything useful. It's really sad to ignore such a useful function.
Comment 1 Tuomas Nurmi 2025-02-24 16:58:25 UTC
An interesting question. Never tried myself before, but I tried exploring with qdbusviewer6. Seems like the correct method nowadays is org.mpris.MediaPlayer2.Player.Play and command line
dbus-send --type=method_call --dest=org.kde.amarok /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play
seems to work. Other commands seem to be discoverable with qdbusviewer, too. You are very welcome to update any related documentation you find outdated or insufficient.
Comment 2 Nihin Dula 2025-02-24 17:28:18 UTC
Your command
dbus-send --type=method_call --dest=org.kde.amarok /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play
works.

But I found playerctl. Very simple to use. Used for amarok, vlc, mpv, RhythmBox, web browsers, cmus, mpd, spotify, ...
Playerctl is a command-line utility and library for controlling media players that implement the MPRIS D-Bus Interface Specification.

https://github.com/altdesktop/playerctl

I tested this commands for Amarok:
playerctl play-pause
playerctl position 0
playerctl stop
playerctl previous
playerctl next
playerctl position 5-
playerctl position 5+
Comment 3 Tuomas Nurmi 2025-02-24 20:23:40 UTC
Ok, good to hear you found a solution for your usecase. As far as I know, the general mpris interface should indeed work pretty ok (except for the couple of open feature requests for missing functionalities, filed against d-bus interfaces), either by e.g. manually exploring with qdbusviewer6 or using some ready mpris capable tool.