Skip to content

Commit

Permalink
try to fix macos get property
Browse files Browse the repository at this point in the history
  • Loading branch information
BruceZhang1993 committed Feb 7, 2024
1 parent eaf0b3c commit a1fb454
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions aionowplaying/interface/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ def __init__(self, name: str):
for cmd, handler in self._cmds:
cmd.addTargetWithHandler_(create_handler(cmd, handler))

def get_playback_property(self, name: PlaybackPropertyName) -> Any:
if name == PlaybackPropertyName.Position:
return self._get_property(MPNowPlayingInfoPropertyElapsedPlaybackTime)
if name == PlaybackPropertyName.Rate:
return self._get_property(MPNowPlayingInfoPropertyDefaultPlaybackRate)

def set_playback_property(self, name: PlaybackPropertyName, value: Any):
if name == PlaybackPropertyName.Metadata:
value: PlaybackProperties.MetadataBean
Expand Down Expand Up @@ -96,3 +102,7 @@ def _update_property(self, name, value):
nowplaying_info = self._get_or_create_nowplaying_info()
nowplaying_info[name] = value
self.info_center.setNowPlayingInfo_(nowplaying_info)

def _get_property(self, name):
nowplaying_info = self._get_or_create_nowplaying_info()
return nowplaying_info[name]

0 comments on commit a1fb454

Please sign in to comment.