jurialmunkey / plugin.video.themoviedb.helper

GNU General Public License v3.0
200 stars 94 forks source link

[BUG] Some lists have duplicate entries at the page border #1176

Closed roidy closed 6 months ago

roidy commented 6 months ago

Describe the bug

Highlight a TV Show / Movie in the add-on and bring up the context menu. Then select Browse lists and Recommended.

The resulting list of TV Shows / Movies has item 21 duplicated. This seems to be the page boundary, page 2 is including the last entry of page 1.

This happens in other list ie. Randomised->Based on Recently watched.

This is using 5.2.17~nexus.

Steps To Reproduce

  1. Open addon
  2. Choose a Movies or TV Shows
  3. Choose a category ie Popular
  4. Highlight a Movie or TV Show
  5. Open Context menu
  6. Select Browse lists
  7. Select Recommended

Now look at items 21 and 22 in the list.

Debug log

No response

Screenshots and Additional Info

No response

Checklist

jurialmunkey commented 6 months ago

Yeah I've noticed this occasionally. It's just the data returned from TMDb. Things like recommendations are calculated on TMDb server not locally in tge plugin, so it's just whatever is in the list returned from the api

I think what must happen is that the rank of the item changes inbetween when the first and second pages are cached so it ends up in both pages. I've noticed it happen even after refreshing cache so I think it must also be cached for a time server side - which would make sense since first page is used more frequently, so more likely to be precached whereas 2nd page might be freshly checked and items had moved inbetween.

roidy commented 6 months ago

It's just the data returned from TMDb. Things like recommendations are calculated on TMDb server not locally in tge plugin, so it's just whatever is in the list returned from the api

I'm not sure that's the case. If I looks at recommended for the movie Oppenheimer in the addon I get the movie John Wick Chapter 4 repeated in position 21 and 22 and Kodi says the list contains 41 items.

test

However if I do the same look using the api:- https://api.themoviedb.org/3/movie/872585/recommendations?api_key=xxxxx

Then I get back the correct 40 results with no duplicates: https://pastebin.com/GWydEXq9

jurialmunkey commented 6 months ago

Yeah but you're getting a single request for both pages there. If you grab the individual pages separately you will see that TMDb API is messing up and returning the same item on first and last of the page e.g.

https://api.themoviedb.org/3/movie/872585/recommendations?api_key=XXXXX&page=1 https://api.themoviedb.org/3/movie/872585/recommendations?api_key=XXXXX&page=2

These are the results from the API calls above for page 1 and page 2 -- you can see John Wick is repeated in last item on page 1 and first item on page 2: page 1 - https://paste.kodi.tv/gehasexizu page 2 - https://paste.kodi.tv/kojuvojapa

When the page multiplier is on in the plugin, it just grabs X number of pages and joins them together. If the TMDb API is repeating results across pages then they will also repeat in the plugin.

roidy commented 6 months ago

Yep, sorry you're right. I read the json wrong I thought that page of json contained all 40 results. Thanks for clearing that up.