WIP: Submit transcoding jobs via a HTTP API #6

Draft
ansv7779 wants to merge 22 commits from api-submission into master
Showing only changes of commit 96da213653 - Show all commits

View File

@ -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);
}