Jump to content

Allow plugin containers to return references to existing native items


Recommended Posts

pfunk1978
Posted

   Allow channel/plugin containers to return references to existing native items instead of creating generic channel items 

  Description:

  Emby’s IChannel extension point allows a plugin to create a cross-client, structured content hierarchy. A plugin can return folders and media through
  ChannelItemInfo, making it suitable for custom views such as:

  Sports
  ├── Favorite Teams
  │   ├── Dallas Cowboys
  │   └── New York Mets
  ├── Favorite Leagues
  │   └── NFL
  ├── Baseball
  ├── Football
  ├── Basketball
  └── Soccer

  However, IChannel supports only:

  ChannelItemType.Folder
  ChannelItemType.Media

  When a plugin returns a media item, Emby materializes it as a new generic Video. The plugin cannot return or reference an existing native Emby item.

  ### Problem

  A plugin can query native Live TV Program objects and apply arbitrary filtering, but it cannot place those original programs inside its channel hierarchy.

  Instead, it must copy selected metadata into ChannelItemInfo. Emby then creates a separate item with:

  Type: Video

  Selecting that item opens the generic video-detail screen rather than the native Live TV program modal.

  As a result, the user loses:

  - Record
  - Record Series
  - Other Showings
  - Native program/channel information
  - Native Live TV playback behavior
  - Existing recording state
  - Program-specific client presentation

  Using the original program ID as ChannelItemInfo.Id does not solve this. Emby still assigns a new internal database ID and materializes a Video.

  ### Requested capability

  Allow a channel or plugin-provided container to return a reference to an existing Emby item.

  For example:

  new ChannelItemInfo
  {
      Type = ChannelItemType.NativeReference,
      NativeItemId = program.Id
  };

  Alternatively:

  new ChannelItemInfo
  {
      Type = ChannelItemType.Media,
      ReferencedItemId = program.Id
  };

  Another possible design would be a separate result type:

  public sealed class ChannelItemReference
  {
      public long ItemId { get; set; }
  }

  The important behavior is that Emby should not create a new generic item. When clients enumerate the plugin container, the server should return the DTO of the
  referenced original item.

  ### Expected behavior

  If the referenced item is a Live TV program:

  Referenced item type: Program

  The client should receive:

  Type: Program
  ChannelId: ...
  StartDate: ...
  EndDate: ...
  IsSports: ...

  Selecting it should open the normal Live TV program modal with recording actions.

  The same mechanism could support references to:

  - Movies
  - Episodes
  - Music
  - Photos
  - Playlists
  - Live TV channels
  - Live TV programs
  - Recordings
  - Other library items

  ### Container responsibilities

  The plugin should retain control over:

  - Which referenced items appear
  - Folder hierarchy
  - Ordering
  - Pagination
  - Refresh notifications
  - Filtering and classification
  - Custom folder names and images

  The referenced item should retain control over:

  - Item type
  - Metadata
  - Images
  - User data
  - Playback
  - Recording state
  - Permissions
  - Client navigation behavior

  ### Security and access

  Before returning a referenced item, Emby should apply the requesting user’s normal permissions:

  - Library access
  - Live TV access
  - Parental controls
  - Channel access
  - Item visibility
  - Playback restrictions

  An inaccessible referenced item should be omitted or returned as unavailable.

  ### Lifecycle behavior

  References should not duplicate or take ownership of the original item.

  If an EPG program expires or a library item is deleted:

  - The reference should disappear on the next refresh.
  - No duplicate metadata should remain.
  - The plugin should not need to delete a separately materialized media item.

  ### Acceptance criteria

  A plugin can:

  1. Query native Live TV programs.
  2. Apply its own team, league, sport, time, and exclusion rules.
  3. Return folders through IChannel.
  4. Return references to the matching original Program items inside those folders.
  5. Display the same original program in multiple plugin folders without duplicating it.
  6. Preserve the native Live TV modal and recording actions.
  7. Work consistently across Emby Web, mobile, and TV clients.

  ### Example use case

  A sports plugin could provide:

  Sports
  ├── Favorite Teams
  │   └── Dallas Cowboys
  ├── NFL
  ├── MLB
  ├── Football
  └── Baseball

  The same native game could appear under both “Dallas Cowboys” and “NFL.” Both entries would reference one original EPG Program, and selecting either would open
  Emby’s normal Live TV modal.

  ### Broader benefits

  This would enable plugins to build custom discovery and navigation experiences without duplicating library items or losing native behavior.

  Examples include:

  - Curated media hubs
  - Smart folders
  - Cross-library collections
  - Editorial recommendations
  - Custom Live TV views
  - User-specific dashboards
  - Genre or franchise navigation
  - Federated content providers

  This capability would make IChannel useful as a native virtual-container API rather than requiring every returned item to become separately materialized plugin
  media.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...