class ObjectContainer(**kwargs) A container for other objects. ObjectContainer is the type most frequently returned to other applications. It provides clients with an ordered list of items in response to a re- quest. view_group A string specifying the name of the view group the client should use when dis- playing the container’s contents. This should be the name of a group previously registered with Plugin.AddViewGroup() (page 49). 52 Chapter 6. API ReferencePlex Plug-in Framework Documentation, Release 2.1.1 content Identifies the type of the objects inside the container. This attribute should be set to one of the container type constants identified here. ..todo:: Link to container types art A string specifying an image resource that should be used as the container’s back- ground art. title1 A string specifying the first title to display in the user interface. title2 A string specifying the second title to display in the user interface. http_cookies A string specifying any HTTP cookies that need to be passed to the server when attempting to play items from the container. user_agent A string specifying the user agent header that needs to be sent to the server when attempting to play items from the container. no_history A boolean specifying whether the container should be added to the client’s history stack. For example, if Container B in the sequence A => B => C had no_cache set to True, navigating back from C would take the user directly to A. replace_parent A boolean specifying whether the container should replace the previous container in the client’s history stack. For example, if Container C in the sequence A => B => C had replace_parent set to True, navigating back from C would take the user directly to A. no_cache A boolean indicating whether the container can be cached or not. Under normal circumstances, the client will cache a container for use when navigating back up the directory tree. If no_cache is set to True, the container will be requested again when navigating back. mixed_parents A boolean indicating that the objects in the container do not share a common parent object (for example, tracks in a playlist). header message The header and message attributes are used in conjunction. They instruct the client to isplay a message dialog on loading the container, where header is the message dialog’s title and message is the body. add(obj) Adds the object obj to the container. The container can also be populated by passing a list of objects to the constructor as the objects argument: 6.1. Standard API 53Plex Plug-in Framework Documentation, Release 2.1.1 oc = ObjectContainer( objects = [ MovieObject( title = "Movie" ), VideoClipObject( title = "Video Clip" ) ] ) len(container) Containers can be passed to the len() (http://docs.py
class DirectoryObject(**kwargs) Represents a generic container of objects. Directory objects are usually used when cre- ating a navigation hierarchy. key A string specifying the path to a container representing the directory’s content. This is usually a function callback generated using Callback() (page 48). title A string specifying the directory’s title. tagline A string specifying the directory’s tagline. summary A string specifying the directory’s summary. thumb A string specifying an image resource to use as the directory’s thumbnail. art A string specifying an image resource to use as the directory’s background art. duration An integer specifying the duration of the objects provided by the directory, in mil- liseconds.
@dane22 said:
Did you read the PDF’s I pointed you towards?
Yes, I did… and was have the second problem to do with that part you posted for me? The line XML.ElementFromURL('http://127.0.0.1:32400/library/sections')
of my code raising the exception and is my second problem.
You are trying to show a list of sections as directory objects.
The stuff I ref. from the PDF, is the two classes involved
As such, you need something like this, and written from memory, so might not work, but I did point you to a git with working code:
oc = ObjectContainer() sections = XML.ElementFromURL('http://127.0.0.1:32400/library/sections).xpath('//Directory') for section in sections: title = section.get('title') oc.add(DirectoryObject(key=Callback(MyFunction), title='Section "' + title + '"')) return oc
oc = None test = 'no error' try: XML.ElementFromURL('http://127.0.0.1:32400/library/sections') except: test = 'failed' oc = ObjectContainer(header="Empty", message=test) return oc
In wich point do I do that what you tell?
the Line: XML.ElementFromURL('http://127.0.0.1:32400/library/sections')
…should send and receiving an element from the link and do nothing with the content…
That line is fine, something else is throwing the exception.
And you try for a start to look in the log for your plugin for the exception, that might tell you more, and codewise, try and replace your code with the one I just gave you
So, I have now analyzed the Logs (Plex Media Server.log, com.myname.plugins.pluginnname), but I have not found an exceptions or something like that. Any idea?
2017-01-04 21:17:58,938 (700005d91000) : CRITICAL (init:19) - Exception happend in mycode: Accessing the media server’s HTTP interface is not permitted. (most recent call last):
File “/Users/xxx/Library/Application Support/Plex Media Server/Plug-ins/Recommendationizer.bundle/Contents/Code/init.py”, line 17, in Main
XML.ElementFromURL(‘http://127.0.0.1:32400/library/sections/’)
File “/Users/xxx/Applications/Plex Media Server.app/Contents/Resources/Plug-ins-b38628e/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/parsekit.py”, line 326, in ElementFromURL
raise Framework.exceptions.FrameworkException(“Accessing the media server’s HTTP interface is not permitted.”)
FrameworkException: Accessing the media server’s HTTP interface is not permitted.
With the error message from the log (FrameworkException: Accessing the media server’s HTTP interface is not permitted) I have found the solution for my problem. The problem is that the plugin has not “enough” right to access the HTTP interface functions from plex api. The solution is to add these parameters to the “Info.plist” file: