REFACTOR for consistency

This commit is contained in:
2025-05-24 17:40:34 +02:00
parent 8fa6b11e70
commit ab645316a1
6 changed files with 35 additions and 36 deletions

View File

@@ -1,5 +1,6 @@
package com.ddf.vodsystem.services;
import com.ddf.vodsystem.entities.Job;
import com.ddf.vodsystem.entities.VideoMetadata;
import com.ddf.vodsystem.exceptions.FFMPEGException;
import com.fasterxml.jackson.databind.JsonNode;
@@ -21,6 +22,12 @@ import java.io.InputStreamReader;
public class MetadataService {
private static Logger logger = LoggerFactory.getLogger(MetadataService.class);
private final JobService jobService;
public MetadataService(JobService jobService) {
this.jobService = jobService;
}
public VideoMetadata getVideoMetadata(File file) {
logger.info("Getting metadata for file {}", file.getAbsolutePath());
@@ -45,6 +52,16 @@ public class MetadataService {
}
public VideoMetadata getInputFileMetadata(String uuid) {
Job job = jobService.getJob(uuid);
return getVideoMetadata(job.getInputFile());
}
public VideoMetadata getOutputFileMetadata(String uuid) {
Job job = jobService.getJob(uuid);
return getVideoMetadata(job.getOutputFile());
}
private JsonNode readStandardOutput(Process process) throws IOException{
// Read the standard output (JSON metadata)
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));