Skip to content

Commit

Permalink
Add icon to bundle; check multiple thumbnails.
Browse files Browse the repository at this point in the history
  • Loading branch information
sander1 committed Sep 28, 2017
1 parent 72021f0 commit 934ed55
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 18 deletions.
46 changes: 33 additions & 13 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ def ShowPage(title, thumb):

oc = ObjectContainer(title2=title)

oc.add(DirectoryObject(key=Callback(VideoPage, type='Episode', title=title), title='Full Episodes',
thumb=Resource.ContentsOfURLWithFallback(url=thumb, fallback=ICON)
oc.add(DirectoryObject(
key = Callback(VideoPage, type='Episode', title=title),
title = 'Full Episodes',
thumb = Resource.ContentsOfURLWithFallback(url=thumb, fallback=ICON)
))

oc.add(DirectoryObject(key=Callback(VideoPage, type='Clip', title=title), title='Clips',
thumb=Resource.ContentsOfURLWithFallback(url=thumb, fallback=ICON)
oc.add(DirectoryObject(
key = Callback(VideoPage, type='Clip', title=title),
title = 'Clips',
thumb = Resource.ContentsOfURLWithFallback(url=thumb, fallback=ICON)
))

return oc
Expand All @@ -76,22 +80,38 @@ def VideoPage(type, title, start=0):
try: duration = item['videos']['iphone']['length']
except: duration = None

try: thumb = item['images']['originalres_16x9']['url']
except:
try: thumb = item['images']['originalres_4x3']['url']
except: thumb = ''
thumb = ''
images = ['kids-mezzannine-16x9', 'originalres_16x9', 'kids-mezzannine-4x3', 'originalres_4x3']

for img in images:
if img in item['images'] and 'url' in item['images'][img] and item['images'][img]['url']:
thumb = item['images'][img]['url']
break

if type == 'Clip':
oc.add(VideoClipObject(url=url, title=video_title, summary=summary, duration=duration,
thumb=Resource.ContentsOfURLWithFallback(url=thumb, fallback=ICON)
oc.add(VideoClipObject(
url = url,
title = video_title,
summary = summary,
duration = duration,
thumb = Resource.ContentsOfURLWithFallback(url=thumb, fallback=ICON)
))
else:
oc.add(EpisodeObject(url=url, title=video_title, show=title, summary=summary, duration=duration,
thumb=Resource.ContentsOfURLWithFallback(url=thumb, fallback=ICON)
oc.add(EpisodeObject(
url = url,
title = video_title,
show = title,
summary = summary,
duration = duration,
thumb = Resource.ContentsOfURLWithFallback(url=thumb, fallback=ICON)
))

if int(json_obj['matched']) > end:
oc.add(NextPageObject(key=Callback(VideoPage, type=type, title=title, start=end), title='More ...'))

oc.add(NextPageObject(
key = Callback(VideoPage, type=type, title=title, start=end),
title = 'More ...'
))

if len(oc) < 1:
return ObjectContainer(header='Empty', message="There aren't any items")
Expand Down
15 changes: 10 additions & 5 deletions Contents/Services/URL/PBS Kids/ServiceCode.pys
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ def MetadataObjectForURL(url):

title = details['title']
summary = details['description']
duration = details['videos']['ipad']['length']

try: thumb = details['images']['originalres_16x9']['url']
except:
try: thumb = details['images']['originalres_4x3']['url']
except: thumb = ''
try: duration = details['videos']['iphone']['length']
except: duration = None

thumb = ''
images = ['kids-mezzannine-16x9', 'originalres_16x9', 'kids-mezzannine-4x3', 'originalres_4x3']

for img in images:
if img in details['images'] and 'url' in details['images'][img] and details['images'][img]['url']:
thumb = details['images'][img]['url']
break

if details['type'] =='Clip':
return VideoClipObject(
Expand Down

0 comments on commit 934ed55

Please sign in to comment.