MySQL library count not updating

Hi everyone,

Was a LibreELEC user until recently (after having some issues) and now happily being an OSMC user.
There is one problem I have, that also existed on LibreELEC, and that happened since version 17 on my Raspberry pi 2.
The problem is that my watch count doesn’t get updated on my MySQL library, every time I watch an episode the watch count stays for example 0/12.
The only things working are rebooting, scanning the library or manually deleting the files in the archive_cache folder.
I have been active on the Kodi forum with this issue and even made a ticket but with no success.
I’m just looking for someone that is having the same problem and maybe found some way around it.

Really hope in finding some kind of solution.
Thanks.

Logs

How experienced are you with MySQL?
Enabling query logging may give some clues, as you say it works until you add a certain number of episodes.

Not really but have been Googling a bit and I think I will be able to figure it out, will try to look into it tomorrow. This I guess is the way to go.

So what should I exactly do to get the right information in the logs?
Do I just have to access my library on Kodi? Or should I start with a fresh library and add again show by show? Or…?

Thanks in advance

To be honest while we try here to help you I guess you might also find better help on Kodi forum assuming that it seems Kodi related if two Distributions have the same result.

That I tried first a good month ago but we did not get further than “delete the files in your archive_cache folder”, I then made a ticket but until today I did not get any response to it. So I thought I give it a try here, even if it’s just some one with the same issue that found a workaround for it.

Here is the log: http://paste.osmc.io/pakavewira.vbs
The logs are from rebooting OSMC, accessing the library and a tv show, watch one episode and going back to the library.

I unfortunately don’t have mysql running on my OSMC box as I run Emby on a different server.

However, I took a quick look at the SQL log and around line 6198 there’s an interesting block of code:

		  381 Query	select idPath from path where strPath='smb://192.168.1.40/2TB/Media/Series/Adventure Time/Season 07/'
		  381 Query	select idFile from files where strFileName='Adventure Time - S07E08 - Vamps About (3).mp4' and idPath=15
		  381 Query	select playCount from files WHERE idFile=90
		  381 Query	select idPath from path where strPath='smb://192.168.1.40/2TB/Media/Series/Adventure Time/Season 07/'
		  381 Query	select idFile from files where strFileName='Adventure Time - S07E08 - Vamps About (3).mp4' and idPath=15
		  381 Query	update files set playCount=1,lastPlayed='2017-03-26 13:56:20' where idFile=90
		  381 Query	select idPath from path where strPath='smb://192.168.1.40/2TB/Media/Series/Adventure Time/Season 07/'
		  381 Query	select idFile from files where strFileName='Adventure Time - S07E08 - Vamps About (3).mp4' and idPath=15
		  381 Query	delete from bookmark where idFile=90 and type=1
		  381 Query	select idPath from path where strPath='smb://192.168.1.40/2TB/Media/Series/Adventure Time/Season 07/'
		  381 Query	select idFile from files where strFileName='Adventure Time - S07E08 - Vamps About (3).mp4' and idPath=15
		  381 Query	select * from settings where idFile=90

It looks like it’s setting files.playCount = 1 though I assume it’s not the first time you’ve viewed that particular episode of Adventure Time.

You might use the above code as a basis for exploring in the database to see, for example, if anything has a playCount > 1. It might be a bug in the Kodi code that’s not properly incrementing the value it’s originally received from the query:

select playCount from files WHERE idFile=90

Have a play around and see what you find.

Actually it was. And the play count in my MySQL database is always correct because when I open Kodi on an other device it shows all the correct numbers.
It’s the library on my Raspberry pi that doesn’t seem to update (and then only in my tv show library, movies are working fine too).
For example: when I watch one episode of a show than in my tv show library the play count should change from 0/13 to 1/13. But that doesn’t happen it just stays 0/13 and this only locale because in my MySQL database it’s updated to the right play count.

I hope I got it explained a bit clear because for some reason I find it an issue hard to explain.

I think you should bump your thread and trac ticket at Kodi. This really can’t be anything but an issue on their end of things…

You referred to “watch count”, so it wasn’t unreasonable to associate that with playCount in the code.

But yes, I agree with ActionA, it’s very likely to be a Kodi issue.

No, of course not. It’s very easily confusing.

You are right, this must be a Kodi issue. I’ll try grabbing there attention again and hopping in finding a solution.

Anyway, thanks everyone for there time. Really getting quick responses here.

Tried getting their attention so will see.

Because with switching back to a local library I started noticing that the issue also happens on a local library too (but less). I also noticed that it is very slow to navigate through my library since Kodi 17.

So I’m actually considering going back to 16.1 because that ran perfect for me, so now my question is: you guys have a page where I can download older OSMC/Kodi versions? Been Googling but with no luck.

Well seems google is not always the answer :slight_smile:
Download - OSMC disk images at the bottom

Ok, I did found those but I thought these where all Kodi 17 versions.
But with going through the blog I now figured it out I think :slight_smile:
If I’m correct I guess 2017.01-1 is the last Kodi 16.1 version.
Thanks for pointing me in the right direction.

Correct