Package net.pms.io

Examples of net.pms.io.OutputTextLogger


    } else if (dlna.getMedia().isFFmpegparsed()) {
      return;
    }
    final ArrayList<String> lines = new ArrayList<>();
    final String input = filename.length() > 200 ? filename.substring(0, 199) : filename;
    OutputTextLogger ffParser = new OutputTextLogger(null, pw) {
      @Override
      public boolean filter(String line) {
        if (endOfHeader.reset(line).find()) {
          dlna.getMedia().parseFFmpegInfo(lines, input);
          LOGGER.trace("[{}] parsed media from headers: {}", ID, dlna.getMedia());
          dlna.getParent().updateChild(dlna);
          return false; // done, stop filtering
        }
        lines.add(line);
        return true; // keep filtering
      }
    };
    ffParser.setFiltered(true);
    pw.setStderrConsumer(ffParser);
  }
View Full Code Here


   */
  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);
      }
    }
  }
View Full Code Here

TOP

Related Classes of net.pms.io.OutputTextLogger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.