Skip to content

Collection item matching misses entries because children endpoint is called without includeGuids=1 #35

Description

@gerra95

Plexyfin 0.6.2.0 correctly detects all items in some Plex collections, but only adds a subset to the Jellyfin collection.
For example, one item was missing from the created Jellyfin collection even though it existed in Plex, had correct TMDb/IMDb IDs in Jellyfin, and could be added manually.
Root cause appears to be that GetCollectionItems() calls Plex collection children endpoints without includeGuids=1. Plex then returns only the internal plex://... GUID, so Plexyfin falls back to title matching. Adding includeGuids=1&includeExternalMedia=1 to the collection item URLs fixed the issue locally.

Example XML call, without includeGuids=1:
curl "http://PLEX_HOST:32400/library/collections/COLLECTION_ID/children?X-Plex-Token=TOKEN"
Output:
<Video ratingKey="123" key="/library/metadata/123" guid="plex://movie/xxxxxxxxxxxxxxxxxxxx" type="movie" title="Example Movie" year="1988"> </Video>

Example XML call, with includeGuids=1:
curl "http://PLEX_HOST:32400/library/collections/COLLECTION_ID/children?includeGuids=1&includeExternalMedia=1&X-Plex-Token=TOKEN"
Output:
<Video ratingKey="123" key="/library/metadata/123" guid="plex://movie/xxxxxxxxxxxxxxxxxxxx" type="movie" title="Example Movie" year="1988"> <Guid id="imdb://tt0000000"/> <Guid id="tmdb://12345"/> <Guid id="tvdb://678"/> </Video>

Code fix:

In `Jellyfin.Plugin.Plexyfin/Plex/PlexClient.cs`, inside `GetCollectionItems()`, add `includeGuids=1&includeExternalMedia=1` to all collection item URL patterns.

Example:

var collectionQuery = $"includeGuids=1&includeExternalMedia=1&X-Plex-Token={_token}";

var urlPatterns = new List<Uri>
{
    new Uri(_baseUrl, $"library/collections/{collectionId}/children?{collectionQuery}"),
    new Uri(_baseUrl, $"library/metadata/{collectionId}/children?{collectionQuery}"),
    new Uri(_baseUrl, $"library/collections/{collectionId}/all?{collectionQuery}"),
    new Uri(_baseUrl, $"library/metadata/{collectionId}/items?{collectionQuery}"),
    new Uri(_baseUrl, $"library/collections/{collectionId}/items?{collectionQuery}")
};

After applying this locally, the missing collection items were matched and added correctly.

Versions:
Jellyfin: 10.11.8
Plexyfin: 0.6.2.0
Plex: 1.43.1.10611

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions