Plex API and Photos

I am trying to get a list of all photos (actually their aspect ratio) in my Photo library- using Python and the API. I can get the info I need, in a browser, by using: localhost:32400/library/sections/2/year/2015 and the resulting xml shows various tags, including aspectRatio.

But how can I duplicate this using the API? I don’t think year is an attribute of the Photo section as
photos = plex.library.section(‘Photos’).year fails.

Or can I just use urllib.request and do a request/read?

Check the source code for ExportTools.

See my signature for a link

And did take a quick look, and it’s a multi step operation:

  1. Get the key for the section:

/library/sections/**SectionNumber**/all

Look up the key, and use that for the next, in a loop, getting items in chunks of 20

/library/metadata/20703/children?year>=2014&X-Plex-Container-Start=0&X-Plex-Container-Size=20

In above, the following is vital:

/library/metadata/20703 is the key from the first req.

X-Plex-Container-Start=0&X-Plex-Container-Size=20 is where you loop in multiple requests, until the answer is empty

/T

And when said…ExportTools can already do this for you :wink:

github.com/ukdtom/ExportTools.bundle/wiki/Photo-Export-Level

Plexapi only supports the most basic operation when it comes to images. You have to do the filtering yourself ATM