KodiConnector

public final class KodiConnector : ObservableObject

The Observable Class that provides the connection with a remote host (SwiftlyKodi Type)

Constants and Variables

  • The shared instance of this KodiConnector class

    Declaration

    Swift

    public static let shared: KodiConnector
  • The host properties

    Declaration

    Swift

    public var properties: Application.Property.Value
  • Bool if the host is scanning content

    Note

    Used to stop Notifications and Library updates or else the Host and the KodiConnector get nuts

    Declaration

    Swift

    public var scanningLibrary: Bool

Published properties

  • The status of the KodiConnector class

    Declaration

    Swift

    @Published
    public var status: Status { get set }
  • The remote host to make a connection

    Declaration

    Swift

    @Published
    public var host: HostItem { get set }
  • The library on the Kodi host

    Declaration

    Swift

    @Published
    public var library: Library.Items { get set }
  • The host settings

    Declaration

    Swift

    @Published
    public var settings: [Setting.Details.KodiSetting] { get set }
  • The addons

    Declaration

    Swift

    public var addons: [Addon.Details]
  • The favourites

    Declaration

    Swift

    @Published
    public var favourites: [any KodiItem] { get set }
  • The online hosts

    Declaration

    Swift

    @Published
    public var bonjourHosts: [BonjourHost] { get set }
  • The configured hosts

    Declaration

    Swift

    @Published
    public var configuredHosts: [HostItem] { get set }

Bonjour

  • Struct for a Kodi host found by the Bonjour browser

    See more

    Declaration

    Swift

    struct BonjourHost : Equatable, Hashable, Identifiable

Connecting and loading functions

  • Get the last selected host, if any, and try connect to it

    Declaration

    Swift

    public func getSelectedHost()
  • Connect to a specifiv host

    Declaration

    Swift

    public func connect(host: HostItem)

    Parameters

    host

    The configured HostItem

  • loadLibrary(cache:) Asynchronous

    Load the library

    Declaration

    Swift

    @MainActor
    public func loadLibrary(cache: Bool = true) async

    Parameters

    cache

    Bool if it should try to load the library from the cache

Favourites

  • getFavourites() Asynchronous

    Get Favourites

    Note

    Only ‘real’ media’ is supported

    Declaration

    Swift

    public func getFavourites() async -> [any KodiItem]

    Return Value

    All ‘media’ favourites

  • Get a Kodi Setting

    Declaration

    Swift

    public func getKodiSetting(id: Setting.ID) -> KodiSetting

    Parameters

    id

    The ID of the setting

    Return Value

    The setting values

  • Simplified struct for a kodi setting

    See more

    Declaration

    Swift

    public struct KodiSetting

Connection status

  • Set the state of the KodiConnector and act on it

    Declaration

    Swift

    @MainActor
    public func setStatus(_ current: Status)
  • The status of the KodiConnector

    See more

    Declaration

    Swift

    public enum Status
  • Get the audio library updates

    Declaration

    Swift

    @MainActor
    public func getAudioLibraryUpdates() async