I don’t listen much to radio in general but there is one that I love above all called Fip. It’s a French radio that broadcast music 24⁄7 and gives the opportunity to listen to other things than mainstream music and has crush for Jazz. Several years ago, I wrote a small program in Bash that was parsin the HTML code to extract the current music information and store it in a text file. Today, Fip broadcast this data over a JSON file…
Because I often listen to music I which to keep track of, I needed at that time a script to get the data rather than copying data by hand. At that time I didn’t know Python but I was scripting a bit using Bash. Here, you can take a look on the result at that time:
It was made of small pieces using Curl to download the page and Sed to extract the data from HTML page. That was a lot of fun to write and very useful at time as I saved about 100 titles this way.
Recently Fip redesigned both the front-end and back-end of their website and use now a JSON file to display the data. This is much easier this way to extract the information and moreover, it’s now possible to have information on past and future songs (which was impossible before or really tricky). So I decided to give a shot and rewrite this script in Python. At the moment, nothing much but it’s possible from the CLI to get the information of the current song being played and the next.
Some work that will be done later will be to store the data either in a plain file or a database. The idea would be to write a small python backend with an API that would communicate with the client. A small front-end to display the stored songs in a nice fashion. The code is stored on Github, the documentation is available on ReadTheDoc and for those who just want to use it in its current stage, it’s even possible to install it as a Python package using the command:
$ pip install fip