Newbie question : Can only add 1 VideoClipObject?

I'm trying to add two VideoClipObjects into an ObjectContainer. Only the first one shows up. If I reorder them then the first one on listed shows up. Can anyone help with this? I'm sure it's something simple...

 

Code follows:

 

def Start():
ObjectContainer.title1 = Folder_Name
ObjectContainer.art = R(ART)
DirectoryObject.thumb = R(ICON)
NextPageObject.thumb = R(ICON)
VideoClipObject.thumb = R(ICON)

@handler(’/video/folder’, ‘folder name’)
def MainMenu():

vcFoo = VideoClipObject()
vcFoo.title = 'foo'
vcFoo.url = '192.168.1.1'
vcFoo.art = R(ART)

vcBar = VideoClipObject()
vcBar.title = 'bar'
vcBar.url = '192.168.1.2'
vcBar.art = R(ART)

oc = ObjectContainer(
	objects =
	[
		vcFoo,
		vcBar
	]
					)
"""oc.add(vcFoo)"""
"""oc.add(vcBar)"""

return oc

 

Not exactly sure if there is a reason you are trying to set it up as you have. It looks like some of the older format for Plugins. But it would be better to set it up like this:

TITLE = 'Your Plugin Name'
PREFIX = '/video/yourpluginname'
ART = 'art-default.jpg'
ICON = 'icon-default.png'

def Start():
  ObjectContainer.title1 = TITLE
  ObjectContainer.art = R(ART)

@handler(PREFIX, TITLE, art=ART, thumb=ICON)
def MainMenu():
    oc = ObjectContainer()
    oc.add(VideoClipObject(title = 'foo', url = '192.168.1.1'))
    oc.add(VideoClipObject(title = 'bar', url = '192.168.1.2'))
    return oc

And then any later function would have a route like:

@route(PREFIX + '/yourfunctionname')
def YourFunctionName

If you are wanting to use those variables for something else within the MainMenu function, then just set up the variables before adding the VideoClipObject in the Main Menu section like this:

@handler(PREFIX, TITLE, art=ART, thumb=ICON)
def MainMenu():
    oc = ObjectContainer()
    title = 'foo'
    url = '192.168.1.1'
    title2 = 'bar'
    url2 = '192.168.1.2'
    oc.add(VideoClipObject(title = title, url = url))
    oc.add(VideoClipObject(title = title2, url = url2))
    return oc

Thanks for your help!

Seems the problem was that I had the same URL in both VideoClipObjects. It seems like that should work but maybe the Youtube serviec was choking on it?

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