Skip to content

Commit

Permalink
Merge pull request #10 from waylyrics/fix-anp-microsec
Browse files Browse the repository at this point in the history
fix: Position and Duration are in microsecond
  • Loading branch information
BruceZhang1993 authored Jan 9, 2024
2 parents d845fe9 + ec655d9 commit 19f650c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aionowplaying/interface/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ def set_playback_property(self, name: PlaybackPropertyName, value: Any):
# HELP: Is there a better way to do this?
nowplaying_info = self._get_or_create_nowplaying_info()
nowplaying_info[MPNowPlayingInfoPropertyElapsedPlaybackTime] = \
self.get_playback_property(PlaybackPropertyName.Position) / 1000
self.get_playback_property(PlaybackPropertyName.Position) / 1000 / 1000
nowplaying_info[MPNowPlayingInfoPropertyPlaybackRate] = rate
self.info_center.setNowPlayingInfo_(nowplaying_info)
self.info_center.setPlaybackState_(PlaybackStatusStateMapping[value])
elif name == PlaybackPropertyName.Position:
self._update_property(MPNowPlayingInfoPropertyElapsedPlaybackTime, value/1000)
self._update_property(MPNowPlayingInfoPropertyElapsedPlaybackTime, value / 1000 / 1000)
elif name == PlaybackPropertyName.Rate:
self._update_property(MPNowPlayingInfoPropertyDefaultPlaybackRate, 1)
self._update_property(MPNowPlayingInfoPropertyPlaybackRate, value)
elif name == PlaybackPropertyName.Duration:
self._update_property(MPMediaItemPropertyPlaybackDuration, value/1000)
self._update_property(MPMediaItemPropertyPlaybackDuration, value / 1000 / 1000)
else:
# TODO: handle more properties changes
pass
Expand Down

0 comments on commit 19f650c

Please sign in to comment.