30 lines
1.5 KiB
Swift
30 lines
1.5 KiB
Swift
import Foundation
|
|
|
|
/// What to start playing — always a concrete file path. The library knows the exact
|
|
/// file for every episode / movie / resume target, so playback NEVER asks a host to
|
|
/// re-resolve a show by name (that missed merged multi-folder shows — e.g. Daria S3
|
|
/// living in a separate "Season 3" folder). Black plays the path via `black-tv
|
|
/// play`; VLC opens it directly.
|
|
public enum LaunchRequest: Sendable, Equatable {
|
|
case file(path: String)
|
|
}
|
|
|
|
/// A target that can begin playback of library content (not just drive transport
|
|
/// on whatever's already loaded). black via the `black-tv` script; VLC via HTTP.
|
|
public protocol MediaLaunchable: AnyObject {
|
|
/// Returns whether playback was successfully started, so the UI can surface a
|
|
/// failure (unreachable host / unopenable file) instead of silently no-op-ing.
|
|
@discardableResult
|
|
func launch(_ request: LaunchRequest) async -> Bool
|
|
}
|
|
|
|
/// A target whose backend keeps a real playlist we can load several files into —
|
|
/// so the app can fire an auto/built play queue, not just one file. `replace:
|
|
/// true` starts a fresh playlist on the first item and plays it; the rest (and
|
|
/// everything when `replace: false`) append. Paths are plum-side; the target
|
|
/// translates to its own host paths. mpv: batched `loadfile replace/append` in
|
|
/// one IPC round-trip; VLC: `pl_empty` + `in_play`/`in_enqueue`.
|
|
public protocol Enqueueable: AnyObject {
|
|
@discardableResult
|
|
func enqueue(_ paths: [String], replace: Bool) async -> Bool
|
|
}
|