# Where

**URL:** https://forums.plex.tv/t/where/32154
**Category:** Dev/API Corner
**Tags:** other-dev
**Created:** [April 4, 2013, 4:02pm UTC](https://forums.plex.tv/t/where/32154 "2013-04-04T16:02:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![coolmatt](https://avatars.discourse-cdn.com/v4/letter/c/3bc359/32.png) [@coolmatt](https://forums.plex.tv/u/coolmatt)
#### Post date: [April 4, 2013, 4:02pm UTC](https://forums.plex.tv/t/where/32154/1 "2013-04-04T16:02:30Z")

</div>

Hi,

&nbsp;

I wrote a little crawler that scans my preferred P2P site, checks (according to keywords) if a show is available and downloads it.

But before downloading I would like to check if that episode already exists in my PMS library.

&nbsp;

So I thought I would find the information in the XML response given by querying "localhost:32400/library/metadata/5442/allLeaves"&nbsp;(note : 5442 is the id of the show) but no season/episode information here...

&nbsp;

Any idea where it might be ?

&nbsp;

Thanks.

M.

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

### Author: ![baa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/baa/32/2026_2.png) [@baa](https://forums.plex.tv/u/baa)
#### Post date: [April 5, 2013, 6:08pm UTC](https://forums.plex.tv/t/where/32154/2 "2013-04-05T18:08:12Z")

</div>

Not sure, if this is the right information - but sure it looks like:

You got to start earlier... when selecting the actual show you get a menu like

&nbsp;- All episodes

&nbsp;- Season 4

&nbsp;- Season 5

or in XML&nbsp;(cleaned up for easier reading):

\<Directory&nbsp;[...]&nbsp;title="All episodes"/\>

\<Directory&nbsp;[...]&nbsp;type="season"&nbsp;title="Season 4" [...]&nbsp;index="4" [...]\>

\<Directory&nbsp;[...]&nbsp;type="season"&nbsp;title="Season 5" [...]&nbsp;index="5"&nbsp;[...]\>

Look at the index-tag an remember the&nbsp;content - this should be your Season ID.

&nbsp;

Diving into one of the seasons you get something like...

&nbsp;- 

&nbsp;- 

&nbsp;- ...

again in XML:

\<Video&nbsp;[...]&nbsp;title="" [...]&nbsp;index="1"&nbsp;[...]\>

\<Media&nbsp;id="..."&nbsp;[...]\>

\<Part&nbsp;id="..."&nbsp;[...]/\>

[...]

\<Video&nbsp;[...]&nbsp;title="" [...]&nbsp;index="2"&nbsp;[...]\>

\<Media&nbsp;id="..."&nbsp;[...]\>

\<Part&nbsp;id="..."&nbsp;[...]/\>

[...]

[...]

Again, search for the index-tag an remember the&nbsp;content - this should be your Episode ID.

&nbsp;

Please check this data against some of your shows, it seems to fit in my library. I just cannot guarantee it's the same on your side :-)

---

<div class="post-metadata">

### Author: ![coolmatt](https://avatars.discourse-cdn.com/v4/letter/c/3bc359/32.png) [@coolmatt](https://forums.plex.tv/u/coolmatt)
#### Post date: [April 8, 2013, 10:56pm UTC](https://forums.plex.tv/t/where/32154/3 "2013-04-08T22:56:10Z")

</div>

Thanks for your reply Baa.

I searched the higher branches in the library&nbsp;tree but could not get any XML output with :

\<Directory&nbsp;[...]&nbsp;title="All episodes"/\>

\<Directory&nbsp;[...]&nbsp;type="season"&nbsp;title="Season 4" [...]&nbsp;index="4" [...]\>

\<Directory&nbsp;[...]&nbsp;type="season"&nbsp;title="Season 5" [...]&nbsp;index="5"&nbsp;[...]\>

&nbsp;

What url do you query to get this ?

---

<div class="post-metadata">

### Author: ![baa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/baa/32/2026_2.png) [@baa](https://forums.plex.tv/u/baa)
#### Post date: [April 9, 2013, 4:28am UTC](https://forums.plex.tv/t/where/32154/4 "2013-04-09T04:28:01Z")

</div>

In my example: starting at...

[http://127.0.0.1:32400](http://127.0.0.1:32400)

climb down the "key"s:

/library/sections/2/all

from there you will be kind of redirected with key=

/library/metadata/37/children

to the view like described. For sure the "2", "37", "children" are only keywords valid in my database - they would different on you machine. Also, the Season/Episode view only comes up when using a TVShow scanner, a Movie has different metadata.

---

<div class="post-metadata">

### Author: ![coolmatt](https://avatars.discourse-cdn.com/v4/letter/c/3bc359/32.png) [@coolmatt](https://forums.plex.tv/u/coolmatt)
#### Post date: [April 9, 2013, 11:43am UTC](https://forums.plex.tv/t/where/32154/5 "2013-04-09T11:43:20Z")

</div>

Thank you so much Baa.

I must have been blind !!! :-)

---

<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: [December 20, 2019, 11:10pm UTC](https://forums.plex.tv/t/where/32154/6 "2019-12-20T23:10:13Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
