def _create_episode_item(seasonid, episodeid_value, episode, episodes_list, common_data): is_playable = episode['summary']['isPlayable'] episodeid = seasonid.derive_episode(episodeid_value) list_item = ListItemW(label=episode['title']) list_item.setProperties({ 'isPlayable': str(is_playable).lower(), 'nf_videoid': episodeid.to_string() }) add_info_list_item(list_item, episodeid, episode, episodes_list.data, False, common_data) set_watched_status(list_item, episode, common_data) if is_playable: url = common.build_url(videoid=episodeid, mode=G.MODE_PLAY, params=common_data['params']) list_item.addContextMenuItems( generate_context_menu_items(episodeid, False, None)) else: # The video is not playable, try check if there is a date list_item.setProperty('nf_availability_message', get_availability_message(episode)) url = common.build_url(['show_availability_message'], mode=G.MODE_ACTION) return url, list_item, False
def _create_episode_item(seasonid, episodeid_value, episode, episodes_list, common_data): is_playable = episode['summary']['isPlayable'] episodeid = seasonid.derive_episode(episodeid_value) dict_item = { 'video_id': episodeid_value, 'media_type': episodeid.mediatype if is_playable else None, 'label': episode['title'], 'is_folder': False, 'properties': { 'nf_videoid': episodeid.to_string() } } add_info_dict_item(dict_item, episodeid, episode, episodes_list.data, False, common_data) set_watched_status(dict_item, episode, common_data) if is_playable: dict_item['url'] = common.build_url(videoid=episodeid, mode=G.MODE_PLAY, params=common_data['params']) dict_item['menu_items'] = generate_context_menu_items( episodeid, False, None) else: # The video is not playable, try check if there is a date dict_item['properties'][ 'nf_availability_message'] = get_availability_message(episode) dict_item['url'] = common.build_url(['show_availability_message'], mode=G.MODE_ACTION) return dict_item
def _create_video_item(videoid_value, video, video_list, perpetual_range_start, common_data): is_playable = video['availability']['isPlayable'] videoid = common.VideoId.from_videolist_item(video) is_folder = videoid.mediatype == common.VideoId.SHOW is_in_mylist = videoid in common_data['mylist_items'] dict_item = {'video_id': videoid_value, 'media_type': videoid.mediatype if is_playable else None, 'label': video['title'], 'is_folder': is_folder, 'properties': {'nf_videoid': videoid.to_string(), 'nf_is_in_mylist': str(is_in_mylist), 'nf_perpetual_range_start': perpetual_range_start}} add_info_dict_item(dict_item, videoid, video, video_list.data, is_in_mylist, common_data) set_watched_status(dict_item, video, common_data) if is_playable: dict_item['url'] = common.build_url(videoid=videoid, mode=G.MODE_DIRECTORY if is_folder else G.MODE_PLAY, params=None if is_folder else common_data['params']) dict_item['menu_items'] = generate_context_menu_items(videoid, is_in_mylist, perpetual_range_start, common_data['ctxmenu_remove_watched_status']) else: # The video is not playable, try check if there is a date dict_item['properties']['nf_availability_message'] = get_availability_message(video) dict_item['url'] = common.build_url(['show_availability_message'], mode=G.MODE_ACTION) return dict_item
def _create_video_item(videoid_value, video, video_list, perpetual_range_start, common_data): videoid = common.VideoId.from_videolist_item(video) is_folder = videoid.mediatype == common.VideoId.SHOW is_in_mylist = videoid in common_data['mylist_items'] dict_item = { 'video_id': videoid_value, 'media_type': videoid.mediatype, 'label': video['title'], 'is_folder': is_folder, 'properties': { 'nf_videoid': videoid.to_string(), 'nf_is_in_mylist': str(is_in_mylist), 'nf_perpetual_range_start': perpetual_range_start } } add_info_dict_item(dict_item, videoid, video, video_list.data, is_in_mylist, common_data) set_watched_status(dict_item, video, common_data) dict_item['art'] = get_art(videoid, video, common_data['profile_language_code']) dict_item['url'] = common.build_url( videoid=videoid, mode=G.MODE_DIRECTORY if is_folder else G.MODE_PLAY, params=None if is_folder else common_data['params']) dict_item['menu_items'] = generate_context_menu_items( videoid, is_in_mylist, perpetual_range_start, common_data['ctxmenu_remove_watched_status']) return dict_item
def _create_video_item(videoid_value, video, video_list, perpetual_range_start, common_data): # pylint: disable=unused-argument videoid = common.VideoId.from_videolist_item(video) is_folder = videoid.mediatype == common.VideoId.SHOW is_playable = video['availability']['isPlayable'] is_video_playable = not is_folder and is_playable is_in_mylist = videoid in common_data['mylist_items'] list_item = ListItemW(label=video['title']) list_item.setProperties({ 'isPlayable': str(is_video_playable).lower(), 'nf_videoid': videoid.to_string(), 'nf_is_in_mylist': str(is_in_mylist), 'nf_perpetual_range_start': str(perpetual_range_start) }) add_info_list_item(list_item, videoid, video, video_list.data, is_in_mylist, common_data) if not is_folder: set_watched_status(list_item, video, common_data) if is_playable: # The movie or tvshow (episodes) is playable url = common.build_url( videoid=videoid, mode=G.MODE_DIRECTORY if is_folder else G.MODE_PLAY, params=None if is_folder else common_data['params']) list_item.addContextMenuItems( generate_context_menu_items( videoid, is_in_mylist, perpetual_range_start, common_data['ctxmenu_remove_watched_status'])) else: # The movie or tvshow (episodes) is not available # Try check if there is a availability date list_item.setProperty('nf_availability_message', get_availability_message(video)) # Check if the user has set "Remind Me" feature, try: # Due to the add-on cache we can not change in easy way the value stored in database cache, # then we temporary override the value (see 'remind_me' in navigation/actions.py) is_in_remind_me = G.CACHE.get(CACHE_BOOKMARKS, f'is_in_remind_me_{videoid}') except CacheMiss: # The website check the "Remind Me" value on key "inRemindMeList" and also "queue"/"inQueue" is_in_remind_me = video['inRemindMeList'] or video['queue'][ 'inQueue'] trackid = video['trackIds']['trackId_jaw'] list_item.addContextMenuItems( generate_context_menu_remind_me(videoid, is_in_remind_me, trackid)) url = common.build_url(['show_availability_message'], videoid=videoid, mode=G.MODE_ACTION) return url, list_item, is_folder and is_playable
def _create_episode_item(seasonid, episodeid_value, episode, episodes_list, common_data): episodeid = seasonid.derive_episode(episodeid_value) dict_item = {'video_id': episodeid_value, 'media_type': episodeid.mediatype, 'title': episode['title'], 'is_folder': False} add_info_dict_item(dict_item, episodeid, episode, episodes_list.data, False, common_data) set_watched_status(dict_item, episode, common_data) dict_item['art'] = get_art(episodeid, episode, common_data['profile_language_code']) dict_item['url'] = common.build_url(videoid=episodeid, mode=g.MODE_PLAY, params=common_data['params']) dict_item['menu_items'] = generate_context_menu_items(episodeid, False, None) return dict_item
def _create_video_item(videoid_value, video, video_list, perpetual_range_start, common_data): videoid = common.VideoId.from_videolist_item(video) is_folder = videoid.mediatype == common.VideoId.SHOW is_in_mylist = videoid in common_data['mylist_items'] dict_item = {'video_id': videoid_value, 'media_type': videoid.mediatype, 'title': video['title'], 'is_folder': is_folder} add_info_dict_item(dict_item, videoid, video, video_list.data, is_in_mylist, common_data) set_watched_status(dict_item, video, common_data) dict_item['art'] = get_art(videoid, video, common_data['profile_language_code']) dict_item['url'] = common.build_url(videoid=videoid, mode=g.MODE_DIRECTORY if is_folder else g.MODE_PLAY, params=common_data['params']) dict_item['menu_items'] = generate_context_menu_items(videoid, is_in_mylist, perpetual_range_start) return dict_item
def _create_episode_item(seasonid, episodeid_value, episode, episodes_list, common_data): episodeid = seasonid.derive_episode(episodeid_value) dict_item = { 'video_id': episodeid_value, 'media_type': episodeid.mediatype, 'label': episode['title'], 'is_folder': False, 'properties': { 'nf_videoid': episodeid.to_string() } } add_info_dict_item(dict_item, episodeid, episode, episodes_list.data, False, common_data) set_watched_status(dict_item, episode, common_data) dict_item['url'] = common.build_url(videoid=episodeid, mode=G.MODE_PLAY, params=common_data['params']) dict_item['menu_items'] = generate_context_menu_items( episodeid, False, None) return dict_item
def _create_video_item(videoid_value, video, video_list, perpetual_range_start, common_data): # pylint: disable=unused-argument videoid = common.VideoId.from_videolist_item(video) is_folder = videoid.mediatype == common.VideoId.SHOW is_playable = video['availability']['isPlayable'] is_video_playable = not is_folder and is_playable is_in_mylist = videoid in common_data['mylist_items'] list_item = ListItemW(label=video['title']) list_item.setProperties({ 'isPlayable': str(is_video_playable).lower(), 'nf_videoid': videoid.to_string(), 'nf_is_in_mylist': str(is_in_mylist), 'nf_perpetual_range_start': str(perpetual_range_start) }) add_info_list_item(list_item, videoid, video, video_list.data, is_in_mylist, common_data) if not is_folder: set_watched_status(list_item, video, common_data) if is_playable: url = common.build_url( videoid=videoid, mode=G.MODE_DIRECTORY if is_folder else G.MODE_PLAY, params=None if is_folder else common_data['params']) list_item.addContextMenuItems( generate_context_menu_items( videoid, is_in_mylist, perpetual_range_start, common_data['ctxmenu_remove_watched_status'])) else: # The video is not playable, try check if there is a date list_item.setProperty('nf_availability_message', get_availability_message(video)) url = common.build_url(['show_availability_message'], mode=G.MODE_ACTION) return url, list_item, is_folder and is_playable