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` 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")