very nice. ๐
one problem though:
if a song is NOT played since the last update, it is inserted into the log-db with the same time. This wont give an error since the song ID isnt a primary key. (ouch).
both fields should be primary keys. Also, you maybe dont want to use the ID of firefly since that can change with DB versions and more or less songs in the library. Depending on how ‘static’ youd library is however, this might not be a problem.
To insert, you have to use a cursor and check the latest playtime, and if its different, insert the new entry.
otherwise you’d get lots and lots of bogus data from songs that were not played.
I donno if sqlite is capable of triggers and ‘smart’ indices, but triggering would be a lot more sophisticated & elegant. ๐