feat: play resolved Miruro HLS with external VTT and stable episode progress
This commit is contained in:
@@ -4,22 +4,25 @@ enum PlayerCommand {
|
||||
case help
|
||||
case printDefaultConfig
|
||||
case launch(URL?, newInstance: Bool, noConfig: Bool, progressFile: URL?)
|
||||
case launchSource(sourceFile: URL, newInstance: Bool, noConfig: Bool, progressFile: URL?)
|
||||
|
||||
static let usage = """
|
||||
Usage: terebi [--new-instance] [--no-config] [FILE | YOUTUBE_URL]
|
||||
terebi [--new-instance] [--no-config] --url YOUTUBE_URL
|
||||
terebi --new-instance --url YOUTUBE_URL --progress-file PATH
|
||||
terebi --new-instance --source-file PATH [--progress-file PATH]
|
||||
terebi [--new-instance] [--no-config] -- FILE
|
||||
terebi --help
|
||||
terebi --default-config
|
||||
|
||||
Open one local media file or YouTube video and start playback, resuming saved
|
||||
video progress when available. With no arguments, open or activate the player.
|
||||
Open one local file, YouTube video or resolved source and start playback,
|
||||
resuming saved video progress. With no arguments, open or activate the player.
|
||||
Quote paths and URLs containing spaces or shell metacharacters.
|
||||
|
||||
--new-instance Launch a separate player, leaving existing playback untouched.
|
||||
--no-config Use built-in settings instead of config.toml on a fresh launch.
|
||||
--url URL Open a YouTube video URL.
|
||||
--source-file PATH Open a validated resolved HTTP(S) source in a new player.
|
||||
--progress-file PATH Write JSONL playback facts to a new private file; requires
|
||||
--new-instance. The GUI owns reporting after this CLI exits.
|
||||
-- Treat the following argument as a filename, even with a leading '-'.
|
||||
@@ -77,6 +80,19 @@ enum PlayerCommand {
|
||||
guard progressFile == nil else { throw ArgumentError("--progress-file cannot be combined with --default-config.") }
|
||||
return .printDefaultConfig
|
||||
}
|
||||
if inputs.first == "--source-file" {
|
||||
guard newInstance else { throw ArgumentError("--source-file requires --new-instance.") }
|
||||
guard inputs.count == 2, !inputs[1].isEmpty, !inputs[1].contains("\0"),
|
||||
!inputs[1].hasPrefix("--") else {
|
||||
throw ArgumentError("--source-file requires exactly one filesystem path.")
|
||||
}
|
||||
let base = directory.hasDirectoryPath ? directory :
|
||||
URL(fileURLWithPath: directory.path, isDirectory: true)
|
||||
let sourceFile = URL(fileURLWithPath: inputs[1], relativeTo: base).absoluteURL.standardizedFileURL
|
||||
_ = try ResolvedSource.load(from: sourceFile)
|
||||
return .launchSource(sourceFile: sourceFile, newInstance: newInstance,
|
||||
noConfig: noConfig, progressFile: progressFile)
|
||||
}
|
||||
if inputs.first == "--url" {
|
||||
guard inputs.count == 2 else { throw ArgumentError("--url requires exactly one YouTube URL.") }
|
||||
return try launch(YouTubeResolver.validateURL(inputs[1]))
|
||||
|
||||
Reference in New Issue
Block a user