trakt / api-help

Trakt API docs at https://trakt.docs.apiary.io
183 stars 7 forks source link

People Duplicate for Movies #80

Closed Pomanks closed 5 years ago

Pomanks commented 5 years ago

When I request people with the given endpoint https://api.trakt.tv/movies/tt4154796/people for the movie Avengers: Endgame, I get duplicates in the response like this one having two different jobs and thus, being in the response 2 times (part of the production array) :

 {
                "job": "Casting",
                "jobs": [
                    "Casting"
                ],
                "person": {
                    "name": "Nicholas A. Mudd",
                    "ids": {
                        "trakt": 675687,
                        "slug": "nicholas-a-mudd",
                        "imdb": null,
                        "tmdb": 1653683,
                        "tvrage": null
                    }
                }
            },
            {
                "job": "Casting Associate",
                "jobs": [
                    "Casting Associate"
                ],
                "person": {
                    "name": "Nicholas A. Mudd",
                    "ids": {
                        "trakt": 675687,
                        "slug": "nicholas-a-mudd",
                        "imdb": null,
                        "tmdb": 1653683,
                        "tvrage": null
                    }
                }
            },

Is that a caching issue or some migration bug since as I recall, this endpoint only provided a job property before and is now providing a jobs array ?

tysonkerridge commented 5 years ago

Not sure about the duplicate entry, but the reason it has both job and jobs is for backward compatibility since the new people updates (https://github.com/trakt/api-help/issues/74)

Sent with GitHawk

Pomanks commented 5 years ago

I know why there's both job and jobs, I was mentioning cache issue/migration because of that precisely. The thing is, why is there 2 entries of Nicholas A. Mudd instead of having something like :

 {
                "job": "Casting , Casting Associate",
                "jobs": [
                    "Casting",
                    "Casting Associate"
                ],
                "person": {
                    "name": "Nicholas A. Mudd",
                    "ids": {
                        "trakt": 675687,
                        "slug": "nicholas-a-mudd",
                        "imdb": null,
                        "tmdb": 1653683,
                        "tvrage": null
                    }
                }
            },

Maybe this is more explicit than my first comment 🙂

tysonkerridge commented 5 years ago

Sorry, yeah I read it as if you weren’t aware of the changes but reading it again knowing you were makes more sense 😄.

From what I can see, it looks like the crew aren’t displayed explicitly on the Trakt website (other than Directors and writers at the top) and the “duplicates” in the API seem to be in crew only, not cast. Eg. Chris Evans in the cast has “Steve Rogers, Captain America” as expected, but in the crew section, each “job” is treated as one person entry even though it can be an array. Stephen McFeely has two jobs in “Writing” and one in “Production” also (perhaps others too, I didn’t look further). Maybe it was done/left that way for a reason, but in that case the addition of the jobs array wasn’t necessary.

Sent with GitHawk

rectifyer commented 5 years ago

Good catch on this, it was a bug. I'll have a fix out later in the week and it will correctly combine people with the same role (in this example production) and the jobs array will correctly have both of that person's jobs. This bug affected movies and episodes.