2

If you have only one instance of VLC running, you can talk to VLC with dbus-send using org.mpris.MediaPlayer2.vlc as destination:

$ dbus-send --dest=org.mpris.MediaPlayer2.vlc ... 

If you have two instances of VLC running, they have different destinations xxxx and yyyy. If you want to talk to one of them, you must use xxxx or yyyy as destination:

$ dbus-send --dest=:xxxx ... 

The destination of the first instance I can find in this way:

$ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBusorg.freedesktop.DBus.ListQueuedOwners string:org.mpris.MediaPlayer2.vlc method return time=1702494718.199915 sender=org.freedesktop.DBus -> destination=:1.1256 serial=3 reply_serial=2 array [ string ":1.1251" ] 

Then I see that the destination is 1.1251

But how can I get the destination of the second instance?

2
  • I don't know what you mean by destinations. Did you try looking at the output of ps auexww | grep -i '[V]LC' ? Maybe that will give you more clues. Commented Dec 14, 2023 at 5:56
  • @shelter Does not help me. I have edited the question. Commented Dec 14, 2023 at 8:01

1 Answer 1

3

i always use busctl to get the complete dbus infos.
There is a system bus (busctl --system) and a session bus (busctl --user) or complete list (busctl -l)
enter:

busctl --user | grep "vlc"

then you get something like this

:1.641 91266 vlc xxxxx :1.641 session-c2.scope c2 - :1.642 91266 vlc xxxxx :1.642 session-c2.scope c2 - :1.643 91266 vlc xxxxx :1.643 session-c2.scope c2 - :1.644 91266 vlc xxxxx :1.644 session-c2.scope c2 - :1.654 91361 vlc xxxxx :1.654 session-c2.scope c2 - :1.655 91361 vlc xxxxx :1.655 session-c2.scope c2 - :1.656 91361 vlc xxxxx :1.656 session-c2.scope c2 - :1.657 91361 vlc xxxxx :1.657 session-c2.scope c2 - org.kde.StatusNotifierItem-91266-2 91266 vlc xxxxx :1.644 session-c2.scope c2 - org.kde.StatusNotifierItem-91361-2 91361 vlc xxxxx :1.657 session-c2.scope c2 - org.mpris.MediaPlayer2.vlc 91266 vlc xxxxx :1.641 session-c2.scope c2 - org.mpris.MediaPlayer2.vlc.instance91361 91361 vlc xxxxx :1.654 session-c2.scope c2 

The org files are the active services.
you see there is a second service called org.mpris.MediaPlayer2.vlc.instance91361
the first vlc instance is on PID 91266, the second vlc instance is on PID 91361

here in my example call:

dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListQueuedOwners string:org.mpris.MediaPlayer2.vlc.instance91361

will give you your information about the second instance

----------- By the way

you can examine the dbus service for the object tree
busctl --user tree org.mpris.MediaPlayer2.vlc.instance91361

you get:

└─/org └─/org/mpris └─/org/mpris/MediaPlayer2 

then you also can introspect the objects
busctl --user introspect org.mpris.MediaPlayer2.vlc.instance91361 /org/mpris/MediaPlayer2

output:

NAME TYPE SIGNATURE RESULT/VALUE FLAGS org.freedesktop.DBus.Introspectable interface - - - .Introspect method - s - org.freedesktop.DBus.Properties interface - - - .Get method ss v - .GetAll method s a{sv} - .Set method ssv - - .PropertiesChanged signal sa{sv}as - - org.mpris.MediaPlayer2 interface - - - .Quit method - - - .Raise method - - - .CanQuit property b true emits-change .CanRaise property b false emits-change .CanSetFullscreen property b false emits-change .DesktopEntry property s "vlc" emits-change .Fullscreen property b false emits-change writable .HasTrackList property b false emits-change .Identity property s "VLC media player" emits-change .SupportedMimeTypes property as 29 "audio/mpeg" "audio/x-mpeg" "video/m… emits-change .SupportedUriSchemes property as 21 "file" "http" "https" "rtsp" "realrt… emits-change org.mpris.MediaPlayer2.Player interface - - - .Next method - - - .OpenUri method s - - .Pause method - - - .Play method - - - .PlayPause method - - - .Previous method - - - .Seek method x - - .SetPosition method ox - - .Stop method - - - .CanControl property b true emits-change .CanPause property b false emits-change .CanPlay property b false emits-change .CanSeek property b false emits-change .LoopStatus property s "None" emits-change writable .MaximumRate property d 32 emits-change writable .Metadata property a{sv} 0 emits-change .MinimumRate property d 0.032 emits-change writable .PlaybackStatus property s "Stopped" emits-change .Position property i 0 emits-change .Rate property d 1 emits-change writable .Shuffle property d false emits-change writable .Volume property d 0 emits-change writable org.mpris.MediaPlayer2.TrackList interface - - - .AddTrack method sob - - .GetTracksMetadata method ao aa{sv} - .GoTo method o - - .RemoveTrack method o - - .CanEditTracks property b true emits-change .Tracks property ao 0 emits-change .TrackAdded signal a{sv}o - - .TrackListReplaced signal aoo - - .TrackMetadataChanged signal oa{sv} - - .TrackRemoved signal o - - 

you see all defined interfaces and methods.

for example, lets take the "OpenUri" method from the interface: org.mpris.MediaPlayer2.Player

busctl --user call org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player OpenUri s "your url"
-- will open the video in the first instance

busctl --user call org.mpris.MediaPlayer2.vlc.instance91361 /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player OpenUri s "your url"
-- will open a video in the second instance

call Syntax:
============
call SERVICE OBJECT INTERFACE METHOD [SIGNATURE [ARGUMENT...]]
for further information - see busctl - help

have a nice day!

4
  • Very helpful! I didn't know about busctl. Thank you for helping me. Commented Dec 14, 2023 at 14:11
  • Wow! Thanks for sharing! Commented Dec 14, 2023 at 15:14
  • @EddySorngard : You can also up-vote this answer to give further reputation points to Schmaehgrunza. Commented Dec 14, 2023 at 15:18
  • @EddySorngard i forgot to tell you, the number you search for, you also get with busctl --user status org.mpris.MediaPlayer2.vlc, search for UniqueName for example =:1.641, every service is also reachable over a unique number, instead of the name org.mpris.MediaPlayer2.vlc you can also use :1.641, for example - busctl --user tree :1.641, Commented Dec 14, 2023 at 15:35

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.