Add random status generator

This commit is contained in:
sHa
2024-04-07 01:05:53 +03:00
parent 051b1b4e40
commit 13475a7db4
9 changed files with 157 additions and 55 deletions

View File

@@ -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