# Metadata Agent - Access to Title Set By Scanner

**URL:** https://forums.plex.tv/t/metadata-agent-access-to-title-set-by-scanner/180695
**Category:** Dev/API Corner
**Tags:** scanner-agent-dev
**Created:** [February 19, 2017, 12:55pm UTC](https://forums.plex.tv/t/metadata-agent-access-to-title-set-by-scanner/180695 "2017-02-19T12:55:26Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![alon.albert](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@alon.albert](https://forums.plex.tv/u/alon.albert)
#### Post date: [February 19, 2017, 12:55pm UTC](https://forums.plex.tv/t/metadata-agent-access-to-title-set-by-scanner/180695/1 "2017-02-19T12:55:26Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ZeroQI](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/zeroqi/32/6522_2.png) [@ZeroQI](https://forums.plex.tv/u/ZeroQI)
#### Post date: [February 19, 2017, 7:08pm UTC](https://forums.plex.tv/t/metadata-agent-access-to-title-set-by-scanner/180695/2 "2017-02-19T19:08:52Z")

</div>

@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

---

<div class="post-metadata">

### Author: ![alon.albert](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@alon.albert](https://forums.plex.tv/u/alon.albert)
#### Post date: [February 20, 2017, 6:30am UTC](https://forums.plex.tv/t/metadata-agent-access-to-title-set-by-scanner/180695/3 "2017-02-20T06:30:23Z")

</div>

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"
```

---

<div class="post-metadata">

### Author: ![ZeroQI](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/zeroqi/32/6522_2.png) [@ZeroQI](https://forums.plex.tv/u/ZeroQI)
#### Post date: [February 20, 2017, 8:50am UTC](https://forums.plex.tv/t/metadata-agent-access-to-title-set-by-scanner/180695/4 "2017-02-20T08:50:38Z")

</div>

@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
```

---

<div class="post-metadata">

### Author: ![alon.albert](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@alon.albert](https://forums.plex.tv/u/alon.albert)
#### Post date: [February 20, 2017, 6:34pm UTC](https://forums.plex.tv/t/metadata-agent-access-to-title-set-by-scanner/180695/5 "2017-02-20T18:34:11Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)
#### Post date: [January 8, 2020, 8:02pm UTC](https://forums.plex.tv/t/metadata-agent-access-to-title-set-by-scanner/180695/6 "2020-01-08T20:02:30Z")

</div>


