Jump to content

Let an Upcoming entry carry its own image


Recommended Posts

Blueskies278
Posted (edited)

The request

An entry returned by /Shows/Upcoming has no image of its own. I'd like to ask for one: a per-entry image reference on that endpoint's response.

The reason

I maintain two plugins, TV Show Status & Tv show Air Dates. Among other things it marks season premieres and finales by drawing a small badge on artwork, through IImageEnhancer. On posters and on series thumbnails it does exactly what it should.

In Upcoming it cannot, and the reason is visible in the API response. Calling /Shows/Upcoming with an API key returns entries that carry:

  • no Id
  • no ImageTags
  • ParentThumbItemId and ParentThumbImageTag that are identical for every entry of the same show
  • SeriesPrimaryImageTag, likewise identical across that show's entries

Everything else is per-episode — Name, Overview, PremiereDate, IndexNumber, ParentIndexNumber, ProviderIds — but every image field points at the series.

So each card in the Upcoming view is given the same picture. The clients then behave sensibly: they use an entry's own image when there is one and fall back to the series thumbnail when there isn't, and the fallback is always taken, because the first option never exists.

What that means for the plugin

The enhancer is handed the series, once, and asked whether to draw. It has no way to answer differently for one episode than another, because there is only one image in play. In practice:

  • A show with a premiere inside the plugin's window gets the badge drawn on its series thumbnail — and therefore on every one of that show's Upcoming cards, which can be ten or more, not the one the badge refers to.
  • A show whose premiere has already aired has a plain thumbnail, so none of its cards are badged.

Side by side on one screen that reads as a fault: one show badged ten times, another not at all. It isn't a fault. It is the only behaviour the data permits, and no plugin setting can change it.

The same limitation blocks anything else an enhancer might reasonably want to do per upcoming episode — a new-season marker, a countdown, a logo on the episodes that actually change network, a first-episode-after-the-hiatus flag.

Why the existing routes don't cover it

The episode name. The plugin's companion, TV Air Dates, can put "Season Premiere" in front of the episode title, and that does land on the correct card everywhere. But a name is one field and it travels: the prefix then appears on the season page, in search results and on the now-playing screen, not only in Upcoming. A marker on artwork is the right shape for this, and it is the shape Emby uses elsewhere.

Injected JavaScript in the web client. This solves it per episode, and it is what the plugin does for browsers. It reaches only browsers. The apps carry their own copy of the web client, so a server has no way to reach them, and iOS cannot be modified at all. That is the gap I am asking about: the route that works is available only on the client that needs it least, and the plugin therefore cannot work seamlessly on the Emby apps — which is where most people actually look at Upcoming.

IImageEnhancer. The enhancer is the right mechanism and it works well everywhere else. The difficulty is only that for Upcoming it is asked one question per show and expected to answer it per episode.

Possible shapes

Any of these would do it, in rough order of how small they look from outside:

  1. Set ImageTags on the entry when the episode resolves to a real (including virtual or unaired) item, so clients take the path they already prefer.
  2. Set Id on the entry, so a plugin has something to attach an image to and clients can request /Items/{id}/Images/Primary as they do everywhere else.
  3. Allow a metadata provider to supply a per-entry image reference alongside the episode, for the endpoint to carry through.

The first appears to change nothing for existing clients, since they already check the entry's own image first and fall through when it is absent.

What it would enable

Plugins that already badge posters and thumbnails correctly would badge upcoming episodes correctly too, on every client, including the TV and mobile apps where nothing else is possible — and TV Show Status would behave the same way in the apps as it does in a browser, which is all I am really after.

Everything above is observable from /Shows/Upcoming with an API key, if it is useful to reproduce. Thanks for reading, and for the plugin surface generally: the enhancer and channel APIs are good, and this is a request to extend one of them.

 

Thanks 😀

Edited by Blueskies278
Posted

Hi.  Luke can consider but my first blush is that this would require us to provide actual image resources for a potentially HUGE number of items that don't actually exist in our database.

Posted

Hi, that's correct. There is no database storage for this information. We pass episode numbers on the image url of the series thumb, which could flow through to image enhancers, but that's going to result in individual image requests vs one, and would blow up the size of image caches on both clients and server.

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...