From 0900e98f4187826d49d5de397b795504a403fe4f Mon Sep 17 00:00:00 2001 From: anxdpanic Date: Wed, 13 May 2020 14:42:30 -0400 Subject: [PATCH] fixup recommendations with > 50 channels --- addon.xml | 2 +- changelog.txt | 3 +++ .../youtube/helper/resource_manager.py | 13 +++++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/addon.xml b/addon.xml index 2c78811d..2879b42e 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index 70c69742..7e9a17f7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +6.8.2 +[fixup] recommendations with > 50 channels + 6.8.1 [fix] playback failing [fix] viewing comments when logged in diff --git a/resources/lib/youtube_plugin/youtube/helper/resource_manager.py b/resources/lib/youtube_plugin/youtube/helper/resource_manager.py index f2622b3f..17b06257 100644 --- a/resources/lib/youtube_plugin/youtube/helper/resource_manager.py +++ b/resources/lib/youtube_plugin/youtube/helper/resource_manager.py @@ -74,13 +74,22 @@ def _update_channels(self, channel_ids): if len(channel_ids_to_update) > 0: self._context.log_debug('No data for channels |%s| cached' % ', '.join(channel_ids_to_update)) - json_data = self._youtube_client.get_channels(channel_ids_to_update) + + data = [] + list_of_50s = self._make_list_of_50(channel_ids_to_update) + for list_of_50 in list_of_50s: + data.append(self._youtube_client.get_channels(list_of_50)) + channel_data = dict() - yt_items = json_data.get('items', []) + yt_items = [] + for response in data: + yt_items += response.get('items', []) + for yt_item in yt_items: channel_id = str(yt_item['id']) channel_data[channel_id] = yt_item result[channel_id] = yt_item + data_cache.set_all(channel_data) self._context.log_debug('Cached data for channels |%s|' % ', '.join(list(channel_data.keys())))