adwylie / deadbeef-playcount

A play count plugin for the DeaDBeeF music player.
BSD 3-Clause "New" or "Revised" License
7 stars 0 forks source link

[Feature request] Possible internals improvement #2

Open LisandraBrave opened 4 years ago

LisandraBrave commented 4 years ago

Instead of writing out play counts to the PCNT frame, write playcounts to an external database. Benefits include not modifying the files themselves, just a simple database file (could even be as simple as filepath playcount, although that could run into the known issues with unix filenames being too permissive), not relying on media files having a specific kind of metadata storage (FLAC is probably the most notable example), and being able to track playcounts on read only files.

Rough skeleton would be something like

On play, search database for track filepath, if not found add it If song is skipped before search is finished, ignore searching or adding if found/added, add playcount to playlist meta (if it doesn't exist) on event 1000, read in ddb_event_trackchange_t *from for previous song, get filepath, and, if playtime from ddb_event_trackchange_t is over some amount of time (could be configurable!), increment playcount in database and in playlist, then reload previous song metadata

I'd write a PR for it myself if I knew a lick of C, but I don't.