Tracking Music History
I have all my music downloaded on the computer and listen to them using a lightweight music player. This setup worked fine for a while but soon I felt a need for a way to track my music listening history. I wanted a simple tool to log all the music I listen to and view it through an interface that allows me to query using different parameters.
So I wrote a small daemon that watches for music files I open using
inotify API and logs the song title along with current date and time to a local SQLite database. To view my listening history, I wrote a web interface that can query the database through a bunch GET routes. For example, accessing the
/top/5 route will display my top five most listened tracks in a HTML table decorated with minimal CSS.
The daemon was built using the daemonize library as it gives nice declarative APIs to configure and spin up a daemon quickly. For the web interface, I used Rocket.rs as using attributes to match against paths and the built-in mechanism to pass database connection between various request handlers made the application simple and easy to understand.
To conclude, despite it being a small project, I learnt a lot and had fun working on it.