Remove potential cast exception
Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
This commit is contained in:
@@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses meta data from video files using FFmpeg (http://ffmpeg.org/).
|
* Parses meta data from video files using FFmpeg (http://ffmpeg.org/).
|
||||||
@@ -77,12 +78,12 @@ public class FFmpegParser extends MetaDataParser {
|
|||||||
ffprobe = "ffprobe";
|
ffprobe = "ffprobe";
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> command = new ArrayList<>(FFPROBE_OPTIONS.length + 2);
|
List<String> command = new ArrayList<>();
|
||||||
command.add(ffprobe);
|
command.add(ffprobe);
|
||||||
command.addAll(Arrays.asList(FFPROBE_OPTIONS));
|
command.addAll(Arrays.asList(FFPROBE_OPTIONS));
|
||||||
command.add(file.getAbsolutePath());
|
command.add(file.getAbsolutePath());
|
||||||
|
|
||||||
Process process = Runtime.getRuntime().exec((String[])command.toArray());
|
Process process = Runtime.getRuntime().exec(command.toArray(new String[0]));
|
||||||
final JsonNode result = objectMapper.readTree(process.getInputStream());
|
final JsonNode result = objectMapper.readTree(process.getInputStream());
|
||||||
|
|
||||||
metaData.setDurationSeconds(result.at("/format/duration").asInt());
|
metaData.setDurationSeconds(result.at("/format/duration").asInt());
|
||||||
|
|||||||
Reference in New Issue
Block a user