WIP: Submit transcoding jobs via a HTTP API #6
@ -65,21 +65,21 @@ public class TranscriptionService {
|
||||
Path jobFile = jobsDirectory.resolve(jobId + ".json");
|
||||
URI callbackUri = callbackUriGenerator.generateCallbackUri(jobId);
|
||||
|
||||
record Job(
|
||||
record WhisperJob(
|
||||
@JsonProperty("jobfile") String absolutePathToFileToBeTranscribed,
|
||||
@JsonProperty("outputformat") String outputFormat,
|
||||
@JsonProperty("origin") String origin,
|
||||
@JsonProperty("callback") String callbackUri)
|
||||
{
|
||||
}
|
||||
Job job = new Job(
|
||||
WhisperJob whisperJob = new WhisperJob(
|
||||
fileToBeTranscribed.toAbsolutePath().toString(),
|
||||
toWhisperFormat(transcription.outputFormat()),
|
||||
transcription.owner().getName(),
|
||||
callbackUri.toString());
|
||||
|
||||
try {
|
||||
objectMapper.writeValue(jobFile.toFile(), job);
|
||||
try (var out = Files.newOutputStream(jobFile, StandardOpenOption.CREATE_NEW)) {
|
||||
objectMapper.writeValue(out, whisperJob);
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user