tuner icon indicating copy to clipboard operation
tuner copied to clipboard

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

Open Norimaki opened this issue 2 years ago • 2 comments

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

Norimaki avatar Oct 19 '21 11:10 Norimaki

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

heldderarbeit avatar Nov 20 '21 04:11 heldderarbeit

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.

Norimaki avatar Dec 25 '21 10:12 Norimaki