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