Need help with removing short clips from channel, please

This is a Disney Junior channel (script below) made by sander1 (Thanks, btw). It’s great but with one issue. It not only display the full TV episodes but also the annoying 1-3 minute promos. I’m trying to weed out all the short clips and only display the full length shows. I’ve tried to do it myself (knowing no python, Surprise… I failed). Can someone please help me?

PLUGIN_PREFIX = ‘/video/disneyjunior’
NAME = ‘Disney Junior’
JSON_URL = ‘http://disneyjunior.disney.com/_grill/json/
SHOWS_URL = JSON_URL + ‘video’
ICON = ‘icon-default.jpg’
ART = ‘art-default.jpg’

####################################################################################################
def Start():

ObjectContainer.title1 = NAME

####################################################################################################
@handler(PLUGIN_PREFIX, NAME, thumb=ICON, art=ART)
def MainMenu():

return Shows()

####################################################################################################
@route(PLUGIN_PREFIX + ‘/shows’)
def Shows():

oc = ObjectContainer()
json_obj = JSON.ObjectFromURL(SHOWS_URL)

for show in json_obj['stack'][0]['data']:

	title = show['title']
	thumb = show['thumb']
	slug = show['slug']

	oc.add(DirectoryObject(
		key = Callback(Videos, title=title, thumb=thumb, slug=slug),
		title = title,
		thumb = Resource.ContentsOfURLWithFallback(thumb)
	))

return oc

####################################################################################################
@route(PLUGIN_PREFIX + ‘/videos’)
def Videos(title, thumb, slug):

oc = ObjectContainer(title2=title)
json_obj = JSON.ObjectFromURL(JSON_URL + slug)

for group in json_obj['stack']:

	if group['type'] == 'video':

		for clip in group['data']:


			if 'live stream' in clip['title'].lower():
				continue


			title = clip['title']
			summary = clip['description'] if 'description' in clip else None
			thumb = clip['thumb']

			try:
				duration = int(clip['duration_sec'])*1000
			except:
				duration = None

			url = clip['href']

			if not url.startswith('http://'):
				url = 'http://disneyjunior.com%s' % (url)

			oc.add(VideoClipObject(
				url = url,
				title = title,
				summary = summary,
				duration = duration,
				thumb = Resource.ContentsOfURLWithFallback(thumb)
			))

return oc

The script got messed up in my first post here it is as an attachment.

I just looked at the original code. There may be something in the json files sent to the Videos() function that can help you only choose videos are full episodes.

If there is not determining json code, you can just use a duration statement to only choose videos that are longer than a specific length. I did this with a NBC Universal json file for a Bravo plugin, so it would pull full episodes and web series clips that were 5 minutes or longer.

This is the code I used - github.com/shopgirl284/Bravo.bundle/blob/master/Contents/Code/init.py#L49.

For all items in the “for” loop, if an item meets the criteria in the “if” statement, the “continue” will stop and go to the next item in that “for” loop .

BTW, I also use this json editor to make the json easier toread - jsoneditoronline.org/#