Music: keep playcount up to date locally in-between library synchronizations

Use case: using a Kodi instance in a headless microserver, as a music server - controlled via Yatse and via web UI.
Huge collection, that is explored using Yatse’s “Discover” music view, Random music view, and simple album filters: “show only unplayed albums (i.e. ‘Hide Played’)” and “order albums by playcount”

Currently, Yatse is able to detect when new music was added to kodi and will start a background sync. With the sync, Yatse will update the ‘playcount’ for each album and song. This works fine, the challenge is: if there are no new additions to the library in a while, Yatse’s view of album playcounts drift away from reality and the Filters keep showing already-played albums, which needs very frequent manual re-syncs of the entire library in my case, and this takes a while for a large collection.

When Yatse is used to trigger Kodi’s playback of a song/album, Kodi will update the playcounts as appropriate in real time, but Yatse’s playcount counters stay stuck in the values pulled in the last synchronization.

The Web-UI of course doesn’t have this problem because it’s content is pulled straight from the Kodi instance, but it’s not as nice as Yatse to browse around, and it is much slower.

Proposal: as a mitigation to this problem for people that mostly trigger playback with Yatse, could Yatse update the Song and Album playcounts locally whenever a song finishes?
Say for example: when Yatse knows that remote playback of a song went above the 90% completion threshold and then in the next poll Yatse detects that the song changed, at that point Yatse could increase the playcount of the previously played song, in its local database.

This solution won’t be perfect as Yatse won’t know about songs played using other UIs however it will be much better than the current situation, and hopefully take very little effort.

This would be specially useful when using Yatse’s “Hide Played” quick filter, which would be great as it will produce results much closer to reality.

Of course, eventually upon the next library resync, all the playcounts in Yatse will get overwritten/updated with whatever values Kodi provides, as expected.


This is not really possible, there’s many many cases where Yatse is not aware at all of what will be really played. Since everything is handled at Kodi side Yatse does not keep a connection to know what happens when not on screen or screen is off.
When you play a genre or an artist or a playlist or a folder, Yatse is often paused before Kodi even have expanded the list. And media can be stopped before Yatse is switched on so Yatse have 0 history.

Kodi lacks the proper library feature to identify proper changes and with changing Ids prevent differential syncs.

You can workaround that mostly by using Yatse in cast most to cast from Kodi to Kodi, in that mode Yatse handle the playqueue and do keep record of the playcounts.
Usually streaming from Kodi to Kodi via UPnP works, but on some cases Kodi internals explodes when doing that, so it’s better to create a second host in Yatse and cast from Kodi to a real Kodi instance.

Frequent manual resyncing to keep playcounts updated is tedious, especially with a large music library, although “swipe down” has become a habit every time I touch Yatse. It is a huge shame that an automated solution can not be implemented. For me this is the one BIG WEAKNESS in Yatse, which otherwise has so many strengths.