Get title of selected directory

I have created a list of directory items that populates the objectcontainer but I now need to get the title of the directory that the client selects. Is there a way to do this?

 

 

for index in range(0, len(deviceName)):

 

dir.append(DirectoryObject(key = Callback(SubMenu), title=deviceName[index], thumb = R(ICON)))

oc = ObjectContainer(objects = dir)

return oc

 

 

Any help would be appreciated, Thanks

First off it looks like you are using an old example for your programming. The dir.append() is no longer used. You just define the object container and then use oc.add(). 

 oc = ObjectContainer()
 oc.add(DirectoryObject(key=Callback(Submenu, title="Title1", url=url), title="Title1", thumb=thumb))
 return oc

I am not sure what you mean by needing to get the title of which one the client selects. Each DirectoryObject you create is an option the client can choose. If the client chooses a specific title, it will execute the function listed in the Callback of the DirectoryObject that included that title. Based on which DirectoryObject they choose, the client will execute the function listed as the Callback in that DirectoryObject and send along any variables you have defined like a title and/or a URL. Each function will use any variables sent to it along with any other code you include to create a new list of DirectoryObject or media items choices(like VideoClipObject) to determine what the client will have the option to do next. 

The variables listed after the name of the function within the Callback parenthesis are sent on to the named function. And the variables listed after the closing parenthesis of the Callback, like a title and a thumb, are what the user will see on their screen as directory choices.

oc.add(DirectoryObject(
    key = Callback(
        FunctionName, 
        title="Title1",
        url=url
    ), 
    title="Title1"
    thumb=R(ICON)
))

The best examples of code are in the plexinc-plugins on Github. Those are channels that are in the Channel Directory and therefore tend to have the most up to date and cleanest code - https://github.com/plexinc-plugins.  

Also there are some great tutorials in the pinned topics at the top of the main section of this forum that can be very helpful. You should also reference the Framework documentation and this additional post giving updates for that documentation - https://forums.plex.tv/topic/87324-missing-from-the-official-plugin-documentation/

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