public void setTags(Vector<DegreeValue> tags) {
   if (write_extended_info) {
     // remove existing tags
     int s = 1;
     String identifier = TagUtil.getTagTagId(s).toUpperCase();
     while (tag.hasField(identifier)) {
       tag.set(new OggTagField(identifier, ""));
       ++s;
       identifier = TagUtil.getTagTagId(s).toUpperCase();
     }
     // set tags
     for (s = 0; s < tags.size(); ++s) {
       String tagName = tags.get(s).getName();
       float degree = tags.get(s).getPercentage();
       identifier = TagUtil.getTagTagId(s + 1);
       tag.set(new OggTagField(identifier.toUpperCase(), tagName));
       identifier = TagUtil.getTagTagDegree(s + 1);
       tag.set(new OggTagField(identifier.toUpperCase(), String.valueOf(degree)));
     }
   }
 }
  public Tag getTag(File file) {
    Tag result = new Tag();
    AudioFile audiofile;
    try {
      audiofile = AudioFileIO.read(file);

      entagged.audioformats.Tag entaggedtag = audiofile.getTag();
      result.setAlbum(entaggedtag.getFirstAlbum());
      result.setArtist(entaggedtag.getFirstArtist());
      result.setTitle(entaggedtag.getFirstTitle());
      result.setYear(entaggedtag.getFirstYear());
      result.setSamplerate(audiofile.getSamplingRate());
      result.setBitrate(audiofile.getBitrate());

      try {
        result.setTracknumber(Integer.parseInt(entaggedtag.getFirstTrack()));
      } catch (NumberFormatException e) {
        System.out.println("No Tracknumber for file " + file.toString());
      }
      result.setTime((long) (audiofile.getPreciseLength() * 1000));
    } catch (CannotReadException e) {
      System.out.println("Exception for file:" + file.toString() + " " + e.toString());
    } catch (Exception e) {
      System.out.println("Exception for file:" + file.toString() + " " + e.toString());
    } finally {
      result.fillBlanks(file);
    }

    // TODO Auto-generated method stub
    return result;
  }
 public void setReplayGain(float value) {
   if (write_extended_info) {
     tag.set(
         new OggTagField(TXXX_REPLAYGAIN_TRACK_GAIN.toUpperCase(), String.valueOf(value) + " dB"));
   }
 }
 public void setBpmStart(float start_bpm) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_BPM_START.toUpperCase(), String.valueOf(start_bpm)));
   }
 }
 public void setRemix(String remix) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_REMIX.toUpperCase(), remix));
   }
 }
 public void setAlbum(String album) {
   if (tag != null) {
     tag.setAlbum(album);
   }
 }
 public void setBeatIntensity(int beat_intensity) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_BEAT_INTENSITY.toUpperCase(), String.valueOf(beat_intensity)));
   }
 }
 public void setComments(String comments) {
   if (tag != null) {
     tag.setComment(comments);
     tag.set(new OggTagField(TAG_COMMENTS.toUpperCase(), comments));
   }
 }
 public void setUserField(String fieldName, String user1) {
   if (write_extended_info) {
     tag.set(new OggTagField(TagUtil.convertToValidTagId(fieldName), user1));
   }
 }
 public void setKey(String key) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_INITIALKEY.toUpperCase(), key));
     tag.set(new OggTagField(TXXX_KEY.toUpperCase(), key));
   }
 }
 public void setTime(String time) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_TIME.toUpperCase(), time));
   }
 }
 public void setFileType(String file_type) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_FILE_TYPE.toUpperCase(), file_type));
   }
 }
 public void setGenre(String genre) {
   if (tag != null) {
     tag.setGenre(genre);
   }
 }
 public void setEncodedBy(String encoded_by) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_ENCODED_BY.toUpperCase(), encoded_by));
   }
 }
 public void setContentType(String content_type) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_CONTENT_TYPE.toUpperCase(), content_type));
   }
 }
 public void setContentGroupDescription(String content_group_description) {
   if (write_extended_info) {
     tag.set(
         new OggTagField(TAG_CONTENT_GROUP_DESCRIPTION.toUpperCase(), content_group_description));
   }
 }
 public void setSizeInBytes(int size) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_SIZE_IN_BYTES.toUpperCase(), String.valueOf(size)));
   }
 }
 public void setTitle(String title) {
   if (tag != null) {
     tag.setTitle(title);
   }
 }
 public void setKeyAccuracy(int accuracy) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_KEY_ACCURACY.toUpperCase(), String.valueOf(accuracy)));
   }
 }
 public void setBpmEnd(float end_bpm) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_BPM_END.toUpperCase(), String.valueOf(end_bpm)));
   }
 }
 public void setTimeSignature(String time_sig) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_TIME_SIGNATURE.toUpperCase(), time_sig));
   }
 }
 public void setKeyStart(String start_key) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_KEY_START.toUpperCase(), start_key));
   }
 }
 public void setTrack(String track, Integer total_tracks) {
   if (tag != null) {
     if (total_tracks != null) tag.setTrack(track + "/" + total_tracks);
     else tag.setTrack(track);
   }
 }
 public void setKeyEnd(String end_key) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_KEY_END.toUpperCase(), end_key));
   }
 }
 public void setYear(String year) {
   if (tag != null) {
     tag.setYear(year);
   }
 }
 public void setLanguages(String languages) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_LANGUAGES.toUpperCase(), languages));
   }
 }
 public void setArtist(String artist) {
   if (tag != null) {
     tag.setArtist(artist);
   }
 }
 public void setPublisher(String publisher) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_PUBLISHER.toUpperCase(), publisher));
   }
 }
 public void setBpm(int bpm) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_BPM.toUpperCase(), String.valueOf(bpm)));
   }
 }
 public void setRating(int rating) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_RATING.toUpperCase(), String.valueOf(rating)));
   }
 }