miraclx/cmusd

(Mac OS X - High Sierra) Media Player Instance Not Visible

ricardoaiglesias opened this issue · 3 comments

Howdy. I recently downloaded this application through npm. It's correctly logging which song is currently playing and the location of the album art for each individual song, but regardless of what I do, I can't seem to be able to have the Media Player Instance show up. I read through the readme and the index.js file, but wasn't able to diagnose the root cause.

Again, thanks for this cool application!

screen shot 2019-02-23 at 8 07 30 pm

Hi @ricardoaiglesias.

I don't have a Mac, so i haven't tested this program on macOS...yet

This program uses D-Bus within to communicate with the MPRIS interface which in turn communicates with the media player controller on any host OS

AFAIK, MacOS doesn't natively support D-Bus

For assurance

$ dbus-send

If unexistent, you can install D-Bus using Homebrew. Check if its already installed

$ brew --version

If not, you can read here to install brew

After installation, install dbus

$ brew install d-bus

You might need to read here for help installing this or here (may be deprecated)

After the installation and setup, In another terminal;

$ cmusd # To test

Now, let's introspect the D-Bus process

$ # If qdbus is installed
$ qdbus org.mpris.MediaPlayer2.cmus /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata

$ # Otherwise, fallback to `dbus`, verbose output though
$ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.cmus /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.Player string:Metadata

If this runs without error, then cmusd is connected and talking to dbus successfully. To test this, lets toggle playpause

$ qdbus org.mpris.MediaPlayer2.cmus /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
$ # OR
$ dbus-send --dest=org.mpris.MediaPlayer2.cmus --type=method_call /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

If the media integration didn't still show up then it means macOS doesn't use MPRIS too and I'll have to do some research and add support for whatever it uses....this would be difficult given I don't have a mac

Yeah, its pretty cool and I really do hope it works at your end
I should probably include a dbus checker in the script...It's got me wondering why it didn't throw an error if it didn't detect dbus.

Regards,
Miraculous Owonubi

(Just as background, when I attempted to install dbus on Mac OS X through homebrew it didn't work. It only worked once I installed it through MacPorts).

I ran the second command on each of the two code blocks towards the end:

dbus-send --print-reply --dest=org.mpris.MediaPlayer2.cmus /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.Player string:Metadata
dbus-send --dest=org.mpris.MediaPlayer2.cmus --type=method_call /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

Once I did so, the player paused but Media Integration did NOT show up.

Attached is the result of me sending the second command I ran.
screen shot 2019-02-24 at 11 59 55 am

So, it's confirmed cmusd, dbus and MPRIS are connected and communicating but macOS doesn't use the dbus interfaces to communicate between apps (unlike linux). Unfortunately I don't have a mac around I would've tweaked the code to support macOS's media interface.

I would leave this issue open so in case anyone wants to take this up, you can create a pull request and lets see how that goes.