Welcome to my second devlog regarding listhist!
Since the last entry, I’ve rewritten the shared client code to take advantage of the Rust type system much more. I’ve written quite a bit of Haskell in the past few weeks and I love the strong type system of the language; however, monadic I/O and especially the mixture of pure and impure exceptions makes my head hurt, which is why I decided to instead write this project mostly in Go and Rust. Either way, this means that without logging in, you can’t query endpoints which require an access token; so, for example, in order to create an album in the system, you have to do something like this:
let client = listhist_client::Client::new("your_base_url");
Now, client is of type Client<Unauthorized>. You can then call Client::login:
let client = client.login("username", "password").await?;
Now client is of type Client<Authorized> and you can actually create an album!
let album = client.create_album(...).await?;
Oh yeah, the client is now also asynchronous and therefore much more flexible… but that’s not as exciting.
The other exciting thing that I managed to add to the repo is a Containerfile and a Compose file, so spinning up an instance, whether for testing or “for real” is super easy. So in this regard, I think I’ve achieved what I wrote about in the last entry.
Now, the next step is polishing the existing code, resolving the TODO/FIXME items I have left for myself, adding some tests, etc. It’s boring work, but I believe that if I do it sooner than later, it will come back around and I can catch some of the more annoying bugs early on.
And then I want to make a web interface for easy viewing of the data. The CLI should be the main way to enter listening history entries into the system, automatically of course (probably through MPRIS, custom player hooks and some Windows-specific mechanism), but viewing of the data should be possible from any device, without having to install the CLI. So, the web interface will be a relatively simple, fully client-sided web application, probably written with something like Preact.
I have a lot of things planned for listhist, maybe even a friends system, which would be very exciting to have! Stay tuned for upcoming updates.