Skip to content

Commit

Permalink
Allow default thumbnail selection fallbacks for results from YouTube …
Browse files Browse the repository at this point in the history
…Data API v3
  • Loading branch information
MoojMidge committed Sep 21, 2024
1 parent 553ed33 commit 4f2dc2e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion resources/lib/youtube_plugin/youtube/helper/tv.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def saved_playlists_to_items(provider, context, json_data):
title = item['title']
channel_id = item['channel_id']
playlist_id = item['id']
image = utils.get_thumbnail(thumb_size, item.get('thumbnails', {}))
image = utils.get_thumbnail(thumb_size, item.get('thumbnails'))

if channel_id:
item_uri = context.create_uri(
Expand Down
8 changes: 4 additions & 4 deletions resources/lib/youtube_plugin/youtube/helper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def update_channel_infos(provider, context, channel_id_dict,
channel_item.set_name(title)

# image
image = get_thumbnail(thumb_size, snippet.get('thumbnails', {}))
image = get_thumbnail(thumb_size, snippet.get('thumbnails'))
channel_item.set_image(image)

# - update context menu
Expand Down Expand Up @@ -288,7 +288,7 @@ def update_playlist_infos(provider, context, playlist_id_dict,
title = snippet['title']
playlist_item.set_name(title)

image = get_thumbnail(thumb_size, snippet.get('thumbnails', {}))
image = get_thumbnail(thumb_size, snippet.get('thumbnails'))
playlist_item.set_image(image)

channel_id = 'mine' if in_my_playlists else snippet['channelId']
Expand Down Expand Up @@ -655,7 +655,7 @@ def update_video_infos(provider, context, video_id_dict,
# try to find a better resolution for the image
image = media_item.get_image()
if not image:
image = get_thumbnail(thumb_size, snippet.get('thumbnails', {}))
image = get_thumbnail(thumb_size, snippet.get('thumbnails'))
if image.endswith('_live.jpg'):
image = ''.join((image, '?ct=', thumb_stamp))
media_item.set_image(image)
Expand Down Expand Up @@ -849,7 +849,7 @@ def update_play_info(provider, context, video_id, media_item, video_stream,
media_item.live = meta_data.get('status', {}).get('live', False)
media_item.set_subtitles(meta_data.get('subtitles', None))
image = get_thumbnail(settings.get_thumbnail_size(),
meta_data.get('thumbnails', {}))
meta_data.get('thumbnails'))
if image:
if media_item.live:
image = ''.join((image, '?ct=', get_thumb_timestamp()))
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/youtube_plugin/youtube/helper/v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _process_list_response(provider, context, json_data, item_filter):
title = snippet.get('title', context.localize('untitled'))

thumbnails = snippet.get('thumbnails')
if not thumbnails and yt_item.get('_partial'):
if not thumbnails:
thumbnails = {
thumb_type: {
'url': thumb['url'].format(item_id, ''),
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/youtube_plugin/youtube/helper/yt_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def _process_select_playlist(provider, context):
snippet = playlist.get('snippet', {})
title = snippet.get('title', '')
description = snippet.get('description', '')
thumbnail = get_thumbnail(thumb_size, snippet.get('thumbnails', {}))
thumbnail = get_thumbnail(thumb_size, snippet.get('thumbnails'))
playlist_id = playlist.get('id', '')
if title and playlist_id:
items.append((
Expand Down

0 comments on commit 4f2dc2e

Please sign in to comment.