Here is the raw web hook that Plex sends us. Notice the Guid
part in the bottom, that is the main thing we use to match. If not found, we fall back to a title based match along with the season and episode number.
{
"event": "media.play",
"user": true,
"owner": true,
"Metadata": {
"librarySectionType": "show",
"ratingKey": "33396",
"key": "/library/metadata/33396",
"parentRatingKey": "33395",
"grandparentRatingKey": "297",
"guid": "plex://episode/62c55d9dec2d72ebcd5653e8",
"parentGuid": "plex://season/62c55d89ec2d72ebcd5653e6",
"grandparentGuid": "plex://show/5d9c083fba6eb9001fb9f500",
"type": "episode",
"title": "Jonathan Mangum 12",
"grandparentKey": "/library/metadata/297",
"parentKey": "/library/metadata/33395",
"librarySectionTitle": "TV Shows",
"librarySectionID": 2,
"librarySectionKey": "/library/sections/2",
"grandparentTitle": "Whose Line Is It Anyway? (US)",
"parentTitle": "Season 19",
"contentRating": "TV-14",
"summary": "Guest: comedian Jonathan Mangum.",
"index": 1,
"parentIndex": 19,
"viewCount": 1,
"lastViewedAt": 1666574653,
"thumb": "/library/metadata/33396/thumb/1666515880",
"art": "/library/metadata/297/art/1666022715",
"grandparentThumb": "/library/metadata/297/thumb/1666022715",
"grandparentArt": "/library/metadata/297/art/1666022715",
"grandparentTheme": "/library/metadata/297/theme/1666022715",
"duration": 1500000,
"originallyAvailableAt": "2022-10-14",
"addedAt": 1665845351,
"updatedAt": 1666515880,
"Guid": [
{
"id": "imdb://tt22797684"
},
{
"id": "tvdb://9248134"
}
]
}
}
The episode on Trakt is 11x01 but we don’t have the IMDB or TVDB to match since those fields are blank on TMDB. So, the fix is adding that missing data to TMDB so we can match it. I can’t think of an automated way of doing this since it would require a mapping from TVDB <> TMDB, but adding missing IDs on TMDB is a better way of handling.