Metadata Agent - Access to Title Set By Scanner

I am writing a Scanner/Agent pair.
The Scanner adds Media Episodes and sets the title based on the filename.

The agent is supposed to set posters and other images.

What I am seeing is that after the agent runs, I loose the title set by the scanner. The the title is set to “Episode #”

If I hard code something like:
episodeMetadata.title = “Test”
I can change the title to whatever I want but I don’t see how I can get access to the information I already set in the scanner.

@alon.albert
you can specify the ep title but the agent will override it in Update() function
Here that means the agent updated it, modify the agent so the title isn’t updated…
check my signature for the scanner link it does populate the ep title already, which default scanner can’t

ZeroQI
My scanner does set the title with:

      return Media.Episode(show, year, episode, title, year)

and my agent doesn’t override it in Update, but I see a generic “Episode ###” as a title in Plex.

If I look at the raw XML, I see that ‘titleSort’ does have my title but ‘title’ doesn’t

    <Video ratingKey="40" key="/library/metadata/40" parentRatingKey="38" type="episode" title="Episode 8" titleSort="My Title"

@alon.albert i know the episode title was showing for me if the serie wasn’t matched
did you try something like:

episode_obj = metadata.seasons[season].episodes[episode]
if metadata.title and metadata.title.startswith("Episode ") and metadata.title_sort:  metadata.title = metadata.title_sort

I ended up getting more reliable episode title based on episode index from a website.