Media Server Abstraction: PlexLibraryItem → MediaItem Migration#8
Closed
enoch85 wants to merge 5 commits into
Closed
Media Server Abstraction: PlexLibraryItem → MediaItem Migration#8enoch85 wants to merge 5 commits into
enoch85 wants to merge 5 commits into
Conversation
7489e80 to
09b8944
Compare
BREAKING CHANGE: Rules engine now uses server-agnostic MediaItem type This migration enables the rules engine to work with both Plex and Jellyfin by replacing Plex-specific types with the abstracted MediaItem type. Key changes: - rule-executor.service: Uses MediaServerFactory instead of PlexApiService - rule.comparator.service: Updated types and property mappings - All getter services: Accept MediaItem, use abstracted media server - sonarr-getter: New findTvdbidFromMediaItem using normalized providerIds Property mappings: - ratingKey → id - parentRatingKey → parentId - grandparentRatingKey → grandparentId - EPlexDataType enums → MediaItemType strings The original guid string fallback in findTvdbidFromPlexLibItem was removed as it was dead code - per Plex API spec, guid is always plex://... format, provider IDs (imdb/tmdb/tvdb) only appear in the Guid array. Also updates docker/Dockerfile.dev to use this branch.
09b8944 to
b053e53
Compare
… abstraction - Add getAllIdsForContextAction() to IMediaServerService interface - Implement in PlexAdapterService and JellyfinAdapterService - Migrate CollectionsService: remove PlexApiService dependency - Migrate RulesService: 5 getAllIdsForContextAction + 3 getMetadata calls - Remove PlexMapper imports from both services
- Remove unused PlexMetadata, PlexLibraryItem imports - Remove deprecated getTmdbIdFromPlexData method (no callers) - getTmdbIdFromMediaItem handles all provider ID lookups via normalized providerIds
- Replace direct PlexApiService.getCorrectedUsers() calls with IMediaServerService.getUsers() - Add resolveRequestUsername() helper to handle different user types: - Local users (userType 2) → username directly - Jellyfin/Emby users (userType 3/4) → jellyfinUsername directly - Plex users → lookup via media server abstraction - Lazy load users only when needed for Plex user lookup - Add REMAINING_ISSUES.md documenting implementation status This makes both getter services work correctly regardless of which media server (Plex or Jellyfin) is configured.
…-getters fix: remove PlexApiService dependency from Overseerr/Jellyseerr getters
Owner
Author
|
Closing in favor of consolidated PR #24 (jellyfin-dev branch). All changes are included there. |
enoch85
added a commit
that referenced
this pull request
Jan 31, 2026
…switch Added a switchInProgress flag that: - Prevents concurrent switch operations from starting - Blocks factory.getService() calls during the switch - Is always released in a finally block This prevents API requests from routing to the wrong adapter during the window between settings update and server initialization. Fixes review item #8.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Media Server Abstraction: PlexLibraryItem → MediaItem Migration
Summary
Migrates core services from Plex-specific
PlexLibraryItemto server-agnosticMediaItem, enabling rules, collections, and media lookups to work with both Plex and Jellyfin.Property Mappings
ratingKeyIdidparentRatingKeyParentIdparentIdgrandparentRatingKeySeriesIdgrandparentIdEPlexDataType.*BaseItemKind.*'movie'/'show'/'season'/'episode'Guid[]arrayProviderIdsobjectproviderIdsindexIndexNumberindexparentIndexParentIndexNumberparentIndexLogical Changes
getGuidFromPlexLibItemhelper removed — Had a fallback to parseguidstring for provider IDs, but per Plex API specguidis alwaysplex://...format. Provider IDs (imdb://,tmdb://,tvdb://) only appear in theGuidarray, now normalized toproviderIdsby adapters.Season number extracted to variable — Duplicated ternary
dataType === 'season' ? origLibItem.index : origLibItem.parentIndexnow computed once and reused in API call and log message. Logic unchanged.Media server abstraction —
PlexApiServicemethods replaced withMediaServerFactory.getService()calls throughout rules engine:RuleExecutorService:getLibraryContents()CollectionsService:UpdateCollectionSettings(),getAllIdsForContextAction()RulesService:getAllIdsForContextAction(),getMetadata()getAllIdsForContextAction()abstracted — NewIMediaServerServicemethod for show→season→episode traversal. Implemented in both Plex and Jellyfin adapters.getTmdbIdFromPlexDataremoved — Deprecated method with no callers.getTmdbIdFromMediaItemhandles all provider ID lookups via normalizedproviderIds.Testing
✅ 394 tests pass · ✅ Types check · ✅ Build succeeds