Skip to content

Commit

Permalink
Merge pull request #826 from anxdpanic/pr
Browse files Browse the repository at this point in the history
fixup recommendations with > 50 channels
  • Loading branch information
anxdpanic authored May 13, 2020
2 parents 520e37b + 0900e98 commit 284c7d1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.youtube" name="YouTube" version="6.8.1" provider-name="anxdpanic, bromix">
<addon id="plugin.video.youtube" name="YouTube" version="6.8.2" provider-name="anxdpanic, bromix">
<requires>
<import addon="xbmc.python" version="2.20.0"/>
<import addon="script.module.six" version="1.11.0"/>
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
6.8.2
[fixup] recommendations with > 50 channels

6.8.1
[fix] playback failing
[fix] viewing comments when logged in
Expand Down
13 changes: 11 additions & 2 deletions resources/lib/youtube_plugin/youtube/helper/resource_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())))

Expand Down

0 comments on commit 284c7d1

Please sign in to comment.