Program: 47291
Project: 47291
Buggy source:
public void parse(InputFile f,Format ext,int type,boolean thumbOnly){
  int i=0;
  while (isParsing()) {
    if (i == 5) {
      setMediaparsed(true);
      break;
    }
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
    }
    i++;
  }
  if (isMediaparsed()) {
    return;
  }
  if (f != null) {
    if (f.getFile() != null) {
      setSize(f.getFile().length());
    }
 else {
      setSize(f.getSize());
    }
    ProcessWrapperImpl pw=null;
    boolean ffmpeg_parsing=true;
    if (type == Format.AUDIO || ext instanceof AudioAsVideo) {
      ffmpeg_parsing=false;
      DLNAMediaAudio audio=new DLNAMediaAudio();
      if (f.getFile() != null) {
        try {
          AudioFile af=AudioFileIO.read(f.getFile());
          AudioHeader ah=af.getAudioHeader();
          if (ah != null && !thumbOnly) {
            int length=ah.getTrackLength();
            int rate=ah.getSampleRateAsNumber();
            if (ah.getEncodingType().toLowerCase().contains("String_Node_Str")) {
              audio.setBitsperSample(24);
            }
            audio.setSampleFrequency("String_Node_Str" + rate);
            setDuration((double)length);
            setBitrate((int)ah.getBitRateAsNumber());
            audio.getAudioProperties().setNumberOfChannels(2);
            if (ah.getChannels() != null && ah.getChannels().toLowerCase().contains("String_Node_Str")) {
              audio.getAudioProperties().setNumberOfChannels(1);
            }
 else             if (ah.getChannels() != null && ah.getChannels().toLowerCase().contains("String_Node_Str")) {
              audio.getAudioProperties().setNumberOfChannels(2);
            }
 else             if (ah.getChannels() != null) {
              audio.getAudioProperties().setNumberOfChannels(Integer.parseInt(ah.getChannels()));
            }
            audio.setCodecA(ah.getEncodingType().toLowerCase());
            if (audio.getCodecA().contains("String_Node_Str")) {
              audio.setCodecA(audio.getCodecA().substring(0,audio.getCodecA().indexOf("String_Node_Str")).trim());
            }
          }
          Tag t=af.getTag();
          if (t != null) {
            if (t.getArtworkList().size() > 0) {
              setThumb(t.getArtworkList().get(0).getBinaryData());
            }
 else {
              if (PMS.getConfiguration().getAudioThumbnailMethod() > 0) {
                setThumb(CoverUtil.get().getThumbnailFromArtistAlbum(PMS.getConfiguration().getAudioThumbnailMethod() == 1 ? CoverUtil.AUDIO_AMAZON : CoverUtil.AUDIO_DISCOGS,audio.getArtist(),audio.getAlbum()));
              }
            }
            if (!thumbOnly) {
              audio.setAlbum(t.getFirst(FieldKey.ALBUM));
              audio.setArtist(t.getFirst(FieldKey.ARTIST));
              audio.setSongname(t.getFirst(FieldKey.TITLE));
              String y=t.getFirst(FieldKey.YEAR);
              try {
                if (y.length() > 4) {
                  y=y.substring(0,4);
                }
                audio.setYear(Integer.parseInt(((y != null && y.length() > 0) ? y : "String_Node_Str")));
                y=t.getFirst(FieldKey.TRACK);
                audio.setTrack(Integer.parseInt(((y != null && y.length() > 0) ? y : "String_Node_Str")));
                audio.setGenre(t.getFirst(FieldKey.GENRE));
              }
 catch (              Throwable e) {
                LOGGER.debug("String_Node_Str" + e.getMessage());
              }
            }
          }
        }
 catch (        Throwable e) {
          LOGGER.debug("String_Node_Str" + e.getMessage() + "String_Node_Str"+ (e.getCause() != null ? e.getCause().getMessage() : "String_Node_Str"));
          ffmpeg_parsing=false;
        }
        if (audio.getSongname() == null || audio.getSongname().length() == 0) {
          audio.setSongname(f.getFile().getName());
        }
        if (!ffmpeg_parsing) {
          getAudioTracksList().add(audio);
        }
      }
    }
    if (type == Format.IMAGE && f.getFile() != null) {
      try {
        ffmpeg_parsing=false;
        ImageInfo info=Sanselan.getImageInfo(f.getFile());
        setWidth(info.getWidth());
        setHeight(info.getHeight());
        setBitsPerPixel(info.getBitsPerPixel());
        String formatName=info.getFormatName();
        if (formatName.startsWith("String_Node_Str")) {
          setCodecV("String_Node_Str");
          IImageMetadata meta=Sanselan.getMetadata(f.getFile());
          if (meta != null && meta instanceof JpegImageMetadata) {
            JpegImageMetadata jpegmeta=(JpegImageMetadata)meta;
            TiffField tf=jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_MODEL);
            if (tf != null) {
              setModel(tf.getStringValue().trim());
            }
            tf=jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_EXPOSURE_TIME);
            if (tf != null) {
              setExposure((int)(1000 * tf.getDoubleValue()));
            }
            tf=jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_ORIENTATION);
            if (tf != null) {
              setOrientation(tf.getIntValue());
            }
            tf=jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_ISO);
            if (tf != null) {
              setIso(tf.getIntValue());
            }
          }
        }
 else         if (formatName.startsWith("String_Node_Str")) {
          setCodecV("String_Node_Str");
        }
 else         if (formatName.startsWith("String_Node_Str")) {
          setCodecV("String_Node_Str");
        }
 else         if (formatName.startsWith("String_Node_Str")) {
          setCodecV("String_Node_Str");
        }
        setContainer(getCodecV());
      }
 catch (      Throwable e) {
        LOGGER.info("String_Node_Str" + e.getMessage());
      }
      try {
        if (PMS.getConfiguration().getImageThumbnailsEnabled()) {
          File thumbDir=new File(PMS.getConfiguration().getTempFolder() + "String_Node_Str");
          if (!thumbDir.exists() && !thumbDir.mkdirs()) {
            LOGGER.debug("String_Node_Str" + thumbDir.getAbsolutePath() + "String_Node_Str");
          }
 else {
            String thumbFilename=thumbDir + f.getFile().getName() + "String_Node_Str";
            LOGGER.trace("String_Node_Str" + thumbFilename + "String_Node_Str");
            final Builder<File> thumbnail=Thumbnails.of(f.getFile());
            thumbnail.size(320,180);
            thumbnail.outputFormat("String_Node_Str");
            thumbnail.outputQuality(1.0f);
            thumbnail.toFile(thumbFilename);
            File jpg=new File(thumbFilename);
            if (jpg.exists()) {
              InputStream is=new FileInputStream(jpg);
              int sz=is.available();
              if (sz > 0) {
                setThumb(new byte[sz]);
                is.read(getThumb());
              }
              is.close();
              if (!jpg.delete()) {
                jpg.deleteOnExit();
              }
            }
          }
        }
      }
 catch (      Exception e) {
        LOGGER.info("String_Node_Str",e);
      }
    }
    if (ffmpeg_parsing) {
      if (!thumbOnly || !PMS.getConfiguration().isUseMplayerForVideoThumbs()) {
        pw=getFFMpegThumbnail(f);
      }
      String input="String_Node_Str";
      boolean dvrms=false;
      if (f.getFile() != null) {
        input=ProcessUtil.getShortFileNameIfWideChars(f.getFile().getAbsolutePath());
        dvrms=f.getFile().getAbsolutePath().toLowerCase().endsWith("String_Node_Str");
      }
      if (!ffmpeg_failure && !thumbOnly) {
        if (input.equals("String_Node_Str")) {
          input="String_Node_Str";
        }
        boolean matchs=false;
        ArrayList<String> lines=(ArrayList<String>)pw.getResults();
        int langId=0;
        int subId=0;
        ListIterator<String> FFmpegMetaData=lines.listIterator();
        for (        String line : lines) {
          FFmpegMetaData.next();
          line=line.trim();
          if (line.startsWith("String_Node_Str")) {
            matchs=false;
          }
 else           if (line.startsWith("String_Node_Str")) {
            if (line.indexOf(input) > -1) {
              matchs=true;
              setContainer(line.substring(10,line.indexOf("String_Node_Str",11)).trim());
            }
 else {
              matchs=false;
            }
          }
 else           if (matchs) {
            if (line.indexOf("String_Node_Str") > -1) {
              StringTokenizer st=new StringTokenizer(line,"String_Node_Str");
              while (st.hasMoreTokens()) {
                String token=st.nextToken().trim();
                if (token.startsWith("String_Node_Str")) {
                  String durationStr=token.substring(10);
                  int l=durationStr.substring(durationStr.indexOf("String_Node_Str") + 1).length();
                  if (l < 4) {
                    durationStr=durationStr + "String_Node_Str".substring(0,3 - l);
                  }
                  if (durationStr.indexOf("String_Node_Str") > -1) {
                    setDuration(null);
                  }
 else {
                    setDuration(parseDurationString(durationStr));
                  }
                }
 else                 if (token.startsWith("String_Node_Str")) {
                  String bitr=token.substring(9);
                  int spacepos=bitr.indexOf("String_Node_Str");
                  if (spacepos > -1) {
                    String value=bitr.substring(0,spacepos);
                    String unit=bitr.substring(spacepos + 1);
                    setBitrate(Integer.parseInt(value));
                    if (unit.equals("String_Node_Str")) {
                      setBitrate(1024 * getBitrate());
                    }
                    if (unit.equals("String_Node_Str")) {
                      setBitrate(1048576 * getBitrate());
                    }
                  }
                }
              }
            }
 else             if (line.indexOf("String_Node_Str") > -1) {
              StringTokenizer st=new StringTokenizer(line,"String_Node_Str");
              int a=line.indexOf("String_Node_Str");
              int b=line.indexOf("String_Node_Str",a);
              DLNAMediaAudio audio=new DLNAMediaAudio();
              audio.setId(langId++);
              if (a > -1 && b > a) {
                audio.setLang(line.substring(a + 1,b));
              }
 else {
                audio.setLang(DLNAMediaLang.UND);
              }
              a=line.indexOf("String_Node_Str");
              b=line.indexOf("String_Node_Str",a);
              if (a > -1 && b > a + 3) {
                String idString=line.substring(a + 3,b);
                try {
                  audio.setId(Integer.parseInt(idString,16));
                }
 catch (                NumberFormatException nfe) {
                  LOGGER.debug("String_Node_Str" + idString);
                }
              }
              while (st.hasMoreTokens()) {
                String token=st.nextToken().trim();
                if (token.startsWith("String_Node_Str")) {
                  audio.setCodecA(token.substring(token.indexOf("String_Node_Str") + 7));
                }
 else                 if (token.endsWith("String_Node_Str")) {
                  audio.setSampleFrequency(token.substring(0,token.indexOf("String_Node_Str")).trim());
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(1);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(2);
                }
 else                 if (token.equals("String_Node_Str") || token.equals("String_Node_Str") || token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(6);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(5);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(4);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(2);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.setBitsperSample(32);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.setBitsperSample(24);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.setBitsperSample(16);
                }
              }
              int FFmpegMetaDataNr=FFmpegMetaData.nextIndex();
              if (FFmpegMetaDataNr > -1) {
                line=lines.get(FFmpegMetaDataNr);
              }
              if (line.indexOf("String_Node_Str") > -1) {
                FFmpegMetaDataNr=FFmpegMetaDataNr + 1;
                line=lines.get(FFmpegMetaDataNr);
                while (line.indexOf("String_Node_Str") == 0) {
                  if (line.toLowerCase().indexOf("String_Node_Str") > -1) {
                    int aa=line.indexOf("String_Node_Str");
                    int bb=line.length();
                    if (aa > -1 && bb > aa) {
                      audio.setFlavor(line.substring(aa + 2,bb));
                      break;
                    }
                  }
 else {
                    FFmpegMetaDataNr=FFmpegMetaDataNr + 1;
                    line=lines.get(FFmpegMetaDataNr);
                  }
                }
              }
              getAudioTracksList().add(audio);
            }
 else             if (line.indexOf("String_Node_Str") > -1) {
              StringTokenizer st=new StringTokenizer(line,"String_Node_Str");
              while (st.hasMoreTokens()) {
                String token=st.nextToken().trim();
                if (token.startsWith("String_Node_Str")) {
                  setCodecV(token.substring(token.indexOf("String_Node_Str") + 7));
                }
 else                 if ((token.indexOf("String_Node_Str") > -1 || token.indexOf("String_Node_Str") > -1)) {
                  String frameRateDoubleString=token.substring(0,token.indexOf("String_Node_Str")).trim();
                  try {
                    if (!frameRateDoubleString.equals(getFrameRate())) {
                      Double frameRateDouble=Double.parseDouble(frameRateDoubleString);
                      setFrameRate(String.format(Locale.ENGLISH,"String_Node_Str",frameRateDouble / 2));
                    }
                  }
 catch (                  NumberFormatException nfe) {
                    LOGGER.debug("String_Node_Str" + frameRateDoubleString + "String_Node_Str");
                  }
                }
 else                 if ((token.indexOf("String_Node_Str") > -1 || token.indexOf("String_Node_Str") > -1) && getFrameRate() == null) {
                  setFrameRate(token.substring(0,token.indexOf("String_Node_Str")).trim());
                }
 else                 if ((token.indexOf("String_Node_Str") > -1 || token.indexOf("String_Node_Str") > -1) && getFrameRate() == null) {
                  setFrameRate(token.substring(0,token.indexOf("String_Node_Str")).trim());
                }
 else                 if (token.indexOf("String_Node_Str") > -1) {
                  String resolution=token.trim();
                  if (resolution.indexOf("String_Node_Str") > -1) {
                    resolution=resolution.substring(0,resolution.indexOf("String_Node_Str"));
                  }
                  try {
                    setWidth(Integer.parseInt(resolution.substring(0,resolution.indexOf("String_Node_Str"))));
                  }
 catch (                  NumberFormatException nfe) {
                    LOGGER.debug("String_Node_Str" + resolution.substring(0,resolution.indexOf("String_Node_Str")) + "String_Node_Str");
                  }
                  try {
                    setHeight(Integer.parseInt(resolution.substring(resolution.indexOf("String_Node_Str") + 1)));
                  }
 catch (                  NumberFormatException nfe) {
                    LOGGER.debug("String_Node_Str" + resolution.substring(resolution.indexOf("String_Node_Str") + 1) + "String_Node_Str");
                  }
                }
              }
            }
 else             if (line.indexOf("String_Node_Str") > -1 && !line.contains("String_Node_Str")) {
              DLNAMediaSubtitle lang=new DLNAMediaSubtitle();
              lang.setType((line.contains("String_Node_Str") && Platform.isWindows() ? SubtitleType.VOBSUB : SubtitleType.UNKNOWN));
              int a=line.indexOf("String_Node_Str");
              int b=line.indexOf("String_Node_Str",a);
              if (a > -1 && b > a) {
                lang.setLang(line.substring(a + 1,b));
              }
 else {
                lang.setLang(DLNAMediaLang.UND);
              }
              lang.setId(subId++);
              int FFmpegMetaDataNr=FFmpegMetaData.nextIndex();
              if (FFmpegMetaDataNr > -1) {
                line=lines.get(FFmpegMetaDataNr);
              }
              if (line.indexOf("String_Node_Str") > -1) {
                FFmpegMetaDataNr=FFmpegMetaDataNr + 1;
                line=lines.get(FFmpegMetaDataNr);
                while (line.indexOf("String_Node_Str") == 0) {
                  if (line.toLowerCase().indexOf("String_Node_Str") > -1) {
                    int aa=line.indexOf("String_Node_Str");
                    int bb=line.length();
                    if (aa > -1 && bb > aa) {
                      lang.setFlavor(line.substring(aa + 2,bb));
                      break;
                    }
                  }
 else {
                    FFmpegMetaDataNr=FFmpegMetaDataNr + 1;
                    line=lines.get(FFmpegMetaDataNr);
                  }
                }
              }
              getSubtitleTracksList().add(lang);
            }
          }
        }
      }
      if (!thumbOnly && getContainer() != null && f.getFile() != null && getContainer().equals("String_Node_Str") && isH264() && getDurationInSeconds() == 0) {
        try {
          int length=MpegUtil.getDurationFromMpeg(f.getFile());
          if (length > 0) {
            setDuration((double)length);
          }
        }
 catch (        IOException e) {
          LOGGER.trace("String_Node_Str" + e.getMessage());
        }
      }
      if (PMS.getConfiguration().isUseMplayerForVideoThumbs() && type == Format.VIDEO && !dvrms) {
        try {
          getMplayerThumbnail(f);
          String frameName="String_Node_Str" + f.hashCode();
          frameName=PMS.getConfiguration().getTempFolder() + "String_Node_Str" + frameName+ "String_Node_Str";
          frameName=frameName.replace(',','_');
          File jpg=new File(frameName);
          if (jpg.exists()) {
            InputStream is=new FileInputStream(jpg);
            int sz=is.available();
            if (sz > 0) {
              setThumb(new byte[sz]);
              is.read(getThumb());
            }
            is.close();
            if (!jpg.delete()) {
              jpg.deleteOnExit();
            }
            if (!jpg.getParentFile().delete() && !jpg.getParentFile().delete()) {
              LOGGER.debug("String_Node_Str" + jpg.getParentFile().getAbsolutePath() + "String_Node_Str");
            }
          }
        }
 catch (        IOException e) {
          LOGGER.debug("String_Node_Str",e);
        }
      }
      if (type == Format.VIDEO && pw != null && getThumb() == null) {
        InputStream is;
        try {
          is=pw.getInputStream(0);
          int sz=is.available();
          if (sz > 0) {
            setThumb(new byte[sz]);
            is.read(getThumb());
          }
          is.close();
          if (sz > 0 && !java.awt.GraphicsEnvironment.isHeadless()) {
            BufferedImage image=ImageIO.read(new ByteArrayInputStream(getThumb()));
            if (image != null) {
              Graphics g=image.getGraphics();
              g.setColor(Color.WHITE);
              g.setFont(new Font("String_Node_Str",Font.PLAIN,14));
              int low=0;
              if (getWidth() > 0) {
                if (getWidth() == 1920 || getWidth() == 1440) {
                  g.drawString("String_Node_Str",0,low+=18);
                }
 else                 if (getWidth() == 1280) {
                  g.drawString("String_Node_Str",0,low+=18);
                }
              }
              ByteArrayOutputStream out=new ByteArrayOutputStream();
              ImageIO.write(image,"String_Node_Str",out);
              setThumb(out.toByteArray());
            }
          }
        }
 catch (        IOException e) {
          LOGGER.debug("String_Node_Str" + e.getMessage());
        }
      }
    }
    finalize(type,f);
    setMediaparsed(true);
  }
}

