示例#1
0
def _create_profile_item(profile_guid, is_selected, is_autoselect, is_library_playback, detailed_info):
    profile_name = G.LOCAL_DB.get_profile_config('profileName', '???', guid=profile_guid)

    profile_attributes = []
    if G.LOCAL_DB.get_profile_config('isPinLocked', False, guid=profile_guid):
        profile_attributes.append('[COLOR red]' + common.get_local_string(20068) + '[/COLOR]')
    if G.LOCAL_DB.get_profile_config('isAccountOwner', False, guid=profile_guid):
        profile_attributes.append(common.get_local_string(30221))
    if G.LOCAL_DB.get_profile_config('isKids', False, guid=profile_guid):
        profile_attributes.append(common.get_local_string(30222))
    if is_autoselect and detailed_info:
        profile_attributes.append(common.get_local_string(30054))
    if is_library_playback and detailed_info:
        profile_attributes.append(common.get_local_string(30051))
    attributes_desc = '[CR]'.join(profile_attributes) + '[CR]' if profile_attributes else ''
    description = attributes_desc + '[' + G.LOCAL_DB.get_profile_config('language_desc', '', guid=profile_guid) + ']'

    if detailed_info:
        menu_items = generate_context_menu_profile(profile_guid, is_autoselect, is_library_playback)
    else:
        menu_items = []
    dict_item = {
        'label': profile_name,
        'properties': {'nf_guid': profile_guid, 'nf_description': description.replace('[CR]', ' - ')},
        'art': {'icon': G.LOCAL_DB.get_profile_config('avatar', '', guid=profile_guid)},
        'info': {'plot': description},  # The description
        'is_selected': is_selected,
        'menu_items': menu_items,
        'url': common.build_url(pathitems=['home'],
                                params={'switch_profile_guid': profile_guid},
                                mode=G.MODE_DIRECTORY),
        'is_folder': True
    }
    return dict_item
示例#2
0
def _create_profile_item(profile_guid, is_selected, is_autoselect, is_library_playback, detailed_info):
    profile_name = G.LOCAL_DB.get_profile_config('profileName', '???', guid=profile_guid)
    profile_attributes = []
    if G.LOCAL_DB.get_profile_config('isPinLocked', False, guid=profile_guid):
        profile_attributes.append('[COLOR red]' + common.get_local_string(20068) + '[/COLOR]')
    if G.LOCAL_DB.get_profile_config('isAccountOwner', False, guid=profile_guid):
        profile_attributes.append(common.get_local_string(30221))
    if G.LOCAL_DB.get_profile_config('isKids', False, guid=profile_guid):
        profile_attributes.append(common.get_local_string(30222))
    if is_autoselect and detailed_info:
        profile_attributes.append(common.get_local_string(30054))
    if is_library_playback and detailed_info:
        profile_attributes.append(common.get_local_string(30051))
    attributes_desc = '[CR]'.join(profile_attributes) + '[CR]' if profile_attributes else ''
    description = attributes_desc + '[' + G.LOCAL_DB.get_profile_config('language_desc', '', guid=profile_guid) + ']'

    if detailed_info:
        menu_items = generate_context_menu_profile(profile_guid, is_autoselect, is_library_playback)
    else:
        menu_items = []
    list_item = ListItemW(label=profile_name)
    list_item.setProperties({
        'nf_guid': profile_guid,
        'nf_description': description.replace('[CR]', ' - ')
    })
    list_item.setArt({'icon': G.LOCAL_DB.get_profile_config('avatar', '', guid=profile_guid)})
    list_item.setInfo('video', {'plot': description})
    list_item.select(is_selected)
    list_item.addContextMenuItems(menu_items)
    return (common.build_url(pathitems=['home'], params={'switch_profile_guid': profile_guid}, mode=G.MODE_DIRECTORY),
            list_item,
            True)