Jump to content

Detecting Poster & Item Change


adminExitium
 Share

Recommended Posts

adminExitium

Hi,

I am writing an API-based app that will apply overlays/badges to items like 4k, hdr etc. depending on the ffprobe data of the item. I need to detect when the poster with the applied overlay has been replaced either by the user selecting a different poster, metadata being refreshed or a better version of the media being downloaded etc.

I was planning to add a tag to the item but I guess that won't help if the metadata is refreshed or the user selects a different poster? Is there any recommended way to detect that kind of change?

I also use this app for Plex btw and there the change is tracked by the thumb url of the item plus a tag/label on the item, a combination which changes anytime the poster changes in any of the above mentioned scenarios. Are there any similar properties available in the Emby API that I could use for the same?

Let me know if you need any further clarification to provide better info.

Thanks.

Link to comment
Share on other sites

Hi, the LibraryChanged websocket notifications can tell you that something changed, but it can't tell you what specific properties of an item changed. That's something I'd like to overhaul at some point so that it can provide this sort of information.

For now, a couple ideas would be to:

  • Use LibraryChanged and just assume everything changes when it gets reported for an item
  • Store the ImageTags that you get for an item client-side, because those will change if the image changes
Link to comment
Share on other sites

adminExitium

Hi,

The ImageTags looks to be exactly what I needed. Thanks.

Another question if you don't mind, I will eventually be modifying the app to also allow for creation of collections based on movie properties so is there any parameter for the Item that can tell me when it changed (for example if the underlying media was upgraded/replaced) so I know if I have to reprocess the item for the collections?

Link to comment
Share on other sites

adminExitium

And yes, LibraryChanged sounds like exactly what I need but currently, I run the script on a cron interval rather than keeping it perpetually running and listening to websocket events and I want to continue that way unless absolutely necessary.

Perhaps the ETag would work? But I am not sure how reliable it is.

Link to comment
Share on other sites

You can check ETag, you can also use the MinDateLastSaved to query for items that have been saved with a certain period of time.

Link to comment
Share on other sites

adminExitium

Alright, thanks, will use the ETag for now.

 

Would it be possible to add the DateSaved or DateUpdated as a property of each item?

 

Also, is there any reference for using the API to add a poster, create a collection and add an item to a collection or is checking the API calls from the browser while doing these actions the best idea?

Link to comment
Share on other sites

Internally we have DateLastSaved, yes it's possible to potentially add that to api output as well. But either of the two approaches i gave I think would be better. You don't necessarily need to track the date saved for each individual item, you just need to know the date you last checked for changes, and then retrieve new changes that have occurred since then.

Link to comment
Share on other sites

adminExitium

Thanks.

Yeah, I don't keep any global state tracking right now but looks like that may be the easier solution.

I do have some more questions about filtering for collections but I will come back for that later once the posters part is done.

Link to comment
Share on other sites

  • 3 weeks later...
adminExitium

Is there any way to get the details of a specific item without specifying the user id in the URL? I am able to upload the poster via the API but I wanted to cache the new Image Tag to check against for any future runs.

Link to comment
Share on other sites

adminExitium

Yeah, that was the first thing I tried but it's returning a 404.

 

curl 'https://emby.abc.xyz/emby/Items/831?api_key=key'

 

But the corresponding User ID URL works:

curl 'https://emby.abc.xyz/emby/Users/1fefd8f97a3a44cf9b4f8ffd7692bd80/Items/831?api_key=key'

 

Link to comment
Share on other sites

adminExitium

Oh ...😔

 

Can that be added? From what I see `UserData` is the only key that's unique in the response for the User-specific Item URL. Barring that, everything is common for the server so it can probably be returned for a new `emby/Items/<ItemID>` API?

Getting the users list and then using the admin user just to request this info seems like unnecessary steps when I don't even need the `UserData`.

Link to comment
Share on other sites

adminExitium

Also, is there an easier way to get the updated tag after uploading a custom poster? I tried the Items/<ItemID>/Images endpoint but that doesn't have the tags (which seems like an oversight?). The only way I see is to either use the User-specific Item URL or iterate over all items in the library from the Items endpoint.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...