use of com.peterphi.std.system.exec.Exec in project stdlib by petergeneric.
the class MediaInfoCommand method inspect.
public MediaInfo inspect(File mediafile) throws IOException {
log.debug("Retrieving mediainfo output for " + mediafile.getAbsolutePath());
if (!mediafile.exists())
throw new IllegalArgumentException("Media file " + mediafile + " does not exist!");
Exec exec = new Exec(mediainfo.getAbsolutePath(), "--output=XML", "--full", mediafile.getAbsolutePath());
final Execed process = exec.start();
final Deadline timeOut = new Deadline(Timeout.ONE_MINUTE);
final int result = process.waitForExit(timeOut);
if (result == 0) {
return parse(process.getStandardOut());
} else {
throw new IOException("MediaInfo failed with non-zero code: " + result);
}
}
Aggregations