Plex API not returning added metadata

When I get media details from a url-based API call, it is not showing any metadata that I have manually added.

In this case, I added a genre tag to a title, via the UI. I can filter by this in the UI fine. But when I get that data from the API call, it only shows the original genre data.
FB_IMG_1622518834763
FB_IMG_1622518839165

Is user-customised metadata stored elsewhere?

Are you certain you’re looking at the same item?

I just added a custom Genre tag to a show and it immediately appeared.

Yes, definite the same item from the API as what I edited in the UI.

To be clear, changes to genre show in the Plex UI immediately, but they do not show in data returned from the API.

You are returning data via the API, right?

Yup.

http://127.0.0.1:32400/library/metadata/{ratingKey}

I don’t think it matters, but which agent?

I’m using the new plex movie and tv show agents. Weird thing is that I’m seeing the data now, a few hours later. I’ll close this and investigate further. thanks for the response.

That’s … that’s really odd.

When Genre is updated the records in the database are updated instantly.

Glad it’s working. :man_shrugging: :woman_shrugging:

@Volts Okay, i’ve found the issue. When i use the /library/metadata/{ratingKey} url, then it works. BUT, if i use the serverIP:32400/library/sections/2/all?X-Plex-Token=??? URL to list everything, then the corresponding item does not have the updated genre.

So, via {ratingKey}

detail

then from list contents of library

list

And i need the full list for my purposes.

That’s a mystery to me too. Both update immediately for me.

Are other data updates visible on /library/sections/{librarySectionID}/all? It couldn’t just be something stale/caching somehow, could it?

Does restarting PMS make a difference?

Will check it out and advise. But it’s very strange to see it in one set of data immediately, but not another. Have tried refreshing metadata and rescanning, but no change. Advise later when I get a chance to restart

Node. Plex restart makes no difference. Nor does emptying the cache or even running incognito :frowning:

I’ve got no guesses.

Do you see the same thing if you create a test library?

I’ll give it a while and let you know. Ou of interest, which agents are you running for shows? and also What is your agent order?

i even tried enabling local metadata and rescanned, however this didnt change anything.

I’m using the Plex TV Series agent, so the agent order doesn’t apply.

I’d ask what the database shows you, but I’m sure that’s been updated, since you see the results in the GUI and for individual item queries.

Oh wait, I think I have an explanation.

Only the first two genre tags are stored inline in the metadata_items table and update immediately. And only the first two are returned when querying /library/sections/{librarySectionID}/all

Other tags are stored in the tags table, and are returned when querying individual items.

In your example above you’ve added a third tag, so you need to query the specific item directly.

yeah… its super strange… even more so that both the individual AND list works for you

I keep wondering if there is some additional job or step than is missing to update everything …

oh hang on … so you dont see added genre metadata beyond two items? Damn… that just feels cludgy from a data perspective… unfortunately, it’s not feasible for me to individually query every item in a list. Would just slow it down too much when i am talking a full list of all titles.

But i can confirm that you are exactly right on this. If I delete all the genres, then add them with my genre first, then i see the data.
image

Of course this doesn’t solve my problem for my app. (filter by Genre option)
Posterr

I bet it’s a performance optimization. The database design is slightly de-normalized for performance, while keeping the flexibility to use as many genres as desired.

Are the top two genres enough for your app in the overview?

Pull it from the DB directly! (heh)

Or - more seriously - schedule it async and cache the results.

trouble is that genres are seemingly populated in any order, with no preference. plus, some of my users want to add their own genres. (like ‘monster’ for monster movies)

Im not keen on the idea of connecting to a db directly, when there is an existing API. Too easy to cause performance issues, plus DB schema changes would be a nightmare. I already do async calls and cache results, but the data is quite dynamic. This, coupled with response time considerations means that pre-caching everything is not really an option. (have you seen the size of some peoples libraries?) :slight_smile:

anyhow… we have an answer, if not a solution. Thanks for your help in figuring this out. Give Posterr a try if you get a chance. :slight_smile:

Long and the short of it is that “filter by genre” may not stay in my app. :frowning: