/*
   * Fetches mp3 audio file ID3 information using mp3agic library
   */
  private void setTrackInformation() {
    try {
      Mp3File mp3 = new Mp3File(file.getPath());

      if (mp3.hasId3v2Tag()) {
        title = mp3.getId3v2Tag().getTitle();
        album = mp3.getId3v2Tag().getAlbum();
        artist = mp3.getId3v2Tag().getArtist();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
예제 #2
0
 public String getTrack() {
   if (mp3File.hasId3v2Tag() && mp3File.getId3v2Tag().getTrack() != null) {
     return mp3File.getId3v2Tag().getTrack();
   }
   if (mp3File.hasId3v1Tag() && mp3File.getId3v1Tag().getTrack() != null) {
     return mp3File.getId3v1Tag().getTrack();
   }
   return UNKNOWN_TRACK;
 }
예제 #3
0
 public String getTitle() {
   if (mp3File.hasId3v2Tag() && mp3File.getId3v2Tag().getTitle() != null) {
     return mp3File.getId3v2Tag().getTitle();
   }
   if (mp3File.hasId3v1Tag() && mp3File.getId3v1Tag().getTitle() != null) {
     return mp3File.getId3v1Tag().getTitle();
   }
   return NO_TITLE;
 }
예제 #4
0
 public String getArtist() {
   if (mp3File.hasId3v2Tag() && mp3File.getId3v2Tag().getArtist() != null) {
     return mp3File.getId3v2Tag().getArtist();
   }
   if (mp3File.hasId3v1Tag() && mp3File.getId3v1Tag().getArtist() != null) {
     return mp3File.getId3v1Tag().getArtist();
   }
   return UNKNOWN_ARTIST;
 }
예제 #5
0
 public long getDuration() {
   return mp3File.getLengthInSeconds();
 }
예제 #6
0
 public int getBitrate() {
   return mp3File.getBitrate();
 }