Untitled
unknown
python
6 months ago
1.7 kB
2
Indexable
for item in api_res['data']: source = API.get_source(item) media_type = source.get('info_labels', {}).get('mediatype') has_watched = False if media_type == MEDIA_TYPE.TV_SHOW: episode_id = self.watch_history_service.get_next_item_id(item['_id']) episode_detail, _ = self.api_request(HTTP_METHOD.GET, API.URL.media_detail(episode_id)) item['_source']['info_labels']['season'] = episode_detail['info_labels']['season'] item['_source']['info_labels']['episode'] = episode_detail['info_labels']['episode'] trakt_id = source.get('services', {}).get("trakt") if trakt_id: db_item = DB.TRAKT_LIST_ITEMS.get_from_list(TRAKT_LIST.WATCHED, MEDIA_TYPE.TV_SHOW, trakt_id) has_watched = db_item and db_item[3] # if not has_watched: # watched_count = len(DB.TRAKT_LIST_ITEMS.get_show(trakt_id, MEDIA_TYPE.EPISODE)) # watched_count = watched_count + source.get('children_count', 0) # if watched_count == source.get("total_children_count", 0): # has_watched = True if not has_watched: items.append(item) api_res['data'] = items self.render_media(handle, route, api_res, title_renderer=MediaInfoRenderer.TITLE.mixed, render_type=RENDER_TYPE.PLAY_NEXT)
Editor is loading...
Leave a Comment