Fixed version (ground truth):
public void parse(InputFile f,Format ext,int type,boolean thumbOnly){
  int i=0;
  while (isParsing()) {
    if (i == 5) {
      setMediaparsed(true);
      break;
    }
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
    }
    i++;
  }
  if (isMediaparsed()) {
    return;
  }
  if (f != null) {
    if (f.getFile() != null) {
      setSize(f.getFile().length());
    }
 else {
      setSize(f.getSize());
    }
    ProcessWrapperImpl pw=null;
    boolean ffmpeg_parsing=true;
    if (type == Format.AUDIO || ext instanceof AudioAsVideo) {
      ffmpeg_parsing=false;
      DLNAMediaAudio audio=new DLNAMediaAudio();
      if (f.getFile() != null) {
        try {
          AudioFile af=AudioFileIO.read(f.getFile());
          AudioHeader ah=af.getAudioHeader();
          if (ah != null && !thumbOnly) {
            int length=ah.getTrackLength();
            int rate=ah.getSampleRateAsNumber();
            if (ah.getEncodingType().toLowerCase().contains("String_Node_Str")) {
              audio.setBitsperSample(24);
            }
            audio.setSampleFrequency("String_Node_Str" + rate);
            setDuration((double)length);
            setBitrate((int)ah.getBitRateAsNumber());
            audio.getAudioProperties().setNumberOfChannels(2);
            if (ah.getChannels() != null && ah.getChannels().toLowerCase().contains("String_Node_Str")) {
              audio.getAudioProperties().setNumberOfChannels(1);
            }
 else             if (ah.getChannels() != null && ah.getChannels().toLowerCase().contains("String_Node_Str")) {
              audio.getAudioProperties().setNumberOfChannels(2);
            }
 else             if (ah.getChannels() != null) {
              audio.getAudioProperties().setNumberOfChannels(Integer.parseInt(ah.getChannels()));
            }
            audio.setCodecA(ah.getEncodingType().toLowerCase());
            if (audio.getCodecA().contains("String_Node_Str")) {
              audio.setCodecA(audio.getCodecA().substring(0,audio.getCodecA().indexOf("String_Node_Str")).trim());
            }
          }
          Tag t=af.getTag();
          if (t != null) {
            if (t.getArtworkList().size() > 0) {
              setThumb(t.getArtworkList().get(0).getBinaryData());
            }
 else {
              if (PMS.getConfiguration().getAudioThumbnailMethod() > 0) {
                setThumb(CoverUtil.get().getThumbnailFromArtistAlbum(PMS.getConfiguration().getAudioThumbnailMethod() == 1 ? CoverUtil.AUDIO_AMAZON : CoverUtil.AUDIO_DISCOGS,audio.getArtist(),audio.getAlbum()));
              }
            }
            if (!thumbOnly) {
              audio.setAlbum(t.getFirst(FieldKey.ALBUM));
              audio.setArtist(t.getFirst(FieldKey.ARTIST));
              audio.setSongname(t.getFirst(FieldKey.TITLE));
              String y=t.getFirst(FieldKey.YEAR);
              try {
                if (y.length() > 4) {
                  y=y.substring(0,4);
                }
                audio.setYear(Integer.parseInt(((y != null && y.length() > 0) ? y : "String_Node_Str")));
                y=t.getFirst(FieldKey.TRACK);
                audio.setTrack(Integer.parseInt(((y != null && y.length() > 0) ? y : "String_Node_Str")));
                audio.setGenre(t.getFirst(FieldKey.GENRE));
              }
 catch (              Throwable e) {
                LOGGER.debug("String_Node_Str" + e.getMessage());
              }
            }
          }
        }
 catch (        Throwable e) {
          LOGGER.debug("String_Node_Str" + e.getMessage() + "String_Node_Str"+ (e.getCause() != null ? e.getCause().getMessage() : "String_Node_Str"));
          ffmpeg_parsing=false;
        }
        if (audio.getSongname() == null || audio.getSongname().length() == 0) {
          audio.setSongname(f.getFile().getName());
        }
        if (!ffmpeg_parsing) {
          getAudioTracksList().add(audio);
        }
      }
    }
    if (type == Format.IMAGE && f.getFile() != null) {
      try {
        ffmpeg_parsing=false;
        ImageInfo info=Sanselan.getImageInfo(f.getFile());
        setWidth(info.getWidth());
        setHeight(info.getHeight());
        setBitsPerPixel(info.getBitsPerPixel());
        String formatName=info.getFormatName();
        if (formatName.startsWith("String_Node_Str")) {
          setCodecV("String_Node_Str");
          IImageMetadata meta=Sanselan.getMetadata(f.getFile());
          if (meta != null && meta instanceof JpegImageMetadata) {
            JpegImageMetadata jpegmeta=(JpegImageMetadata)meta;
            TiffField tf=jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_MODEL);
            if (tf != null) {
              setModel(tf.getStringValue().trim());
            }
            tf=jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_EXPOSURE_TIME);
            if (tf != null) {
              setExposure((int)(1000 * tf.getDoubleValue()));
            }
            tf=jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_ORIENTATION);
            if (tf != null) {
              setOrientation(tf.getIntValue());
            }
            tf=jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_ISO);
            if (tf != null) {
              int[] isoValues=tf.getIntArrayValue();
              setIso(isoValues[0]);
            }
          }
        }
 else         if (formatName.startsWith("String_Node_Str")) {
          setCodecV("String_Node_Str");
        }
 else         if (formatName.startsWith("String_Node_Str")) {
          setCodecV("String_Node_Str");
        }
 else         if (formatName.startsWith("String_Node_Str")) {
          setCodecV("String_Node_Str");
        }
        setContainer(getCodecV());
      }
 catch (      Throwable e) {
        LOGGER.info("String_Node_Str" + e.getMessage());
      }
      try {
        if (PMS.getConfiguration().getImageThumbnailsEnabled()) {
          File thumbDir=new File(PMS.getConfiguration().getTempFolder() + "String_Node_Str");
          if (!thumbDir.exists() && !thumbDir.mkdirs()) {
            LOGGER.debug("String_Node_Str" + thumbDir.getAbsolutePath() + "String_Node_Str");
          }
 else {
            String thumbFilename=thumbDir + f.getFile().getName() + "String_Node_Str";
            LOGGER.trace("String_Node_Str" + thumbFilename + "String_Node_Str");
            final Builder<File> thumbnail=Thumbnails.of(f.getFile());
            thumbnail.size(320,180);
            thumbnail.outputFormat("String_Node_Str");
            thumbnail.outputQuality(1.0f);
            thumbnail.toFile(thumbFilename);
            File jpg=new File(thumbFilename);
            if (jpg.exists()) {
              InputStream is=new FileInputStream(jpg);
              int sz=is.available();
              if (sz > 0) {
                setThumb(new byte[sz]);
                is.read(getThumb());
              }
              is.close();
              if (!jpg.delete()) {
                jpg.deleteOnExit();
              }
            }
          }
        }
      }
 catch (      Exception e) {
        LOGGER.info("String_Node_Str",e);
      }
    }
    if (ffmpeg_parsing) {
      if (!thumbOnly || !PMS.getConfiguration().isUseMplayerForVideoThumbs()) {
        pw=getFFMpegThumbnail(f);
      }
      String input="String_Node_Str";
      boolean dvrms=false;
      if (f.getFile() != null) {
        input=ProcessUtil.getShortFileNameIfWideChars(f.getFile().getAbsolutePath());
        dvrms=f.getFile().getAbsolutePath().toLowerCase().endsWith("String_Node_Str");
      }
      if (!ffmpeg_failure && !thumbOnly) {
        if (input.equals("String_Node_Str")) {
          input="String_Node_Str";
        }
        boolean matchs=false;
        ArrayList<String> lines=(ArrayList<String>)pw.getResults();
        int langId=0;
        int subId=0;
        ListIterator<String> FFmpegMetaData=lines.listIterator();
        for (        String line : lines) {
          FFmpegMetaData.next();
          line=line.trim();
          if (line.startsWith("String_Node_Str")) {
            matchs=false;
          }
 else           if (line.startsWith("String_Node_Str")) {
            if (line.indexOf(input) > -1) {
              matchs=true;
              setContainer(line.substring(10,line.indexOf("String_Node_Str",11)).trim());
            }
 else {
              matchs=false;
            }
          }
 else           if (matchs) {
            if (line.indexOf("String_Node_Str") > -1) {
              StringTokenizer st=new StringTokenizer(line,"String_Node_Str");
              while (st.hasMoreTokens()) {
                String token=st.nextToken().trim();
                if (token.startsWith("String_Node_Str")) {
                  String durationStr=token.substring(10);
                  int l=durationStr.substring(durationStr.indexOf("String_Node_Str") + 1).length();
                  if (l < 4) {
                    durationStr=durationStr + "String_Node_Str".substring(0,3 - l);
                  }
                  if (durationStr.indexOf("String_Node_Str") > -1) {
                    setDuration(null);
                  }
 else {
                    setDuration(parseDurationString(durationStr));
                  }
                }
 else                 if (token.startsWith("String_Node_Str")) {
                  String bitr=token.substring(9);
                  int spacepos=bitr.indexOf("String_Node_Str");
                  if (spacepos > -1) {
                    String value=bitr.substring(0,spacepos);
                    String unit=bitr.substring(spacepos + 1);
                    setBitrate(Integer.parseInt(value));
                    if (unit.equals("String_Node_Str")) {
                      setBitrate(1024 * getBitrate());
                    }
                    if (unit.equals("String_Node_Str")) {
                      setBitrate(1048576 * getBitrate());
                    }
                  }
                }
              }
            }
 else             if (line.indexOf("String_Node_Str") > -1) {
              StringTokenizer st=new StringTokenizer(line,"String_Node_Str");
              int a=line.indexOf("String_Node_Str");
              int b=line.indexOf("String_Node_Str",a);
              DLNAMediaAudio audio=new DLNAMediaAudio();
              audio.setId(langId++);
              if (a > -1 && b > a) {
                audio.setLang(line.substring(a + 1,b));
              }
 else {
                audio.setLang(DLNAMediaLang.UND);
              }
              a=line.indexOf("String_Node_Str");
              b=line.indexOf("String_Node_Str",a);
              if (a > -1 && b > a + 3) {
                String idString=line.substring(a + 3,b);
                try {
                  audio.setId(Integer.parseInt(idString,16));
                }
 catch (                NumberFormatException nfe) {
                  LOGGER.debug("String_Node_Str" + idString);
                }
              }
              while (st.hasMoreTokens()) {
                String token=st.nextToken().trim();
                if (token.startsWith("String_Node_Str")) {
                  audio.setCodecA(token.substring(token.indexOf("String_Node_Str") + 7));
                }
 else                 if (token.endsWith("String_Node_Str")) {
                  audio.setSampleFrequency(token.substring(0,token.indexOf("String_Node_Str")).trim());
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(1);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(2);
                }
 else                 if (token.equals("String_Node_Str") || token.equals("String_Node_Str") || token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(6);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(5);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(4);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.getAudioProperties().setNumberOfChannels(2);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.setBitsperSample(32);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.setBitsperSample(24);
                }
 else                 if (token.equals("String_Node_Str")) {
                  audio.setBitsperSample(16);
                }
              }
              int FFmpegMetaDataNr=FFmpegMetaData.nextIndex();
              if (FFmpegMetaDataNr > -1) {
                line=lines.get(FFmpegMetaDataNr);
              }
              if (line.indexOf("String_Node_Str") > -1) {
                FFmpegMetaDataNr=FFmpegMetaDataNr + 1;
                line=lines.get(FFmpegMetaDataNr);
                while (line.indexOf("String_Node_Str") == 0) {
                  if (line.toLowerCase().indexOf("String_Node_Str") > -1) {
                    int aa=line.indexOf("String_Node_Str");
                    int bb=line.length();
                    if (aa > -1 && bb > aa) {
                      audio.setFlavor(line.substring(aa + 2,bb));
                      break;
                    }
                  }
 else {
                    FFmpegMetaDataNr=FFmpegMetaDataNr + 1;
                    line=lines.get(FFmpegMetaDataNr);
                  }
                }
              }
              getAudioTracksList().add(audio);
            }
 else             if (line.indexOf("String_Node_Str") > -1) {
              StringTokenizer st=new StringTokenizer(line,"String_Node_Str");
              while (st.hasMoreTokens()) {
                String token=st.nextToken().trim();
                if (token.startsWith("String_Node_Str")) {
                  setCodecV(token.substring(token.indexOf("String_Node_Str") + 7));
                }
 else                 if ((token.indexOf("String_Node_Str") > -1 || token.indexOf("String_Node_Str") > -1)) {
                  String frameRateDoubleString=token.substring(0,token.indexOf("String_Node_Str")).trim();
                  try {
                    if (!frameRateDoubleString.equals(getFrameRate())) {
                      Double frameRateDouble=Double.parseDouble(frameRateDoubleString);
                      setFrameRate(String.format(Locale.ENGLISH,"String_Node_Str",frameRateDouble / 2));
                    }
                  }
 catch (                  NumberFormatException nfe) {
                    LOGGER.debug("String_Node_Str" + frameRateDoubleString + "String_Node_Str");
                  }
                }
 else                 if ((token.indexOf("String_Node_Str") > -1 || token.indexOf("String_Node_Str") > -1) && getFrameRate() == null) {
                  setFrameRate(token.substring(0,token.indexOf("String_Node_Str")).trim());
                }
 else                 if ((token.indexOf("String_Node_Str") > -1 || token.indexOf("String_Node_Str") > -1) && getFrameRate() == null) {
                  setFrameRate(token.substring(0,token.indexOf("String_Node_Str")).trim());
                }
 else                 if (token.indexOf("String_Node_Str") > -1) {
                  String resolution=token.trim();
                  if (resolution.indexOf("String_Node_Str") > -1) {
                    resolution=resolution.substring(0,resolution.indexOf("String_Node_Str"));
                  }
                  try {
                    setWidth(Integer.parseInt(resolution.substring(0,resolution.indexOf("String_Node_Str"))));
                  }
 catch (                  NumberFormatException nfe) {
                    LOGGER.debug("String_Node_Str" + resolution.substring(0,resolution.indexOf("String_Node_Str")) + "String_Node_Str");
                  }
                  try {
                    setHeight(Integer.parseInt(resolution.substring(resolution.indexOf("String_Node_Str") + 1)));
                  }
 catch (                  NumberFormatException nfe) {
                    LOGGER.debug("String_Node_Str" + resolution.substring(resolution.indexOf("String_Node_Str") + 1) + "String_Node_Str");
                  }
                }
              }
            }
 else             if (line.indexOf("String_Node_Str") > -1 && !line.contains("String_Node_Str")) {
              DLNAMediaSubtitle lang=new DLNAMediaSubtitle();
              lang.setType((line.contains("String_Node_Str") && Platform.isWindows() ? SubtitleType.VOBSUB : SubtitleType.UNKNOWN));
              int a=line.indexOf("String_Node_Str");
              int b=line.indexOf("String_Node_Str",a);
              if (a > -1 && b > a) {
                lang.setLang(line.substring(a + 1,b));
              }
 else {
                lang.setLang(DLNAMediaLang.UND);
              }
              lang.setId(subId++);
              int FFmpegMetaDataNr=FFmpegMetaData.nextIndex();
              if (FFmpegMetaDataNr > -1) {
                line=lines.get(FFmpegMetaDataNr);
              }
              if (line.indexOf("String_Node_Str") > -1) {
                FFmpegMetaDataNr=FFmpegMetaDataNr + 1;
                line=lines.get(FFmpegMetaDataNr);
                while (line.indexOf("String_Node_Str") == 0) {
                  if (line.toLowerCase().indexOf("String_Node_Str") > -1) {
                    int aa=line.indexOf("String_Node_Str");
                    int bb=line.length();
                    if (aa > -1 && bb > aa) {
                      lang.setFlavor(line.substring(aa + 2,bb));
                      break;
                    }
                  }
 else {
                    FFmpegMetaDataNr=FFmpegMetaDataNr + 1;
                    line=lines.get(FFmpegMetaDataNr);
                  }
                }
              }
              getSubtitleTracksList().add(lang);
            }
          }
        }
      }
      if (!thumbOnly && getContainer() != null && f.getFile() != null && getContainer().equals("String_Node_Str") && isH264() && getDurationInSeconds() == 0) {
        try {
          int length=MpegUtil.getDurationFromMpeg(f.getFile());
          if (length > 0) {
            setDuration((double)length);
          }
        }
 catch (        IOException e) {
          LOGGER.trace("String_Node_Str" + e.getMessage());
        }
      }
      if (PMS.getConfiguration().isUseMplayerForVideoThumbs() && type == Format.VIDEO && !dvrms) {
        try {
          getMplayerThumbnail(f);
          String frameName="String_Node_Str" + f.hashCode();
          frameName=PMS.getConfiguration().getTempFolder() + "String_Node_Str" + frameName+ "String_Node_Str";
          frameName=frameName.replace(',','_');
          File jpg=new File(frameName);
          if (jpg.exists()) {
            InputStream is=new FileInputStream(jpg);
            int sz=is.available();
            if (sz > 0) {
              setThumb(new byte[sz]);
              is.read(getThumb());
            }
            is.close();
            if (!jpg.delete()) {
              jpg.deleteOnExit();
            }
            if (!jpg.getParentFile().delete() && !jpg.getParentFile().delete()) {
              LOGGER.debug("String_Node_Str" + jpg.getParentFile().getAbsolutePath() + "String_Node_Str");
            }
          }
        }
 catch (        IOException e) {
          LOGGER.debug("String_Node_Str",e);
        }
      }
      if (type == Format.VIDEO && pw != null && getThumb() == null) {
        InputStream is;
        try {
          is=pw.getInputStream(0);
          int sz=is.available();
          if (sz > 0) {
            setThumb(new byte[sz]);
            is.read(getThumb());
          }
          is.close();
          if (sz > 0 && !java.awt.GraphicsEnvironment.isHeadless()) {
            BufferedImage image=ImageIO.read(new ByteArrayInputStream(getThumb()));
            if (image != null) {
              Graphics g=image.getGraphics();
              g.setColor(Color.WHITE);
              g.setFont(new Font("String_Node_Str",Font.PLAIN,14));
              int low=0;
              if (getWidth() > 0) {
                if (getWidth() == 1920 || getWidth() == 1440) {
                  g.drawString("String_Node_Str",0,low+=18);
                }
 else                 if (getWidth() == 1280) {
                  g.drawString("String_Node_Str",0,low+=18);
                }
              }
              ByteArrayOutputStream out=new ByteArrayOutputStream();
              ImageIO.write(image,"String_Node_Str",out);
              setThumb(out.toByteArray());
            }
          }
        }
 catch (        IOException e) {
          LOGGER.debug("String_Node_Str" + e.getMessage());
        }
      }
    }
    finalize(type,f);
    setMediaparsed(true);
  }
}