feat: report authoritative playback progress from shared backend
This commit is contained in:
@@ -17,7 +17,16 @@ enum TerebiCLI {
|
||||
print(PlayerCommand.usage)
|
||||
case .printDefaultConfig:
|
||||
print(PlayerConfiguration.defaultTOML, terminator: "")
|
||||
case .launch(let url, let newInstance, let noConfig):
|
||||
case .launch(let url, let newInstance, let noConfig, let progressFile):
|
||||
if let progressFile {
|
||||
var existing = stat()
|
||||
guard lstat(progressFile.path, &existing) != 0 else {
|
||||
fail("Progress file already exists: \(progressFile.path). Supply a nonexistent destination.", code: 73)
|
||||
}
|
||||
guard errno == ENOENT else {
|
||||
fail("Could not inspect progress file \(progressFile.path): \(String(cString: strerror(errno))).", code: 73)
|
||||
}
|
||||
}
|
||||
let configURL = PlayerConfiguration.fileURL(environment: ProcessInfo.processInfo.environment,
|
||||
homeDirectory: FileManager.default.homeDirectoryForCurrentUser)
|
||||
if !noConfig {
|
||||
@@ -39,6 +48,9 @@ enum TerebiCLI {
|
||||
configuration.createsNewApplicationInstance = newInstance
|
||||
// LaunchServices does not inherit the invoking shell's XDG environment.
|
||||
configuration.arguments = noConfig ? ["--no-config"] : ["--config-file", configURL.absoluteString]
|
||||
if let progressFile {
|
||||
configuration.arguments += ["--progress-file", progressFile.path]
|
||||
}
|
||||
if newInstance, let url {
|
||||
configuration.arguments += ["--open-media", url.absoluteString]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user