TV_Show Agent: Show Updates vs. Episode Updates and Forced vs. Not forced

I’m working on my own agent that treats YouTube channels like TV Shows. I’m seeing some behaviour I don’t understand when updating though.

When is an update “forced” and “not forced”? The API document (2.1.10 says:

force (bool (Built-in Functions — Python 3.12.1 documentation)) – A
boolean value identifying whether the user forced a full refresh of the
metadata. If this argument is True, all metadata should be refreshed,
regardless of whether it has been populated previously.

but this doesn’t seem to be true. When I log “force” it seems to always be true whether it is the first search when adding a library, whether you press the “refresh button” or if it’s an update triggered by adding a new file.

Mostly I wouldn’t care so much, except that I’m also having some trouble understanding what is being passed to update when.

On the first search, once there’s a series match, it looks like media has all the files that were found by the scanner.

When a new file is added to the directory, it looks like media contains everything.

When you do a “refresh” of the series, media seems to have everything.

When you do a “refresh” of a single episode, media seems to only have that episode.

If, when, adding a new file, it only passed you the new episode, the fact that the update also has “force=true” wouldn’t be a big deal. But since everything is passed and it’s forced, you end up rechecking everything. This seems pretty unintuitive to me.

I’m also having a problem with the last case: refreshing a single episode: updated information doesn’t actually appear because, for some reason, Plex appears to create a whole new metadata path. So for every other update for a particular show I’m working on, the metadata get “serialized to”:

Plex Media Server/Metadata/TV Shows/e/818424f93f5645d87568e61dd78e68b7548da87.bundle/

But if I refresh a single episode it ends up serialising it to a completely new, episode specific path like:

Plex Media Server/Metadata/TV Shows/9/64a751f160105112103be1a48ca8c2eb18adc8f.bundle/

that contains another copy of the show’s Info.xml but only info for that one episode. Really weird. Any idea why?