trakt / api-help

Trakt API docs at https://trakt.docs.apiary.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[suggestion] Add season and episode counts

rysson opened this issue · comments

Background

Imagine list od shows. I can select one, enter to its seasons. Select one and enter to its episodes.
It will be very nice to see on all tree levels if items are watched, in progress (partially watched) or not watched at all.

Episodes are ok, I can read it from /sync/watched/shows and /sync/playback.

I have same problems with seasons and tv-shows level.

Current objects

Now in /sync/watched/shows I have number of play but I don't know how many seasons or episodes are.

BTW, I see plays in show is a sum of all plays inside than could be bigger then number of the episodes at all event if I watched only one episode (many times of course)

  {
    "plays": 9,
    "last_watched_at": "2023-10-23T18:31:05.000Z",
    "last_updated_at": "2023-10-23T18:31:05.000Z",
    "reset_at": null,
    "show": {
      "title": "Loki",
      "year": 2021,
      "ids": {
        "trakt": 146535,
        "slug": "loki",
        "tvdb": 362472,
        "imdb": "tt9140554",
        "tmdb": 84958,
        "tvrage": null
      }
    },
    "seasons": [
      {
        "number": 1,
        "episodes": [
          {
            "number": 1,
            "plays": 2,
            "last_watched_at": "2023-10-23T18:31:05.000Z"
          },
          {
            "number": 2,
            "plays": 1,
            "last_watched_at": "2023-10-21T18:25:36.000Z"
          },

Suggestion

I suggest add season_count / number_of_seasons for tv-show and episode_count for each season.

If I could find those numbers there I would have all information to show watched / progress on all levels without any extra request.

Maybe even add those number for all show and season objects not only the history?

Ask

What do you think about it?
Of course if there is no any problem (like performance).

Maybe I miss something and you point me another solution.

Not a bad idea, but the problem is the data from /sync/watched/shows is heavily cached so those counts could be stale for a while and not accurate. This is the main reason we suggest caching the show data separately and updating it using the /shows/updates endpoint to know you need to refresh that specific show locally. Does that work for you?

Have to :-)

I see, invalidate cache is too heavy task. Ok, updates could help if I'll find the season and episode counts.
I can't see them in any object, could you help me?

How to get progress (including watched and non-watched segments)) using pure API?
20231024-105625-718x30

If you add ?exeneded=full the show object will include the aired_episodes count.

If you need progress for 1 show, you can use:
https://trakt.docs.apiary.io/#reference/shows/watched-progress/get-show-watched-progress

If you're trying to recreate the progress page as seen on Trakt, you should cache the watched data + all metadata for each show, then calculate the progress yourself. That will be the most efficient since most of the data isn't changing that often.

Thanks a lot.