Plex Show Episode Count API

I am trying to come up with a simple way to grab my total episode count from plex.

Here is what I have for total show count, but I need episodes. What needs to be changed? Or is there another way, preferably with PHP.

Thanks

$show_url = 'https://www.******.com/library/sections/3/all?X-Plex-Token=xxxxxxx';
$show_xml = simplexml_load_file($show_url);
$show_count = count($show_xml);
echo $show_count;

Web client

Select your show library, and notice second top item says TV Shows
Change that to episodes

Yes, but how do you pull that externally?

So you want not the number, but be able to do it from Code :wink:

Issue a GET like: <PMS_IP>:32400/library/sections/<SECTIONKEY>/all?type=4&X-Plex-Container-Start=0&X-Plex-Container-Size=0&X-Plex-Token=XXXXX

You’ll get an XML returned, with an element named totalSize which will be the amount of episodes

And adding to self :wink:

In above url, set type=2 to get the count of shows

And here’s some types:

  • Movie : 1
  • Show : 2
  • Season : 3
  • Episode : 4
  • Trailer : 5
  • Comic : 6
  • Person : 7
  • Artist : 8
  • Album : 9
  • Track : 10
  • Clip : 12
  • Photo : 13
  • Photo_Album : 14
  • Playlist: 15
  • Playlist_Folder : 16
  • Podcast : 17

Thank you, sir!

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