Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include 'Now Playing' info (D-Bus MPRIS) #72

Open
Norimaki opened this issue Oct 19, 2021 · 2 comments
Open

Include 'Now Playing' info (D-Bus MPRIS) #72

Norimaki opened this issue Oct 19, 2021 · 2 comments

Comments

@Norimaki
Copy link

Please consider including at least one field in the mpris metadata to indicate what is currently playing.

Something like .metadata["tuner.nowplaying"] (like vlc ["vlc.nowplaying"])

Although maybe it would be better to have:

"xesam: title" = player.nowplaying ("York - Farewell To The Moon)
"xesam: artist" = station.title ("Amb2FM")

and not

"xesam: title" = "Tuner"
"xesam: artist" = station.title

@heldderarbeit
Copy link

Hello, this is a feature I would love to see. Right now, the Wingpanel Sound Indicator panel is a bit empty (compared for example with the default Elementary music app):

Screenshot from 2021-11-20 03-46-28

I have no prior experience with Vala, but I hacked something together that - kinda - shows what could be a possible goal here:

Before

Screenshot from 2021-11-20 04-00-39

After

Screenshot from 2021-11-20 04-22-35

In DBusMediaPlayer.vala

public HashTable<string, Variant>? metadata {
   owned get {
      var table = new HashTable<string, Variant> (str_hash, str_equal);
      var playerController = Application.instance.player;
      var media_info = playerController.player.get_media_info();
      table.insert ("xesam:title", playerController.extract_title_from_stream(media_info));
      var station = Application.instance.player.station;
      if (station != null) {
         var station_title = station.title;
         var favicon_url = station.favicon_url;
         table.insert ("xesam:artist", get_simple_string_array (station_title));
         table.insert ("mpris:artUrl", favicon_url);
      } else {
         table.insert ("xesam:artist", get_simple_string_array (null));
      }
      return table;
   }
}

Now, the major problem with this construction is that song changes don't get reflected in the sound indicator area - The title is updated automatically in the main window of the app, but not outside of that. Does anyone know how to fix that?
Screenshot from 2021-11-20 05-09-50

@Norimaki
Copy link
Author

Hi, I have been working on mpris. You can see my progress here:
https://github.com/Norimaki/tuner/tree/master-mpris-wip

It's not finished but it should be works.

Regarding Wingpanel: I'm developing under xfce with xfce4-pulseaudio-plugin but maybe it's related.

I also had problems.
The main issue was the plugin expects to receive a Variant of type String (pulseaudio-mpris-player.c::player->title = g_strdup(g_variant_get_string(value, NULL));) but get_simple_string_array() does not send it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants