private void fillHeaderInfo() {
   // audio header info
   bitRate = audioHeader.getBitRate();
   bitsPerSample = Integer.toString(audioHeader.getBitsPerSample());
   trackLength = Integer.toString(audioHeader.getTrackLength());
   encodingType = audioHeader.getEncodingType();
   format = audioHeader.getFormat();
   sampleRate = audioHeader.getSampleRate();
 }
Exemplo n.º 2
0
 private void insertMusicMetadata() throws IOException {
   atts.reset();
   System.out.format("Extracting music metadata from %s.\n", src.path());
   Tag tags = audio.getTag();
   AudioHeader header = audio.getAudioHeader();
   insert(FORMAT, header.getFormat());
   insert(ENCODINGTYPE, header.getEncodingType());
   insert(BITRATE, header.getBitRate());
   insert(SAMPLERATE, header.getSampleRate());
   insert(LENGTH, header.getTrackLength());
   insert(ALBUM, tags.getFirst(FieldKey.ALBUM));
   insert(ALBUMARTIST, tags.getFirst(FieldKey.ALBUM_ARTIST));
   insert(ARTIST, tags.getFirst(FieldKey.ARTIST));
   insert(TITLE, tags.getFirst(FieldKey.TITLE));
   insert(TRACKNR, tags.getFirst(FieldKey.TRACK));
   insert(DISCNR, tags.getFirst(FieldKey.DISC_NO));
   insert(YEAR, tags.getFirst(FieldKey.YEAR));
   insert(COMMENT, tags.getFirst(FieldKey.COMMENT));
 }
  public void printResults() {
    System.out.println("\n<-- ALL TAG INFO -->");
    System.out.println("ARTIST: " + artist);
    System.out.println("TITLE: " + title);
    System.out.println("ALBUM: " + album);
    System.out.println("ALBUM ARTIST: " + album_artist);
    System.out.println("TRACK: " + track);
    System.out.println("COMPOSER: " + composer);
    System.out.println("YEAR: " + year);
    System.out.println("DISK NO: " + diskNumber);

    System.out.println("\n<-- ALL AUDIO HEADERS -->");
    System.out.println("BIT RATE: " + audioHeader.getBitRate());
    System.out.println("BITS PER SAMPLE: " + audioHeader.getBitsPerSample());
    System.out.println("TRACK LENGTH: " + audioHeader.getTrackLength());
    System.out.println("ENCODING TYPE: " + audioHeader.getEncodingType());
    System.out.println("FORMAT: " + audioHeader.getFormat());
    System.out.println("SAMPLE RATE: " + audioHeader.getSampleRate());
  }
Exemplo n.º 4
0
  private static void setPropsFromTagAndHeader(Properties p, AudioHeader audioHeader, Tag tag) {
    String artist = tag.getFirstArtist();
    if (artist != null) {
      p.setProperty(FileCollection.ONESWARM_ARTIST_ATTRIBUTE, tag.getFirstArtist());
    }
    String album = tag.getFirstAlbum();
    if (album != null) {
      p.setProperty(FileCollection.ONESWARM_ALBUM_ATTRIBUTE, album);
    }
    String firstYear = tag.getFirstYear();
    if (firstYear != null) {
      p.setProperty("year", firstYear);
    }
    String firstGenre = tag.getFirstGenre();
    if (firstGenre != null) {
      p.setProperty("genre", firstGenre);
    }
    String firstTitle = tag.getFirstTitle();
    if (firstTitle != null) {
      p.setProperty("title", firstTitle);
    }

    if (audioHeader != null) {
      int trackLength = audioHeader.getTrackLength();
      p.setProperty("length", Integer.toString(trackLength));
      String format = audioHeader.getFormat();
      if (format != null) {
        p.setProperty("format", format);
      }
      long bitRateAsNumber = audioHeader.getBitRateAsNumber();
      p.setProperty("bitrate", Long.toString(bitRateAsNumber));
      String encodingType = audioHeader.getEncodingType();
      if (encodingType != null) {
        p.setProperty("encoding", encodingType);
      }
    }
  }