Can I pass a custom value from search() to update()?



I am not the strongest Python programmer, but I usually manage. I know that these are sandboxed out the wazoo as well, and accept that this is only prudent, given the potential for all sorts of chicanery.

But I can't for the life of me figure out how to pass a value from search to update. Is this possible given the constraints imposed by the api? Is it obvious and I'm just a dufus?

I'd like to do something similar to the following:

    def search(self, results, media, lang, manual):
        results.Append(MetadataSearchResult(, name=c.lower().title(), score=100, lang=lang))
        custom-value = 'x'

    def update(self, metadata, media, lang, force):
        if custom-vakue == 'x':
            Log ('success')

In update(), media is a MediaTree object, but in search() it's a Media Container? And no other objects are common to both (not to mention I can't attach new attributes to any of these any way I can figure). What's the trick?

Thanks in advance.


The correct answer seems to be to include it with the id. If there is no external id assigned by your agent it's using the internal Plex db id, just a sqlite integer. Assigning a different number doesn't mess with that. Add some separator character (dot works fine, comma or whatever). You'll have to substring or split out the values within update().

Nothing else seems possible.

Leaving this here in case anyone else can benefit.