TeamB 2356 Posted October 12, 2021 Share Posted October 12, 2021 I have a TV Series I watched a few years ago and decided to watch it again so I marked the first season as un-watched and then watched the few episodes but now the next episode is not showing up in the Continue Watching. Is this a bug or is it working as expected? Link to comment Share on other sites More sharing options...
GrimReaper 3330 Posted October 12, 2021 Share Posted October 12, 2021 Hm, I just checked it on one of my own "played" series, can't recreate, after making only Season 1 "unplayed" the Series gets "unplayed" as well, and after few played S01 episodes they show in Continue Watching row as they should after each one. Is your Series "unplayed"? Link to comment Share on other sites More sharing options...
TeamB 2356 Posted October 12, 2021 Author Share Posted October 12, 2021 no the series is not marked as played. I am reasonably sure this has worked for me in the past but for some reason this show is acting weird. Link to comment Share on other sites More sharing options...
GrimReaper 3330 Posted October 12, 2021 Share Posted October 12, 2021 You can try going other way 'round, mark Series Played-Unplayed and then make all other Seasons Played except S01, see what gives? Link to comment Share on other sites More sharing options...
Luke 37251 Posted October 12, 2021 Share Posted October 12, 2021 In user home screen options did you by any chance exclude the library from continue watching? Link to comment Share on other sites More sharing options...
TeamB 2356 Posted October 12, 2021 Author Share Posted October 12, 2021 26 minutes ago, Luke said: In user home screen options did you by any chance exclude the library from continue watching? No, all the other shows in that lib are working fine. It gets a little weirder also. If i mark all episodes as unwatched and then mark the first few episodes from season one as watched the next up then lists episode 16 from season four as the next one. Link to comment Share on other sites More sharing options...
ebr 14959 Posted October 12, 2021 Share Posted October 12, 2021 1 hour ago, TeamB said: It gets a little weirder also. If i mark all episodes as unwatched and then mark the first few episodes from season one as watched the next up then lists episode 16 from season four as the next one. 1) Make sure all the episodes have proper season and episode numbers 2) Any chance you last watched S4E15 - even very briefly? Link to comment Share on other sites More sharing options...
TeamB 2356 Posted October 12, 2021 Author Share Posted October 12, 2021 6 hours ago, ebr said: 1) Make sure all the episodes have proper season and episode numbers 2) Any chance you last watched S4E15 - even very briefly? All episodes have season and episode numbers. The last episode i played was season one epp seven, i just watched it now. Link to comment Share on other sites More sharing options...
TeamB 2356 Posted October 12, 2021 Author Share Posted October 12, 2021 (edited) ok so I "fixed" it. I tried a bunch of stuff, re-scanning metadata etc, nothing fixed the play next being wrong. I suspected that it was a last played date issue on the episodes, something weird like a null date in the episodes that were showing up as next up when they should not be. I do not have time to dig deeper so I went for the nuclear option.I dropped a .ignore file in the TV Shows dir to remove it from the lib, did a rescan, verified the TV Show was removed, deleted the .ignore file and did another rescan, this effectively re-adds the Tv Show resetting most of its data. The correct next up is now showing for the Tv Show. I wish I had more time to dig into exactly what was causing it but time is short atm. Edited October 12, 2021 by TeamB Link to comment Share on other sites More sharing options...
Luke 37251 Posted October 13, 2021 Share Posted October 13, 2021 Ok thanks for the update. Link to comment Share on other sites More sharing options...
TeamB 2356 Posted June 13, 2022 Author Share Posted June 13, 2022 @Luke this is happening again with a different tv show now. I have had this show in my library for a few years and just got around to watching it now, After I watched the first episode of the first season the continue watching jumped to season 03 episode 01 instead of season 01 episode 02. To fix this last time I removed the TV Show by ignoring the Show folder, scanning and then adding it back in and re scanning again. I dont want to have to do this every time I come across this. So where can I start to investigate this, where in the Library DB file are the fields worth looking at, what would have the continue watching skip a bunch of unwatched episodes. Link to comment Share on other sites More sharing options...
TeamB 2356 Posted June 13, 2022 Author Share Posted June 13, 2022 in the current release 4.7 how do I join the MediaItems table to the userdata table? Link to comment Share on other sites More sharing options...
TeamB 2356 Posted June 13, 2022 Author Share Posted June 13, 2022 Based on this query select path, UserDatas.played, UserDatas.playCount, UserDatas.playbackPositionTicks from MediaItems join UserDatas on UserDatas.UserDataKeyId = MediaItems.UserDataKeyId where path like '%mayans%' and userId = 3 order by path asc It looks like it has something to do with playCount It looks like it is using playCount instead of played to work out what the next item is somehow. J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E01.mp4 1 3 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E02.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E03.mp4 1 2 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E04.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E05.mp4 1 2 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E06.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E07.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E08.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E09.mp4 1 3 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E10.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 02\Mayans M.C. - S02E01.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 02\Mayans M.C. - S02E02.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 03\Mayans M.C. - S03E01.mp4 0 1 0 You can see s03 e01 is not played but has a play count, I must have played it to test at some point and then set it to unplayed but now the next up is selecting this as the next up for some reason. So I set the playCount to 0 but that did not help. I then deleted that entry from UserDatas and that also did not help. Perhaps the tables I am looking at are not the correct ones. But it does look like they have something to do with it as the above lines up with what Continue Watching is showing me, based on that data the next unplayed item is s03 e01 Link to comment Share on other sites More sharing options...
Happy2Play 8356 Posted June 13, 2022 Share Posted June 13, 2022 I believe UserDatas.LastPlayedDateInt is the key here. Test the order marked as watched. Marked three then one makes two next up, but marking one then three makes 4 next up. Link to comment Share on other sites More sharing options...
TeamB 2356 Posted June 13, 2022 Author Share Posted June 13, 2022 1 hour ago, Happy2Play said: I believe UserDatas.LastPlayedDateInt is the key here. Test the order marked as watched. Marked three then one makes two next up, but marking one then three makes 4 next up. I guess that makes sense but I have completely removed the entry in UserDatas for that item and it is still showing up as the next up. Perhaps UserDatas is not even the correct table to be looking at, I am just guessing here. Link to comment Share on other sites More sharing options...
Luke 37251 Posted June 13, 2022 Share Posted June 13, 2022 1 hour ago, TeamB said: Based on this query select path, UserDatas.played, UserDatas.playCount, UserDatas.playbackPositionTicks from MediaItems join UserDatas on UserDatas.UserDataKeyId = MediaItems.UserDataKeyId where path like '%mayans%' and userId = 3 order by path asc It looks like it has something to do with playCount It looks like it is using playCount instead of played to work out what the next item is somehow. J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E01.mp4 1 3 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E02.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E03.mp4 1 2 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E04.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E05.mp4 1 2 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E06.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E07.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E08.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E09.mp4 1 3 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E10.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 02\Mayans M.C. - S02E01.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 02\Mayans M.C. - S02E02.mp4 1 1 0 J:\Media\TV\Mayans M.C\Season 03\Mayans M.C. - S03E01.mp4 0 1 0 You can see s03 e01 is not played but has a play count, I must have played it to test at some point and then set it to unplayed but now the next up is selecting this as the next up for some reason. So I set the playCount to 0 but that did not help. I then deleted that entry from UserDatas and that also did not help. Perhaps the tables I am looking at are not the correct ones. But it does look like they have something to do with it as the above lines up with what Continue Watching is showing me, based on that data the next unplayed item is s03 e01 That's how we do it, except we put the userId in the join: join UserDatas UserDatas_N on N.UserDataKeyId=UserDatas_N.UserDataKeyId And UserDatas_N.UserId=@UserId Note that depending on what you're intending to get back, you may sometimes need a left join. Link to comment Share on other sites More sharing options...
Luke 37251 Posted June 13, 2022 Share Posted June 13, 2022 5 minutes ago, TeamB said: Perhaps UserDatas is not even the correct table to be looking at, I am just guessing here. Yes it is. Link to comment Share on other sites More sharing options...
Luke 37251 Posted June 13, 2022 Share Posted June 13, 2022 Also PlayCount is not a factor with continue watching or next up. Link to comment Share on other sites More sharing options...
TeamB 2356 Posted June 13, 2022 Author Share Posted June 13, 2022 10 minutes ago, Luke said: Also PlayCount is not a factor with continue watching or next up. ok thanks for confirming the query. So what is a factor? Is it lastplayedint like happy2play said? I tired removing the entry from UserDatas completely for the s3 e1 bit it made no difference. Just did a delete from userdatas where blah blah etc while Emby was shut down, saved the changes and restarted emby but it did not look like it had any effect. Link to comment Share on other sites More sharing options...
Luke 37251 Posted June 13, 2022 Share Posted June 13, 2022 Quote I have had this show in my library for a few years and just got around to watching it now, After I watched the first episode of the first season the continue watching jumped to season 03 episode 01 instead of season 01 episode 02. So looking at this, rather than focusing on season 3 episode 1, look at the user data values for what comes before it. also instead of sorting by path, sort the episodes by SortParentIndexNumber,IndexNumber Link to comment Share on other sites More sharing options...
TeamB 2356 Posted June 13, 2022 Author Share Posted June 13, 2022 2 hours ago, Luke said: So looking at this, rather than focusing on season 3 episode 1, look at the user data values for what comes before it. also instead of sorting by path, sort the episodes by SortParentIndexNumber,IndexNumber What is SortParentIndexNumber, it looks like it is all 0 for both season 1 and season 2 and from what I can see null for season 3. But that is the weird thing, since I have now removed the s3e1 entry in the UserDatas table there is no record there for it, the only entries I have are for the episodes I have actually watched with is what I would expect since the other episodes would not have been touched yet by my user ID. I expected this to fix the issue but the Web Client is still showing S3E1 as the next play item. So this query select mi.path, mi.SortParentIndexNumber as spi, mi.IndexNumber as idxn, ud.* from MediaItems as mi join UserDatas as ud on mi.UserDataKeyId = ud.UserDataKeyId And ud.UserId = 3 where path like '%mayans%' order by spi, idxn asc produces the following, as you can see there is no s3e1 entry in all there now. Path spi idxn key userId rating played playCount isFavorite playbackPositionTicks lastPlayedDate AudioStreamIndex SubtitleStreamIndex LastPlayedDateInt UserDataKeyId RatingLastModified PlaystateLastModified HideFromResume J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E01.mp4 0 1 b085134cef114116bd7b36c00906fbd3 3 1 3 0 0 1654775562 66173 1654689684 1654777727 0 J:\Media\TV\Mayans M.C\Season 02\Mayans M.C. - S02E01.mp4 0 1 d591fc6ed30b43298811cc04a4463903 3 1 1 0 0 1655033777 66201 1655033777 1655037208 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E02.mp4 0 2 8f82ed0cb1bd4da98b39ce48828900ce 3 1 1 0 0 1654856826 66180 1654856826 1654860257 0 J:\Media\TV\Mayans M.C\Season 02\Mayans M.C. - S02E02.mp4 0 2 57abbf86d6fe434291e44ba51732e4f0 3 1 1 0 0 1655037216 66203 1655037216 1655039852 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E03.mp4 0 3 3489d47fc60246779b1543652a4a3de6 3 1 2 0 0 1654862581 66182 1654860262 1654864025 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E04.mp4 0 4 5d0240fb01134527a0f0ec52c2fff78a 3 1 1 0 0 1654864033 66185 1654864033 1654867110 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E05.mp4 0 5 00b91cac115d44d5b4bf66fa1b0f8de2 3 1 2 0 0 1654938574 66188 1654867117 1654941831 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E06.mp4 0 6 419ea16ce0f34cceb9518c98ec8d23dd 3 1 1 0 0 1654941838 66190 1654941838 1654944438 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E07.mp4 0 7 bcc6c41501c847a29f236e3cc1c03bfc 3 1 1 0 0 1654944444 66192 1654944444 1654947998 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E08.mp4 0 8 1f4d3b8613da48378aca5d5f8c7a7cf5 3 1 1 0 0 1654948030 66194 1654948030 1654951890 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E09.mp4 0 9 490f3be9efa448edb4101b58f522272e 3 1 3 0 0 1655029109 66196 1654951924 1655030647 0 J:\Media\TV\Mayans M.C\Season 01\Mayans M.C. - S01E10.mp4 0 10 412cdffb8c474e69baba76674781cb29 3 1 1 0 0 1655030681 66199 1655030681 1655033739 0 Link to comment Share on other sites More sharing options...
TeamB 2356 Posted June 13, 2022 Author Share Posted June 13, 2022 Should the SortParentIndexNumber or the SortIndexNumber be null for items? select id, path, SortParentIndexNumber, SortIndexNumber, ParentIndexNumber, IndexNumber from MediaItems where id = 96502 Id Path SortParentIndexNumber SortIndexNumber ParentIndexNumber IndexNumber 96502 J:\Media\TV\Mayans M.C\Season 03\Mayans M.C. - S03E01.mp4 3 1 could that have something to do with it? Link to comment Share on other sites More sharing options...
TeamB 2356 Posted June 13, 2022 Author Share Posted June 13, 2022 ok yeah it has something to do with the SortParentIndexNumber, this is a snapshot of before I updated Id Path SortParentIndexNumber SortIndexNumber 50090 Mayans M.C. - S01E01.mp4 0 10000 50109 Mayans M.C. - S01E02.mp4 0 10000 50110 Mayans M.C. - S01E03.mp4 0 10000 50111 Mayans M.C. - S01E04.mp4 0 10000 50113 Mayans M.C. - S01E05.mp4 0 10000 50115 Mayans M.C. - S01E06.mp4 0 10000 50116 Mayans M.C. - S01E07.mp4 0 10000 50117 Mayans M.C. - S01E08.mp4 0 10000 50118 Mayans M.C. - S01E09.mp4 0 10000 50119 Mayans M.C. - S01E10.mp4 0 10000 50122 Mayans M.C. - S02E01.mp4 0 10000 50126 Mayans M.C. - S02E02.mp4 0 10000 50127 Mayans M.C. - S02E03.mp4 0 10000 50128 Mayans M.C. - S02E04.mp4 0 10000 50210 Mayans M.C. - S02E05.mp4 0 10000 50557 Mayans M.C. - S02E06.mkv 0 10000 51022 Mayans M.C. - S02E07.mkv 0 10000 51422 Mayans M.C. - S02E08.mkv 0 10000 51797 Mayans M.C. - S02E09.mkv 0 10000 52097 Mayans M.C. - S02E10.mkv 0 10000 96502 Mayans M.C. - S03E01.mp4 96503 Mayans M.C. - S03E02.mp4 96758 Mayans M.C. - S03E03.mp4 97598 Mayans M.C. - S03E04.mp4 99118 Mayans M.C. - S03E05.mp4 100268 Mayans M.C. - S03E06.mp4 101027 Mayans M.C. - S03E07.mkv 101794 Mayans M.C. - S03E08.mkv 102338 Mayans M.C. - S03E09.mp4 102562 Mayans M.C. - S03E10.mkv 131909 Mayans M.C. - S04E01.mkv 131992 Mayans M.C. - S04E02.mkv 131991 Mayans M.C. - S04E03.mp4 132090 Mayans M.C. - S04E04.mkv 132435 Mayans M.C. - S04E05.mkv 134567 Mayans M.C. - S04E06.mkv 138046 Mayans M.C. - S04E07.mkv 143251 Mayans M.C. - S04E08.mp4 145575 Mayans M.C. - S04E09.mkv It has a bunch of nulls in some and the last item that has a value is the one before the one that is showing up as next up So I run the following update MediaItems set SortParentIndexNumber = null, SortIndexNumber = null where path like '%mayans%' and type = 8 to set all the values to null and now the correct next up item is showing. Link to comment Share on other sites More sharing options...
TeamB 2356 Posted June 13, 2022 Author Share Posted June 13, 2022 (edited) @Luke it looks like at some point SortParentIndexNumber stopped being filled in, running the following query select SeriesId, SeriesName, SortParentIndexNumber, count(1) as c from MediaItems where type = 8 group by SeriesId, SeriesName, SortParentIndexNumber order by SeriesId, SeriesName, SortParentIndexNumber shows a mixtures of shows with mostly a mixtures 0 and null. looking at the mix it looks like it stopped filling in the SortParentIndexNumber with the a recent Emby update 4.6 or so. Edited June 13, 2022 by TeamB 1 Link to comment Share on other sites More sharing options...
Luke 37251 Posted June 13, 2022 Share Posted June 13, 2022 Actually it's a newer thing that was added in 4.6, and I think the issue is more likely that older episodes prior to the advent of it never got those values filled in. Something must have went wrong with the db upgrade for those values. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now