sakithb / media-controls

A media indicator for the Gnome shell.
MIT License
221 stars 33 forks source link

Blacklist doesn't work for one program #129

Closed aacater closed 1 month ago

aacater commented 5 months ago

If I have blacklisted a program, the extension ignores the blacklist when I open the blacklisted program.

However, if the extension already sees the program and has controls for it and then I blacklist the program, the extension properly ignores the program. But then if I restart the program, the extension ignores the blacklist again and shows controls for the blacklisted program.

The program I am trying to block is freetube, installed as a flatpak (link). The extension properly blocks Spotify however, also installed as a flatpak. So maybe this is a problem with freetube and not the extension?

Info:

P.S. I really like the rewrite, good work!

sakithb commented 5 months ago

I just installed Freetube and tried blacklisting it, and it worked as expected, the extension does not show up when opening Freetube if its is blacklisted. The last update was a total rewrite of the extension so it was rather a huge update, so can you try removing all blacklisted players and adding them one by one?

aacater commented 5 months ago

The only app I want to block is freetube so my blacklist is empty except for it. I have removed and re-added it multiple times.

Since its just me, I'll continue to test. Like seeing if it happens on my laptop or if its just my desktop for some reason.

aacater commented 5 months ago

Same behavior on my laptop. Also running Fedora Silverblue.

Also tested blocking Firefox, it works as expected. So it seems I am only having trouble with Freetube for some reason.

sakithb commented 5 months ago

Does the extension show the correct freetube icon?

aacater commented 5 months ago

No, it does not. However the icon is show properly in the blacklist settings.

Screenshot from 2024-01-20 08-06-15

aacater commented 5 months ago
sakithb commented 5 months ago

I noticed that Freetube exposes two MPRIS services (this extensions uses these services to identify media players), one was called Freetube and the other was called chromium (this makes sense assuming Freetube uses Electron), maybe this plays a part in the issue, I am not sure, but I will look into it. The odd thing is I always get the correct Freetube icon in the extension. What is your freetube version?

aacater commented 5 months ago

I am currently using v0.19.1 Beta.

sakithb commented 5 months ago

Im on the same version. It's really weird that it works for me, but not for you. Is you laptop on Fedora Silverblue as well?

aacater commented 5 months ago

Yes, laptop is running Fedora Silverblue as well.


Random information/thoughts that may or may not be helpful:


I am still trying to track down the exact circumstances of when blacklist works and when it doesn't. Currently it seems to work after a certain amount of time. Or something I do infrequently makes it work.

It definitely doesn't work right after I reboot and/or login. Which is weird to me, I would expect it to work then if at all...

Is there any debug logs I can provide or something like that?

sakithb commented 5 months ago

Can you post the output of this command? gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.ListNames | grep -Poi "'org.mpris.Mediaplayer2\..+?'" | xargs -I{} gdbus introspect --session --dest {} --object-path /org/mpris/MediaPlayer2

This command will list all the active media players and fetch their information via gdbus. Make sure the freetube is open and playing a video before running this command.

aacater commented 5 months ago

gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.ListNames | grep -Poi "'org.mpris.Mediaplayer2\..+?'" | xargs -I{} gdbus introspect --session --dest {} --object-path /org/mpris/MediaPlayer2

node /org/mpris/MediaPlayer2 {
};
node /org/mpris/MediaPlayer2 {
  interface org.freedesktop.DBus.Properties {
    methods:
      Get(in  s interface_name,
          in  s property_name,
          out v value);
      GetAll(in  s interface_name,
             out a{sv} properties);
      Set(in  s interface_name,
          in  s property_name,
          in  v value);
    signals:
      PropertiesChanged(s interface_name,
                        a{sv} changed_properties,
                        as invalidated_properties);
    properties:
  };
  interface org.freedesktop.DBus.Introspectable {
    methods:
      Introspect(out s xml_data);
    signals:
    properties:
  };
  interface org.freedesktop.DBus.Peer {
    methods:
      Ping();
      GetMachineId(out s machine_uuid);
    signals:
    properties:
  };
  interface org.mpris.MediaPlayer2 {
    methods:
      Raise();
      Quit();
    signals:
    properties:
      readonly b CanQuit = true;
      readonly b CanSetFullscreen = false;
      readonly b CanRaise = true;
      readonly b HasTrackList = false;
      readonly s Identity = 'Spotify';
      readonly s DesktopEntry = 'spotify';
      readonly as SupportedUriSchemes = ['spotify'];
      readonly as SupportedMimeTypes = [];
  };
  interface org.mpris.MediaPlayer2.Player {
    methods:
      Next();
      Previous();
      Pause();
      PlayPause();
      Stop();
      Play();
      Seek(in  x Offset);
      SetPosition(in  o TrackId,
                  in  x Position);
      OpenUri(in  s Uri);
    signals:
      Seeked(x Position);
    properties:
      readonly s PlaybackStatus = 'Paused';
      readwrite s LoopStatus = 'None';
      readwrite d Rate = 1.0;
      readwrite b Shuffle = true;
      readonly a{sv} Metadata = {'mpris:trackid': <'/com/spotify/track/6m4HWTYMRSJkaUuvXTaNmE'>, 'mpris:length': <uint64 203066000>, 'mpris:artUrl': <'https://i.scdn.co/image/ab67616d0000b273c3c0ca7a4929d96f2f1c5774'>, 'xesam:album': <'The Good, The Bad and The Ugly (Original Motion Picture Soundtrack) [Remastered Edition]'>, 'xesam:albumArtist': <['Ennio Morricone']>, 'xesam:artist': <['Ennio Morricone']>, 'xesam:autoRating': <0.54000000000000004>, 'xesam:discNumber': <1>, 'xesam:title': <"The Ecstasy of Gold - L'Estasi Dell'oro">, 'xesam:trackNumber': <20>, 'xesam:url': <'https://open.spotify.com/track/6m4HWTYMRSJkaUuvXTaNmE'>};
      readwrite d Volume = 0.4516060120546273;
      readonly x Position = 124503000;
      readonly d MinimumRate = 1.0;
      readonly d MaximumRate = 1.0;
      readonly b CanGoNext = true;
      readonly b CanGoPrevious = true;
      readonly b CanPlay = true;
      readonly b CanPause = true;
      readonly b CanSeek = true;
      readonly b CanControl = true;
  };
};

gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.ListNames | grep -Poi "'org.mpris.Mediaplayer2\..+?'"

'org.mpris.MediaPlayer2.chromium.instance2'
'org.mpris.MediaPlayer2.spotify'

gdbus introspect --session --dest org.mpris.MediaPlayer2.chromium.instance2 --object-path /org/mpris/MediaPlayer2

node /org/mpris {
  node MediaPlayer2 {
  };
};

These commands were run when I was playing a video in freetube and the extension's blacklist was not working properly.

sakithb commented 5 months ago

That's very weird, I guess the empty node is Freetube.

sakithb commented 5 months ago

Are you able to control freetube properly through the extension?

aacater commented 5 months ago

Yes, the extension is able to control freetube properly.

Since freetube's node is empty, does that mean this is a freetube bug? Or maybe even gbus?

sakithb commented 4 months ago

I think this is a chromium bug. I've noticed this issue in some chrome versions. Not sure if it is fixed in the latest.

sakithb commented 2 months ago

@aacater Is this fixed now?

aacater commented 1 month ago

I think so. At least I haven't noticed it happening but I am also using freetube less.

Thanks!