mirror of
https://github.com/shadoll/playing_now_2_mm.git
synced 2026-02-04 11:03:23 +00:00
Add random status generator
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from appscript import app # type: ignore
|
||||
from appscript import app # type: ignore
|
||||
|
||||
|
||||
class AppleMusic:
|
||||
def __init__(self):
|
||||
@@ -7,11 +8,14 @@ class AppleMusic:
|
||||
def get_current_track_info(self) -> tuple:
|
||||
try:
|
||||
current_track = self.music_app.current_track.get()
|
||||
current_position = self.music_app.player_position.get()
|
||||
track_duration = current_track.duration.get()
|
||||
return (
|
||||
current_track.name.get(),
|
||||
current_track.artist.get(),
|
||||
current_track.duration.get(),
|
||||
track_duration,
|
||||
current_position,
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Failed to get current track info: {e}")
|
||||
return None, None, None
|
||||
return None, None, None, None
|
||||
|
||||
Reference in New Issue
Block a user