"Open" Or "Open With" method for reading embedded tags

I posted this same question in the "agents" area.  Sorry for the duplication, but I'm not sure the best place to ask this question (and it was getting zero views over there...)

 

I'm in the process of writing an agent to pull the embedded metadata from a matroska file for use in Plex.   My code worked on my test bench and I'm now moving it into the Plex agent format - with the associated limitations.  I'm looking for an available Plex-python method that is equivalent to f = open('workfile', 'rb')  or the "open with" syntax.  I need to be able to open the multimedia file in question in order to query any of the embedded tags.  Unfortunately, even with elevated privileges, I can't seem to find a way to open the file in a read only method.  I fully understand why Plex would limit the capabilities of the python execution, but I'm only looking at reading the media file that the agent is considering - not trying to read or store information elsewhere.

 

Any ideas?  

I posted this same question in the "agents" area.  Sorry for the duplication, but I'm not sure the best place to ask this question (and it was getting zero views over there...)

 

I'm in the process of writing an agent to pull the embedded metadata from a matroska file for use in Plex.   My code worked on my test bench and I'm now moving it into the Plex agent format - with the associated limitations.  I'm looking for an available Plex-python method that is equivalent to f = open('workfile', 'rb')  or the "open with" syntax.  I need to be able to open the multimedia file in question in order to query any of the embedded tags.  Unfortunately, even with elevated privileges, I can't seem to find a way to open the file in a read only method.  I fully understand why Plex would limit the capabilities of the python execution, but I'm only looking at reading the media file that the agent is considering - not trying to read or store information elsewhere.

 

Any ideas?  

Yes...

You need to run your plugin with elevated privileges stated in your  info.plist file first of all, but you already stated that  :rolleyes:

	PlexPluginCodePolicy
	Elevated

Then to read the darn file, try this:

import io

io.open(myFile, ‘r’)

/T

Worked like a charm!  Many thanks.  Having some iteration problems now, but thanks for getting me past that hurdle,,,

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