-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix themoviedb rating matching #1927
Conversation
Rating Type was looking for tmdb in plex audienceRatingImage when it should have been matching themoviedb.
This is potentially not right either. Kodi developers are still debating whether the tag should be tmdb or themoviedb in Kodi. There have been plenty of instances of both in the past so probably won't matter which it is. Would be nice to have a defined solution though. I'll fix later when I get some time along with the ratings duplication bug, for now ignore this pull request. |
Fix rating type to match themoviedb correctly as well as critics. Also remove trakt and metacritic as these are not checked against plex and plex has no mechanism to make these tags.
Ok this one's done and verified working correctly for me now. |
Ratings were appending rows to the kodi rating table instead of replacing them. Removed the add rating function and consolidated code to update_ratings function. Function now deletes rows first with matching media_id, media_type and rating type before inserting new data. Also streamlined calls to the function.
Croneter, sorry tried to raise a separate pull request but the rating append changes want to merge into this pull request. |
Thanks so much again, @JCalvi! I split your 3 commits. The first two concerning the rating matching (#1930) will be merged shorty. I'm not so sure about the last one, JCalvi@77d0eb4. There's an additional SQL delete statement that will be executed even on the very first library sync. That seems overkill and will potentially increase sync time. I will look into it. |
@croneter, Yes I considered this but often when working with databases, doing a check if you need to delete first in python is no faster than the sql database will take to work out it does not need to delete if there is nothing there. I profiled my database doing a full repair with the delete, 742 Movies, 147 shows, 6862 Episodes and 4992 Songs Without the delete: Two runs for each which shows any differences are just random variation, so no penalty for the delete call. The other advantage of the delete call is that it will clear the rating table that has been previously affected by this bug. |
@croneter
The only disadvantage of the delete version is that the rating_id keeps incrementing up every time the repair is run or a sync is done. But if you still want an option that does not keep incrementing the primary key the above code only replaces items assuming they are unique based on the media_id, media_type and rating_type otherwise inserts a new one. So in summary I think the delete version is better even though the rating table ends up looking a bit messier internally afterwards as it is faster and more robust. |
I already implemented the delete version for the update rating function only, see #1933. Has been rolled out with yesterdays update |
Thanks so much for your thoughts though! 😄 |
Rating Type was looking for tmdb in plex audienceRatingImage when it should have been matching themoviedb.