diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index 93148d9..583ad53 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -238,7 +238,7 @@ def MySubscriptions(offset=None): @route(PREFIX + '/video/view') def VideoView(vid): return URLService.MetadataObjectForURL( - url=Video.GetServiceURL(vid, Dict['access_token']), + url=Video.GetServiceURL(vid, Dict['access_token'], GetLanguage()), in_container=True ) diff --git a/Contents/Info.plist b/Contents/Info.plist index 587a572..4472aa9 100644 --- a/Contents/Info.plist +++ b/Contents/Info.plist @@ -14,7 +14,7 @@ CFBundleSignature hook CFBundleVersion - 2.8 + 2.9 PlexPluginVersionUrl https://api.github.com/repos/kolsys/YouTubeTV.bundle/releases/latest diff --git a/Contents/Services/Shared Code/video.pys b/Contents/Services/Shared Code/video.pys index 741aba5..1974edc 100644 --- a/Contents/Services/Shared Code/video.pys +++ b/Contents/Services/Shared Code/video.pys @@ -45,11 +45,13 @@ USER_AGENT = ( ) -def GetServiceURL(vid, token=''): - return 'http://tv.youtube.plugins.plex.com/%s%s%s' % ( +def GetServiceURL(vid, token='', hl=''): + return 'http://tv.youtube.plugins.plex.com/%s%s%s%s%s' % ( vid, '&access_token=' if token else '', - token + token, + '&hl=' if hl else '', + hl ) @@ -144,6 +146,14 @@ def GetUrlFromStream(item): return ret +def GetFromMainContent(item, key): + try: + cont = item['video_main_content']['contents'][0] + return cont[key]['runs'][0]['text'] + except: + return '' + + def CalculateOffset(position): ''' Workaround for YT bug diff --git a/Contents/Services/URL/YouTubeTV/ServiceCode.pys b/Contents/Services/URL/YouTubeTV/ServiceCode.pys index 130283d..f6d1c67 100644 --- a/Contents/Services/URL/YouTubeTV/ServiceCode.pys +++ b/Contents/Services/URL/YouTubeTV/ServiceCode.pys @@ -125,13 +125,21 @@ def MetadataObjectForURL(url): if thumb[0] == '/': thumb = 'http:%s' % thumb + try: + summary = u'%s\n%s' % ( + item['video']['public_name'], + item['video']['description'] + ) + except: + summary = u'%s\n%s' % ( + Video.GetFromMainContent(item, 'short_byline_text'), + Video.GetFromMainContent(item, 'description'), + ) + return VideoClipObject( title=u'%s' % item['video']['title'], rating_key=url.split('&')[0], - summary=u'%s\n%s' % ( - item['video']['public_name'], - item['video']['description'] - ), + summary=summary, thumb=thumb, rating=(float(meta['avg_rating'])*2), tags=meta['keywords'].split(','),