Пример #1
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;
 }
Пример #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 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;
 }
  /*
   * 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();
    }
  }