tv-anarchy/Sources/TVAnarchyCore/Quality.swift
Natalie 92b38b1bae refactor(tv-anarchy): rename PlumTV→TVAnarchy and land session work
Renames Sources/PlumTV→TVAnarchy and PlumTVCore→TVAnarchyCore (the rename
the auto-commit service couldn't stage — it git-add'd the old, now-gone
paths and aborted every cycle), and commits the accumulated work:

- Library: black-built index fast path (LibraryIndex + scanFromIndex) with
  NFS-walk fallback; incremental --add on download-complete; mtime staleness
  gate; loose-file series-collapse fix; determinate scan/index progress.
- Cover art: keyless TVmaze cartoon-vs-live-action disambiguation (type/year).
- Player: sleep timer (timed + end-of-episode); visibility-gated polling.
- Home: Continue Watching cover art + live refresh; Recently Added; adult gate.
- Logs: multi-line selection + copy; truncated giant tx-list errors.
- Hover previews (opt-in) via black ffmpeg + scp.

Also gitignores foreign project trees (governor/mcp/fleet/recommender) that
sit in this directory but belong to their own repos.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 22:04:22 -07:00

29 lines
1.3 KiB
Swift

import Foundation
/// One available release/quality of the currently-playing show (e.g. "1080p x265"
/// vs "720p x264"). Maps to `black-tv releases` JSON.
public struct Release: Decodable, Sendable, Equatable, Identifiable {
public let id: String // release directory basename
public let label: String // human label, e.g. "720p x264"
public let current: Bool
/// Resolved target file for the current episode in this release, and the
/// remaining episodes after it (so a generic switch preserves series
/// continuation, not just the single file). Optional the host's `releases`
/// command may omit them, in which case the app asks `resolveRelease`.
public let path: String?
public let tail: [String]?
}
/// What a host's `resolve-release` command returns for one release: the target
/// file at the current episode and the ordered remaining files.
public struct ResolvedRelease: Decodable, Sendable, Equatable {
public let path: String
public let tail: [String]
}
/// A target that can switch the current episode to a different release at the
/// same timestamp. Only black supports this (it owns mpv + the local library).
public protocol QualitySwitchable: AnyObject {
func releases() async -> [Release]
func switchRelease(_ id: String) async
}