update readme

This commit is contained in:
Alessandro 2025-01-11 01:57:18 +01:00
parent f3645368ec
commit 08c6ed4457

View File

@ -14,7 +14,46 @@ This project uses the Spotify API to authenticate the user and pull live informa
- Easy Config: all the parameters needed by the app running can be set in =config.yaml=, including the API polling rate interval, the display refresh interval, Spotify's app credential and the color scheme. The colors of all the UI components are exposed and controllable in this configuration file. - Easy Config: all the parameters needed by the app running can be set in =config.yaml=, including the API polling rate interval, the display refresh interval, Spotify's app credential and the color scheme. The colors of all the UI components are exposed and controllable in this configuration file.
** Get Started: ** Get Started:
*** Hardware Requirements *** Hardware Requirements
This project is build for [[https://www.waveshare.com/wiki/2inch_LCD_Module][this]] specific screen, a 2" LCD SPi Display, compatible with different models of Raspberry Pi, this code is tested on a Pi 3b+ and a Pi 5.
*** Software Requirements *** Software Requirements
This project uses python3.11 and assumes you have it already installed.
For development poetry is used to create a virtualenv and handle dependencies, ultimately the code must be run as =sudo= so the dependencies must be installed on the root python interpreter anyways, so the poetry virtualenv is for developement only.
*** Install *** Install
To install, start by cloning this repo with
#+begin_src shell
git clone http://192.168.1.244:8080/barry/spotiplayer-pi.git
cd spotiplayer-pi
#+end_src
Then make sure you have poetry installed, to install on the Pi run: =curl -sSL https://install.python-poetry.org | python3 -=
#+begin_src shell
poetry env use python3.11
poetry install
poetry shell
#+end_src
to activate the virtualenv every time use =poetry shell=.
Now we need to install all the dependencies on the root python interpreter to run the script as the display GPiO connection needs privileges to be established.
To do that we do:
#+begin_src shell
sudo pip3 install requirements.txt
#+end_src
*** Run *** Run
To run the script there are two options, either from a CLI, with:
#+begin_src shell
sudo python -m spotiplayer_pi.main
#+end_src
or as a systemd service, which guarantees that the script will be restarted if it fails, to activate it do:
#+begin_src shell
# TODO
#+end_src
*** Develop
To contribute to the developement you will find some dev tools already implemented, to use them first install the extra dependencies with:
#+begin_src shell
poetry install --with dev
#+end_src
Now you have access to pre-commit with the following hooks:
- *ruff*: format and lint .py files
- *tests*: run all tests in =tests/=
- *requirements*: checks if the output of =poetry export= matches =requirements.txt=
Only if all checks pass it is possible to make a commit
** Code Philosophy / Style ** Code Philosophy / Style
# TODO