From ec655d91e6c41133225ee55a3d9d88f03f36c7c3 Mon Sep 17 00:00:00 2001 From: poly000 <1348292515a@gmail.com> Date: Tue, 9 Jan 2024 15:49:38 +0800 Subject: [PATCH] fix: Position and Duration are in microsecond --- aionowplaying/interface/macos.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aionowplaying/interface/macos.py b/aionowplaying/interface/macos.py index 70c1034..469873a 100644 --- a/aionowplaying/interface/macos.py +++ b/aionowplaying/interface/macos.py @@ -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