Chavah, the no-nonsense, frictionless Messianic music player, has been overloaded with some very cool new features in the last week. The biggest of which is the new “thumb up/down” functionality:
Notice the “thumb up” and “thumb down” button beneath each song:
- Thumb up a song, and Chavah will play more of that kind of music.
- Thumb down a song, and Chavah will refrain from playing that song (or at least, won’t play it as much).
And of course, Chavah will remember your thumb ups forever – you can close it, open it later, and Chavah knows who you are, no sign-up/sign-in required.
(Here be technical dragons…)
The Chavah backend – the web service, the communication mechanism, the database – has all been scrapped and replaced with newer and better.
When I started Chavah, thinking it would be a tiny service mostly for myself, I just stored data in text files on the server. But Chavah has outgrown her crib, and it was high time to use a real database, especially in the face of new features like thumb up.
I moved all data out of text files and into a database. I used a self-contained, lightweight database called SQLite. After some initial issues getting the web service to be able to write to this database, things went smoothly. I did lose some data related to the number of tunes served, but it was negligible.
Object/relational mapping (ORM)
I don’t know about you, but I absolutely despise writing SQL code by hand. Nobody does that crap anymore. I had no idea what ORM options were available for SQLite. Seeing as how this is .NET software, I found the System.Data.SQLite provider for .NET. That was a start.
I stumbled on some old, abandoned ORMs for SQLite. They didn’t really work. It occurred to me that .NET 3’s new Entity Framework ORM tools might work. Sure enough, Entity Framework works just fine on SQLite databases.
EF spits out ORM code, and I’m a happy camper.
Originally developed as a .NET 2 ASP.NET web service, but was limited – I couldn’t pass back .NET objects from my web service to the Silverlight Chavah player. That sucked hugely. I created a new .NET 3 WCF web service, and voila, the magic started happening, I could pass back most anything I liked, and Silverlight picked it up no problem.
The “does this user like this song/genre” logic is still in its infancy. Give it a little time to get smart, and pardon the occasional play of a song you dislike.
Hope you all enjoy the brand-spankin’ new Chavah bits.