Skip to content

Commit

Permalink
don't show Ultra as kids items
Browse files Browse the repository at this point in the history
  • Loading branch information
TermeHansen committed Mar 18, 2024
1 parent 80eb080 commit 3cf86a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion resources/lib/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,10 @@ def route(self, query):
seasons = PARAMS.get('seasons', 'False') == 'True'
if PARAMS['listVideos'].startswith('ID_'):
items = self.api.get_list(PARAMS['listVideos'], PARAMS['list_param'])
self.listEpisodes(self.api.unfold_list(items, filter_kids=bool_setting('disable.kids')))
filter_kids = bool_setting('disable.kids')
if 'Ultra' in items['title']:
filter_kids = False
self.listEpisodes(self.api.unfold_list(items, filter_kids=filter_kids))
else:
self.list_entries(PARAMS['listVideos'], seasons)

Expand Down
11 changes: 8 additions & 3 deletions resources/lib/tvapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,16 @@ def get_list(self, id, param, use_cache=True):
data = {'page_size': '24'}
if param != 'NoParam':
data['param'] = param
return self._request_get(url, params=data, use_cache=use_cache)
ret = self._request_get(url, params=data, use_cache=use_cache)
if len(ret['items']) == 0:
ret = self.get_recommendations(id, use_cache=use_cache, param=param)
return ret

def get_recommendations(self, id, use_cache=True):
def get_recommendations(self, id, use_cache=True, param=[]):
url = URL + f'/recommendations/{id}'
data = {'page_size': '24'}
if param:
data['param'] = param
headers = {"X-Authorization": f'Bearer {self.profile_token()}'}
return self._request_get(url, params=data, headers=headers, use_cache=use_cache)

Expand Down Expand Up @@ -357,7 +362,7 @@ def kids_item(self, item):
if item['classification']['code'] in ['DR-Ramasjang', 'DR-Minisjang']:
return True
if 'categories' in item:
for cat in ['dr minisjang', 'dr ramasjang', 'dr ultra']:
for cat in ['dr minisjang', 'dr ramasjang']:
if cat in item['categories']:
return True
return False
Expand Down

0 comments on commit 3cf86a0

Please sign in to comment.