tunarr icon indicating copy to clipboard operation
tunarr copied to clipboard

Consider moving 'enumeratePlexItem' calls from frontend to backend

Open chrisbenincasa opened this issue 2 months ago • 0 comments

Currently, when you add Plex media in the program selector, we loop and recursively walk the 'tree' of items, e.g. for plex shows, we will go and pull all seasons and then all episodes of the show by finding all of the child IDs.

Part of this process also looks up the child IDs against the existing database. If the program was added by another channel, it will exist in the DB and we will use our internal Tunarr ID for addressing and eventually update the DB item with the just-pulled Plex details.

If we have a server endpoint to do this enumeration, we may be able to speed this up using our new program_grouping table, which may have the Plex mappings already (then we can skip the whole Plex lookup).

A few additional thoughts:

  1. Pro: We can potentially skip Plex lookups
  2. Pro: We have a lot of this logic on the server-side for dynamic channels already anyway
  3. Con: Unclear how frequently we'll find a 'hit' in our local DB - we may still be reaching out to Plex a lot
  4. Con: Increase bandwidth to/from server-side; could potentially cause stream interruptions?
  5. Con: Potential added complexity and super specific server endpoints

chrisbenincasa avatar Apr 16 '24 13:04 chrisbenincasa