REFACTOR for consistency
This commit is contained in:
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user