Episode count wrong
#1
I have another thread open regarding watched shows not hiding but I think this may be the cause of that.

Running Kodi 15.2 on Windows 10 but this behavior occurs the same on 2 other boxes running Openelec. All content resides on a QNAP NAS using NFS to connect (same occurs for SMB)

Debug logs Here

Episode counts seem to be off. The debug log should include me adding a source and setting content as TV.
When I go into each TV show in the library it shows the correct count of episodes. For example, 2 broke girls has 5 episodes and American Horror Story has 10;
Image

Image

When you look in the list of all TV shows, you can clearly see that the counts are different.
Image

If I mark all episodes as watched, it will show the correct amount as watched but the unknown delta amount as unwatched.
Image
Image

Any help will be greatly appreciated!
Reply
#2
For what it's worth I tried 15.1 on Windows and this problem does not exist. I scanned the same folders in the same manner as with 15.2. 15.1 displays the correct episode count and hides the show when there are no unwatched episodes.

I hope this gets sorted out soon...
Reply
#3
I am bumping this issue, as I have the same problem. Can I ask, are you using a shared db? Mine are set-up to use Mysql, and I upgraded from 14 recently.
Reply
#4
I am currently thinking that tvshowcounts view in MyVideos93 is not right. if I change

Code:
nullif(count(`episode`.`c12`),0) AS `totalCount`

to

Code:
ifnull(count(`episode`.`c12`),0) AS `totalCount`

Things appear to line up. I will test it in a moment.
Reply
#5
I am using MySql but the weird thing is it does the same thing with a local DB as well in 15.2. I did a fresh install of 15.1 and imported the same media without the issue showing up. As soon as I switched to MySql, the problem appears again. I'm looking forward to seeing your test results from the SQl counts query you posted below.

(2015-12-29, 17:15)mrforsythexeter Wrote: I am bumping this issue, as I have the same problem. Can I ask, are you using a shared db? Mine are set-up to use Mysql, and I upgraded from 14 recently.
Reply
#6
So This worked.

I changed the view in the DB from

Code:
select `tvshow`.`idShow` AS `idShow`,max(`files`.`lastPlayed`) AS `lastPlayed`,nullif(count(`episode`.`c12`),0) AS `totalCount`,count(`files`.`playCount`) AS `watchedcount`,nullif(count(distinct `episode`.`c12`),0) AS `totalSeasons`,max(`files`.`dateAdded`) AS `dateAdded` from ((`tvshow` left join `episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`

to

Code:
select `tvshow`.`idShow` AS `idShow`,max(`files`.`lastPlayed`) AS `lastPlayed`,ifnull(count(`episode`.`c12`),0) AS `totalCount`,count(`files`.`playCount`) AS `watchedcount`,ifnull(count(distinct `episode`.`c12`),0) AS `totalSeasons`,max(`files`.`dateAdded`) AS `dateAdded` from ((`tvshow` left join `episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`

My guess is that there is a bigger problem somewhere in the DB, however I couldn't see it when messing with the query above, every thing checked out. So I modified it, and updated the library (allowed it to search for new content) and everything was right with the world again.

Hope this helps.
Reply
#7
Good news but can you provide a bit more info? Is this the tvshowcounts view? Right now the SQL for it is "SELECT * FROM `tvshowcounts` ORDER BY `totalCount` ASC ". Where is the code you posted above? Sorry if this is a noob question...
Reply
#8
Okay, I figured it out, thank you! This solved the issue for me as well. I appreciate the help!
Reply
#9
is it so that you guys happens to use mariadb 10.1.x?
I have reported that issue a while ago, hopefully it will end up in 10.1.11
https://mariadb.atlassian.net/projects/M...openissues
Reply
#10
In my case this was happening with MySQL.
Reply
#11
Yes I am using MariaDB 10.1.10. I was going to chuck my toys out of the pram about this, then bobrico said the issue was in MySQL as well.

Having switched to MariaDB recently you don't expect issues like this. Might have to switch back to MySQL as I had another issue with one of the hashing functions.

Cheers for reporting the issue, maybe this needs to be tested a bit in MySQL and reported to them as well.
Reply
#12
I kind of doubt that. What mysql version are you using bobrico!
Reply
#13
Hrm. I'm having this issue come up and I'm using MySQL.

Not certain how to make the fixes noted above - not all that SQL savvy unfortunately. Interesting issue it it only seems to happen on the show count - season counts are fine.

Anyone filed a bug report in Trac yet?
Reply
#14
Necromancyr, if you managed to get it setup with MySQL you are more technical than most. Download yourself a copy of heidi sql and connect to the database using the same details you used in your advancedsettings.xml. Then find the view called "tvshowcounts" and change the nullif(s) to ifnull.

Hope this helps.
Reply
#15
if you guys are using mysql and get this bug it means mysql also has the same bug mariadb has, in that case it needs to be reported.. can you tell me what version of mysql you have?
I'l like to try it myself.
Reply

Logout Mark Read Team Forum Stats Members Help
Episode count wrong2