コード例 #1
0
 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)));
     }
   }
 }
コード例 #2
0
  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;
  }
コード例 #3
0
 public void setReplayGain(float value) {
   if (write_extended_info) {
     tag.set(
         new OggTagField(TXXX_REPLAYGAIN_TRACK_GAIN.toUpperCase(), String.valueOf(value) + " dB"));
   }
 }
コード例 #4
0
 public void setBpmStart(float start_bpm) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_BPM_START.toUpperCase(), String.valueOf(start_bpm)));
   }
 }
コード例 #5
0
 public void setRemix(String remix) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_REMIX.toUpperCase(), remix));
   }
 }
コード例 #6
0
 public void setAlbum(String album) {
   if (tag != null) {
     tag.setAlbum(album);
   }
 }
コード例 #7
0
 public void setBeatIntensity(int beat_intensity) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_BEAT_INTENSITY.toUpperCase(), String.valueOf(beat_intensity)));
   }
 }
コード例 #8
0
 public void setComments(String comments) {
   if (tag != null) {
     tag.setComment(comments);
     tag.set(new OggTagField(TAG_COMMENTS.toUpperCase(), comments));
   }
 }
コード例 #9
0
 public void setUserField(String fieldName, String user1) {
   if (write_extended_info) {
     tag.set(new OggTagField(TagUtil.convertToValidTagId(fieldName), user1));
   }
 }
コード例 #10
0
 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));
   }
 }
コード例 #11
0
 public void setTime(String time) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_TIME.toUpperCase(), time));
   }
 }
コード例 #12
0
 public void setFileType(String file_type) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_FILE_TYPE.toUpperCase(), file_type));
   }
 }
コード例 #13
0
 public void setGenre(String genre) {
   if (tag != null) {
     tag.setGenre(genre);
   }
 }
コード例 #14
0
 public void setEncodedBy(String encoded_by) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_ENCODED_BY.toUpperCase(), encoded_by));
   }
 }
コード例 #15
0
 public void setContentType(String content_type) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_CONTENT_TYPE.toUpperCase(), content_type));
   }
 }
コード例 #16
0
 public void setContentGroupDescription(String content_group_description) {
   if (write_extended_info) {
     tag.set(
         new OggTagField(TAG_CONTENT_GROUP_DESCRIPTION.toUpperCase(), content_group_description));
   }
 }
コード例 #17
0
 public void setSizeInBytes(int size) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_SIZE_IN_BYTES.toUpperCase(), String.valueOf(size)));
   }
 }
コード例 #18
0
 public void setTitle(String title) {
   if (tag != null) {
     tag.setTitle(title);
   }
 }
コード例 #19
0
 public void setKeyAccuracy(int accuracy) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_KEY_ACCURACY.toUpperCase(), String.valueOf(accuracy)));
   }
 }
コード例 #20
0
 public void setBpmEnd(float end_bpm) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_BPM_END.toUpperCase(), String.valueOf(end_bpm)));
   }
 }
コード例 #21
0
 public void setTimeSignature(String time_sig) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_TIME_SIGNATURE.toUpperCase(), time_sig));
   }
 }
コード例 #22
0
 public void setKeyStart(String start_key) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_KEY_START.toUpperCase(), start_key));
   }
 }
コード例 #23
0
 public void setTrack(String track, Integer total_tracks) {
   if (tag != null) {
     if (total_tracks != null) tag.setTrack(track + "/" + total_tracks);
     else tag.setTrack(track);
   }
 }
コード例 #24
0
 public void setKeyEnd(String end_key) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_KEY_END.toUpperCase(), end_key));
   }
 }
コード例 #25
0
 public void setYear(String year) {
   if (tag != null) {
     tag.setYear(year);
   }
 }
コード例 #26
0
 public void setLanguages(String languages) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_LANGUAGES.toUpperCase(), languages));
   }
 }
コード例 #27
0
 public void setArtist(String artist) {
   if (tag != null) {
     tag.setArtist(artist);
   }
 }
コード例 #28
0
 public void setPublisher(String publisher) {
   if (write_extended_info) {
     tag.set(new OggTagField(TAG_PUBLISHER.toUpperCase(), publisher));
   }
 }
コード例 #29
0
 public void setBpm(int bpm) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_BPM.toUpperCase(), String.valueOf(bpm)));
   }
 }
コード例 #30
0
 public void setRating(int rating) {
   if (write_extended_info) {
     tag.set(new OggTagField(TXXX_RATING.toUpperCase(), String.valueOf(rating)));
   }
 }