Update music_app.py and readme.md with improvements

This commit is contained in:
sha
2024-04-05 15:37:35 +03:00
parent 90bd6c66ab
commit 7b04f96fcf
2 changed files with 6 additions and 3 deletions
+3 -2
View File
@@ -10,10 +10,11 @@ import os
load_dotenv()
SLEEP_TIME = 3
MUSIC_APP = (
os.getenv("MUSIC_APP", "apple_music").replace("_", " ").title().replace(" ", "")
)
print(f"Using 📀 {MUSIC_APP} connector")
def playing_now() -> tuple:
music = Music(connector=globals()[MUSIC_APP])
@@ -22,7 +23,7 @@ def playing_now() -> tuple:
def set_now_playing(name, artist, duration):
now = datetime.now().strftime("%H:%M:%S")
print(f"{now} 🎧 {name} - {artist} {duration}")
print(f"{now} 🎧 {name} - {artist} {duration}")
if name and artist and duration:
Mattermost().set_now_playing(name, artist, duration)