tv-anarchy/Sources/TVAnarchyCore/VLCConfig.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

19 lines
764 B
Swift

import Foundation
/// Resolves VLC's HTTP password: `$VLC_HTTP_PASSWORD` first, else the
/// portable-net-tv config that already holds it.
public enum VLCConfig {
public static func password() -> String {
if let env = ProcessInfo.processInfo.environment["VLC_HTTP_PASSWORD"], !env.isEmpty {
return env
}
let path = (("~/.config/portable-net-tv/config.json") as NSString).expandingTildeInPath
guard let data = FileManager.default.contents(atPath: path),
let obj = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
let vlc = obj["vlcHttp"] as? [String: Any],
let pw = vlc["password"] as? String else {
return ""
}
return pw
}
}