Radio Balises is a local radio that broadcasts in the Lorient area in France. The website of the radio offers a list of the last 10 songs, no more. There is no way to search for a song that was broadcast on a particular date, except for those last 10 songs. The goals for this toy project are: * parse the 'last 10 songs' page and store them in a database ; * offer a simple web interface to search songs played on a particular date, if they are stored in the database. Ideally, the 'last 10 songs' list should be regularly retrieved, so that the database is complete enough to be useful. Then, I may be able to find out what was that song that I heard 3 days ago while I was driving. # Requirements This project is written in Python and uses the following libraries: * requests: to retrieve the 'last 10 songs' page; * beautiful soup: to parse that page; * peewee: a simple ORM, to store and query the data in a SQL database; * bottle: a micro web framework. Those libraries are all packaged in Debian and can be installed with: ``` apt install python3-request python3-bs4 python3-peewee python3-bottle ``` It also needs a MySQL server (although switching to another database should be easy). # Installation We suppose the repository is cloned under `/opt/balises`. Create a `balises.py` config file, and fill in MySQL credentials. You can use `balises.ini.example as a starting point. To update the database every 15 minutes, the following line can be installed as a cronjob: ``` */15 * * * * /opt/balises/balises.py update ``` To launch the server automatically, you can install and use the systemd service file : ``` ln -s /opt/balises/balises.service /etc/systemd/system/balises.service systemctl enable balises.service systemctl start balises.service ``` The server listens to port 9980 on localhost by default, unless otherwise specified in the config file. Setting up a reverse proxy and ssl is left as an exercise to the reader.