Files

public enum Files

Shares information & filesystem listings (Kodi Namespace & Kodi Global Type)

  • The kind of media for Files (Global Kodi Type)

    See more

    Declaration

    Swift

    enum Media : String, Codable, Sendable
  • The type of media; either an image or a file (SwiftlyKodi Type)

    Note

    This enum is used to convert an internal Kodi path to a full path
    See more

    Declaration

    Swift

    enum MediaType : String
  • The properties of a file (SwiftlyKodi Type)

    See more

    Declaration

    Swift

    enum Property
  • Get the directories and files in the given directory (Kodi API)

    Declaration

    Swift

    public static func getDirectory(directory: String, media: Files.Media) async -> [List.Item.File]

    Parameters

    directory

    The directory we want to receive

    media

    The kind of Media we want to receive

    Return Value

    All items received in a File array

  • Convert an internal Kodi path to a full path (SwiftlyKodi API)

    Kodi does not store the full path of a file in the database; it must be converted to a full path

    Note

    Because of performance, I do’t use ‘Files.prepareDownload’ here

    Declaration

    Swift

    public static func getFullPath(file: String, type: Files.MediaType) -> String

    Parameters

    file

    The internal Kodi path

    type

    The MediaType; an image or a file

    Return Value

    A string with the full path to the file

  • prepareDownload(path:) Asynchronous

    Provides a way to download a given file (Kodi API)

    Declaration

    Swift

    public static func prepareDownload(path: String) async -> Files.Property.Value

    Parameters

    path

    The internal Kodi path of the file

    Return Value

    The properties of the file