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

Mpris2 interfaces don't implement introspection for properties #839

Closed
FichteFoll opened this issue Jun 4, 2018 · 3 comments
Closed

Mpris2 interfaces don't implement introspection for properties #839

FichteFoll opened this issue Jun 4, 2018 · 3 comments
Labels

Comments

@FichteFoll
Copy link

It looks like the mpris2 module doesn't implement any properties. Via FichteFoll/discordrp-mpris#4, I was made aware that the PlaybackStatus property isn't implemented and a quick glance at the source seems to indicate that in fact no property is exposed at all. I'm not familiar with the Python dbus package, but a quick glance with QDBusViewer seems to confirm this.
(Assuming dbus provides the org.freedesktop.DBus.Introspectable automatically.)

2018-06-04_12-54-49

@hrnr
Copy link
Member

hrnr commented Jun 4, 2018

The properties are implemented, but they are not introspectable due to limitations of dbus-python we use to implement dbus interface. Even signals for properties should work as expected.

In your screenshot you see that there is org.freedesktop.DBus.Properties under /org/mpris/MediaPlayer2. That is a standard property interface. Eg.

GetAll("org.mpris.MediaPlayer2")

{'CanQuit': False,
 'CanRaise': False,
 'CanSetFullscreen': False,
 'DesktopEntry': 'mps-youtube',
 'Fullscreen': False,
 'HasTrackList': False,
 'Identity': 'mps-youtube',
 'SupportedMimeTypes': [],
 'SupportedUriSchemes': []}

GetAll("org.mpris.MediaPlayer2.Player")

{'CanControl': True,
 'CanGoNext': True,
 'CanGoPrevious': True,
 'CanPause': True,
 'CanPlay': True,
 'CanSeek': True,
 'MaximumRate': 1.0,
 'Metadata': {'mpris:artUrl': 'https://i.ytimg.com/vi/S3fTw_D3l10/default.jpg',
              'mpris:length': 307000000,
              'mpris:trackid': '/CurrentPlaylist/ytid/S3fTwD3l10',
              'xesam:album': '',
              'xesam:artist': [''],
              'xesam:title': 'Alt-J (∆) - Taro'},
 'MinimumRate': 1.0,
 'PlaybackStatus': 'Playing',
 'Position': 2987500,
 'Rate': 1.0,
 'Volume': 1.0}

For implementation see https://github.com/mps-youtube/mps-youtube/blob/0100a38d3874c53e705d9acd7e30fbc6a3099da0/mps_youtube/mpris.py#L462

@FichteFoll
Copy link
Author

FichteFoll commented Jun 4, 2018

Ah right, I forgot that this is fundamentally how you access properties. For obious reasons, QDBusViewer uses introspection to show a bus's path's interfaces and the methods and properties they define, so it's understandable why I my method to "check" for them fell into the same trap as the library I use to access the properties in my tool (dbussy). Calling GetAll does indeed return the proper properties.

Judging from your reply I take that this is more of a problem of dbus-python because it doesn't provide an easy/proper way to declare introspectable properties?

@hrnr
Copy link
Member

hrnr commented Jun 5, 2018

yes, dbus-python does not support properties first class as far as I know. However the only thing that is missing are the introspection data, which should not be required.

I'm not sure it is possible to add introspection data for properties in the current implementation, because dbus-python already generates introspection for methods and offers Introspectable interface on our bus.

@hrnr hrnr changed the title Mpris2 interfaces don't implement properties Mpris2 interfaces don't implement introspection for properties Jun 12, 2018
@hrnr hrnr closed this as completed Jun 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants