main.py
def list_videos(category):
    """
    Create the list of playable videos in the Kodi interface.

    :param category: Category name
    :type category: str
    """
    # Set plugin category. It is displayed in some skins as the name
    # of the current section.
    xbmcplugin.setPluginCategory(_HANDLE, category)
    # Set plugin content. It allows Kodi to select appropriate views
    # for this type of content.
    xbmcplugin.setContent(_HANDLE, 'videos')
    # Get the list of videos in the category.
    videos = get_videos(category)
    # Iterate through videos.
    for video in videos:
        # Create a list item with a text label and a thumbnail image.
        list_item = xbmcgui.ListItem(label=video['name'])
        # Set additional info for the list item.
        # 'mediatype' is needed for skin to display info for this ListItem correctly.
        list_item.setInfo('video', {'title': video['name'],
                                    'genre': video['genre'],
                                    'mediatype': 'video'})
        # Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
        # Here we use the same image for all items for simplicity's sake.
        # In a real-life plugin you need to set each image accordingly.
        list_item.setArt({'thumb': video['thumb'], 'icon': video['thumb'], 'fanart': video['thumb']})
        # Set 'IsPlayable' property to 'true'.
        # This is mandatory for playable items!
        list_item.setProperty('IsPlayable', 'true')
        # Create a URL for a plugin recursive call.
        # Example: plugin://plugin.video.example/?action=play&video=http://www.vidsplay.com/wp-content/uploads/2017/04/crab.mp4
        url = get_url(action='play', video=video['video'])
        # Add the list item to a virtual Kodi folder.
        # is_folder = False means that this item won't open any sub-list.
        is_folder = False
        # Add our item to the Kodi virtual folder listing.
        xbmcplugin.addDirectoryItem(_HANDLE, url, list_item, is_folder)
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    xbmcplugin.addSortMethod(_HANDLE, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_HANDLE)

    Create the list of playable videos in the Kodi interface.

    :param category: Category name
    :type category: str
    
Create the list of playable videos in the Kodi interface.
Create the list of playable videos in the Kodi interface .
def list_videos(category):
    xbmcplugin.setPluginCategory(_HANDLE, category)
    xbmcplugin.setContent(_HANDLE, 'videos')
    videos = get_videos(category)
    for video in videos:
        list_item = xbmcgui.ListItem(label=video['name'])
        list_item.setInfo('video', {'title': video['name'],
                                    'genre': video['genre'],
                                    'mediatype': 'video'})
        list_item.setArt({'thumb': video['thumb'], 'icon': video['thumb'], 'fanart': video['thumb']})
        list_item.setProperty('IsPlayable', 'true')
        url = get_url(action='play', video=video['video'])
        is_folder = False
        xbmcplugin.addDirectoryItem(_HANDLE, url, list_item, is_folder)
    xbmcplugin.addSortMethod(_HANDLE, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    xbmcplugin.endOfDirectory(_HANDLE)
def list_videos ( category ) : xbmcplugin . setPluginCategory ( _HANDLE , category ) xbmcplugin . setContent ( _HANDLE , 'videos' ) videos = get_videos ( category ) for video in videos : list_item = xbmcgui . ListItem ( label = video [ 'name' ] ) list_item . setInfo ( 'video' , { 'title' : video [ 'name' ] , 'genre' : video [ 'genre' ] , 'mediatype' : 'video' } ) list_item . setArt ( { 'thumb' : video [ 'thumb' ] , 'icon' : video [ 'thumb' ] , 'fanart' : video [ 'thumb' ] } ) list_item . setProperty ( 'IsPlayable' , 'true' ) url = get_url ( action = 'play' , video = video [ 'video' ] ) is_folder = False xbmcplugin . addDirectoryItem ( _HANDLE , url , list_item , is_folder ) xbmcplugin . addSortMethod ( _HANDLE , xbmcplugin . SORT_METHOD_LABEL_IGNORE_THE ) xbmcplugin . endOfDirectory ( _HANDLE )
Create the list of playable videos in the Kodi interface.
Create the list of playable videos in the Kodi interface .
"""
    Create the list of playable videos in the Kodi interface.

    :param category: Category name
    :type category: str
    """ # Set plugin category. It is displayed in some skins as the name # of the current section. # Set plugin content. It allows Kodi to select appropriate views # for this type of content. # Get the list of videos in the category. # Iterate through videos. # Create a list item with a text label and a thumbnail image. # Set additional info for the list item. # 'mediatype' is needed for skin to display info for this ListItem correctly. # Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item. # Here we use the same image for all items for simplicity's sake. # In a real-life plugin you need to set each image accordingly. # Set 'IsPlayable' property to 'true'. # This is mandatory for playable items! # Create a URL for a plugin recursive call. # Example: plugin://plugin.video.example/?action=play&video=http://www.vidsplay.com/wp-content/uploads/2017/04/crab.mp4 # Add the list item to a virtual Kodi folder. # is_folder = False means that this item won't open any sub-list. # Add our item to the Kodi virtual folder listing. # Add a sort method for the virtual folder items (alphabetically, ignore articles) # Finish creating a virtual folder.
category
None