From 7b04f96fcfa6d38ac15e5cb81ef388e77a0eee09 Mon Sep 17 00:00:00 2001 From: sHa Date: Fri, 5 Apr 2024 15:37:35 +0300 Subject: [PATCH] Update music_app.py and readme.md with improvements --- music_app.py | 5 +++-- readme.md | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/music_app.py b/music_app.py index 6c3693d..24bded1 100644 --- a/music_app.py +++ b/music_app.py @@ -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) diff --git a/readme.md b/readme.md index 7f722d5..92091e2 100644 --- a/readme.md +++ b/readme.md @@ -14,7 +14,9 @@ This is a Python application that fetches the currently playing track from eithe - Mattermost ## Environment Variables -`MUSIC_APP`: This variable determines which music service the application will fetch the currently playing track from. It can be either `apple_music` or `spotify`. +`MUSIC_APP` - This variable determines which music service the application will fetch the currently playing track from. It can be either `apple_music` or `spotify`. +`MATTERMOST_SERVER_URL` variable represents the URL of the Mattermost server. +`MATTERMOST_ACCESS_TOKEN` the access token for the Mattermost API, which is obtained by generating a personal access token from the Mattermost user settings and is used to authenticate and authorize API requests to the Mattermost server. ## How to Run 1. Clone the repository