*/
public void setOutputParsing(final DLNAResource dlna, ProcessWrapperImpl pw, boolean force) {
if (configuration.isResumeEnabled() && dlna.getMedia() != null) {
long duration = force ? 0 : (long) dlna.getMedia().getDurationInSeconds();
if (duration == 0 || duration == DLNAMediaInfo.TRANS_SIZE) {
OutputTextLogger ffParser = new OutputTextLogger(null, pw) {
@Override
public boolean filter(String line) {
if (reDuration.reset(line).find()) {
String d = reDuration.group(1);
LOGGER.trace("[{}] setting duration: {}", ID, d);
dlna.getMedia().setDuration(convertStringToTime(d));
return false; // done, stop filtering
}
return true; // keep filtering
}
};
ffParser.setFiltered(true);
pw.setStderrConsumer(ffParser);
}
}
}