From d4f6ac62e2a84d3bec659b130cc35d4e6f266a27 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 10 Dec 2023 13:09:34 +0300 Subject: [PATCH 1/2] feat: add .cache creation --- app/spotify/service.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/spotify/service.py b/app/spotify/service.py index 40bf8d8..32cac33 100644 --- a/app/spotify/service.py +++ b/app/spotify/service.py @@ -93,3 +93,19 @@ def get_devices_count(self) -> int: def __get_devices_from_api(self) -> list[Device]: devices_json = self.__api.devices()["devices"] return [Device(**device) for device in devices_json] + + +if __name__ == "__main__": + import dotenv + from app.container import Container + + dotenv.load_dotenv() + container = Container() + + SpotifyService( + client_id=container.config.spotify.client_id(), + client_secret=container.config.spotify.client_secret(), + redirect_uri=container.config.spotify.redirect_uri() + ) + + print(".cache file created") From db243e1a7deb1fa090980c73a1ec0876ab2ae81a Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 10 Dec 2023 13:09:51 +0300 Subject: [PATCH 2/2] chore: add readme --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e554cc2..3393aaf 100644 --- a/README.md +++ b/README.md @@ -1 +1,20 @@ -# MusicBox +

Music Box API

+ +

project-image

+ + +## 🛠️ Installation + +1. Clone the repository `git clone https://github.com/MusicBoxRaspberryPi/MusicBoxAPI` +2. Rename `.env.dist` to `.env` +3. Edit `.env` to your needs +4. Install dependencies `pip install -r requirements.txt` +5. [Create Spotify App](https://developer.spotify.com/dashboard) with redirect URIs: `http://localhost:8080` +6. Copy **Client ID** and **Client Secret** from _Spotify App -> Settings -> View client secret_ to `.env` +7. Run `python -m app.spotify.service`, webpage should open in your browser and `.cache` file should be created + +## 🚀 Usage + +- With Docker: `docker compose up` + +- Without Docker: `python -m app.main`