xbmc / metadata.tvshows.themoviedb.org.python

themoviedb.org TV Show scraper in Python for Kodi 18 (Leia) or later.
GNU General Public License v3.0
19 stars 26 forks source link

uniqueID is not provided on seasons and incorrect on episodes #119

Open ReenigneArcher opened 7 months ago

ReenigneArcher commented 7 months ago

I am developing an addon that uses xbmc.getInfoLabel(f'ListItem.UniqueID(tmdb)') to get the tmdb of the selected item.

For TV Shows using this scraper, the tmdb is available at the top level show level, but...

For example on the episode list of The IT Crowd. I get:

But the actual id of the show is 2490.

This is using v1.6.5.

KarellenX commented 7 months ago

189511 189512 189513

Wouldn't they be the ID for the episodes? For some reason the TMDB website does not reveal episode id's

As for seasons, we don't save unique IDs.

ReenigneArcher commented 7 months ago

For some reason the TMDB website does not reveal episode id's

My guess would be because it's not needed for any API calls except listing recent changes (https://developer.themoviedb.org/reference/tv-episode-changes-by-id). I think it's really only used internally for editing the database.

Normally all the required ids are part of the URL.

https://www.themoviedb.org/tv/2490-the-it-crowd/season/3/episode/1

e.g. The above is a series id of 2490, season number of 3, episode number of 1.

That's all the information you need to make most API calls related to a particular show, season, and episode.

https://developer.themoviedb.org/reference/tv-episode-details

Anyway, other video addons seem to use the tmdb series id as the unique id for the season and episode. I believe that's more valuable than an unused episode id especially since there is no way to determine which show or season an episode id belongs to.

KarellenX commented 7 months ago

other video addons seem to use the tmdb series id as the unique id for the season and episode

Then it's not unique. It is meant to be exactly what the name implies. Each movie, tv show and episode record in the database needs a uniqueID.

What are you trying to achieve? Have you checked out one of the TMDB helper addons to see how they accomplish it?

ReenigneArcher commented 7 months ago

It is meant to be exactly what the name implies. Each movie, tv show and episode record in the database needs a uniqueID.

I know Kodi has the DBID which needs to be unique. I don't think the uniqueID key for tmdb, imdb needs to be unique necessarily as these are just properties for the list item.

The current value that this addon provides is not really useful though. No one is using tmdb episode (or season) ids to do lookups in any database because they don't allow it. They intentionally don't allow it because the value is not stable. See:

Have you checked out one of the TMDB helper addons to see how they accomplish it?

I tried to use The TMDB Helper addon, but it doesn't add properties for existing lists... I did see it creates it's own lists and adds tmdb_id as well as tvshow.tmdb_id for shows, seasons, and episodes. Maybe I missed something, but that is what I see after looking at the source code and installing it.

What are you trying to achieve?

I simply need to get the tmdb id of the parent show when a season or episode is selected. My addon relies on the tmdb and/or imdb of the currently selected item.

I use tmdb api quite a bit in various projects (Plex, Jellyfin, etc.), and from my perspective tmdb id refers to a movie id or show id. I've not seen any other projects use these season/episode ids.

Perhaps a compromise would be to make the id showId-seasonNumber-episodeNumber. E.g. 2490-1-1 This would at least make the id useful, although I still think the uniqueId could be the show's id since the episode and season number can already be obtained through other means (ListItem.Episode and ListItem.Season)

You can also set other unique ids besides tmdb... so could you do tmdbEpisodeId and tmdbSeasonId as keys for the uniqueIds but have the main one be for the show itself?