Skip to content

Commit

Permalink
Allow for caching of subscriptions API requests in My Subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed Dec 7, 2024
1 parent e918f21 commit eb70824
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions resources/lib/youtube_plugin/youtube/client/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,7 @@ def get_my_subscriptions(self,
logged_in=False,
do_filter=False,
refresh=False,
use_subscriptions_cache=False,
progress_dialog=None,
**kwargs):
"""
Expand Down Expand Up @@ -1625,11 +1626,19 @@ def _sort_by_date_time(item, limits):
'mine': True,
}

def _get_channels(output, _params=params):
json_data = self.api_request(method='GET',
path='subscriptions',
params=_params,
**kwargs)
def _get_channels(output,
_params=params,
_refresh=(refresh or not use_subscriptions_cache),
function_cache=self._context.get_function_cache()):
json_data = function_cache.run(
self.api_request,
function_cache.ONE_HOUR,
_refresh=_refresh,
method='GET',
path='subscriptions',
params=_params,
**kwargs
)
if not json_data:
return False, True

Expand Down

0 comments on commit eb70824

Please sign in to comment.