Aspect Ratio For Projector Masking

Hello, im currently in the process of building a home theater. I’ve been a plexpass member for a long time. Ive setup homeassistant and have lights automated based on the status of the plex client running on an nvidia shield and have started to look into building a automated masking system for my projector screen based on the aspect ratio of the media being played. Im able to see the aspect ration info within plex and using the xml file for the metadata of the library item itself but not sure how to pull the aspect ratio info using a python script or any kind of script for that matter. Was wondering if anyone else has tried or implemented a solution to this. Thanks for any replies in advance.