Skip to content

Commit

Permalink
- Fix crash on get thumbnail url in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
kolsys committed Jan 21, 2017
1 parent 484c898 commit 51b45c5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ def AddItemsFromDescription(oc, description):
oc.add(DirectoryObject(
key=Callback(VideoInfo, vid=ext_vid),
title=u'[*] %s' % ext_title,
thumb='https://i.ytimg.com/vi/%s/hqdefault.jpg' % ext_vid
thumb=Video.GetThumb(ext_vid)
))

return oc
Expand Down
2 changes: 1 addition & 1 deletion Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<key>CFBundleSignature</key>
<string>hook</string>
<key>CFBundleVersion</key>
<string>4.4</string>
<string>4.5</string>

<key>PlexPluginVersionUrl</key>
<string>http://bit.ly/1FuE3dz</string>
Expand Down
4 changes: 4 additions & 0 deletions Contents/Services/Shared Code/video.pys
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def GetMetaUrlByServiceURL(url):
return 'https://www.youtube.com/watch?v=%s' % GetOID(url)


def GetThumb(vid):
return 'https://i.ytimg.com/vi/%s/hqdefault.jpg' % vid


def GetVideoData(url):
try:
res = HTML.ElementFromURL(GetMetaUrlByServiceURL(url))
Expand Down
6 changes: 1 addition & 5 deletions Contents/Services/URL/YouTubeTV/ServiceCode.pys
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,14 @@ def MetadataObjectForURL(url):
if not meta:
raise Ex.MediaNotAvailable

thumb = meta['iurl']
if thumb[0] == '/':
thumb = 'http:%s' % thumb

return VideoClipObject(
title=u'%s' % meta['title'],
rating_key=url.split('&')[0],
summary=u'%s\n%s' % (
meta['author'],
item['description'] if 'description' in item else '',
),
thumb=thumb,
thumb=Video.GetThumb(meta['video_id']),
rating=(float(meta['avg_rating'])*2),
tags=meta['keywords'].split(','),
duration=int(meta['length_seconds'])*1000 if meta['length_seconds'] else None,
Expand Down

0 comments on commit 51b45c5

Please sign in to comment.