Ejemplo n.º 1
0
 public String getTime() {
   String time = null;
   FrameBodyTXXX txxx_frame = getTXXXFrame(TXXX_TIME);
   if (txxx_frame != null) {
     time = txxx_frame.getText();
   }
   if (StringUtil.isValid(time)) return time;
   if (id3v2 != null) {
     AbstractID3v2Frame frame = getFrame(FRAME_LENGTH);
     if (frame != null) {
       FrameBodyTLEN frame_body = (FrameBodyTLEN) frame.getBody();
       if (frame_body != null) {
         try {
           int milliseconds = Integer.parseInt(frame_body.getText());
           time = StringUtil.seconds_to_time(milliseconds / 1000);
         } catch (Exception e) {
           log.error("getTime(): error getting length=", e);
         }
       }
     }
     if (StringUtil.isValid(time)) return time;
     frame = getFrame(FRAME_TIME);
     if (frame != null) {
       FrameBodyTIME frame_body = (FrameBodyTIME) frame.getBody();
       if (frame_body != null) {
         time = frame_body.getText();
       }
     }
   }
   return time;
 }
Ejemplo n.º 2
0
 public String getKeyStart() {
   String start_key = null;
   // txxx start key
   FrameBodyTXXX txxx_frame = getTXXXFrame(TXXX_KEY_START);
   if (txxx_frame != null) {
     start_key = txxx_frame.getText();
   }
   if (StringUtil.isValid(start_key)) return start_key;
   // tkey
   if (id3v2 != null) {
     AbstractID3v2Frame frame = getFrame(FRAME_KEY);
     if (frame != null) {
       FrameBodyTKEY frame_body = (FrameBodyTKEY) frame.getBody();
       if (frame_body != null) {
         start_key = frame_body.getText();
       }
     }
   }
   // txxx key/initialkey/fkey
   txxx_frame = getTXXXFrame(TXXX_KEY);
   if (txxx_frame != null) {
     start_key = txxx_frame.getText();
   }
   if (StringUtil.isValid(start_key)) return start_key;
   txxx_frame = getTXXXFrame(TXXX_KEY_INITIAL);
   if (txxx_frame != null) {
     start_key = txxx_frame.getText();
   }
   if (StringUtil.isValid(start_key)) return start_key;
   txxx_frame = getTXXXFrame(TXXX_KEY_FINALSCRATCH);
   if (txxx_frame != null) {
     start_key = txxx_frame.getText();
   }
   return start_key;
 }
Ejemplo n.º 3
0
 public String getArtist() {
   String artist = null;
   // lead performer
   if (id3v2 != null) {
     AbstractID3v2Frame frame = getFrame(FRAME_LEAD_PERFORMER);
     if (frame != null) {
       FrameBodyTPE1 frameBody = (FrameBodyTPE1) frame.getBody();
       artist = frameBody.getText();
     }
     if (StringUtil.isValid(artist)) return artist;
   }
   if (id3v1 != null) {
     artist = getFirstValue(id3v1.getArtist());
     if (StringUtil.isValid(artist)) return artist;
   }
   if (id3v2 != null) {
     // composer
     AbstractID3v2Frame frame = getFrame(FRAME_COMPOSER);
     if (frame != null) {
       FrameBodyTCOM frameBody = (FrameBodyTCOM) frame.getBody();
       artist = frameBody.getText();
     }
     if (StringUtil.isValid(artist)) return artist;
     // original performer
     frame = getFrame(FRAME_ORIGINAL_PERFORMER);
     if (frame != null) {
       FrameBodyTOPE frameBody = (FrameBodyTOPE) frame.getBody();
       artist = frameBody.getText();
     }
   }
   return artist;
 }
Ejemplo n.º 4
0
 public String getTrack() {
   String track = null;
   if (id3v2 != null) {
     AbstractID3v2Frame frame = getFrame(FRAME_TRACK);
     if (frame != null) {
       FrameBodyTRCK frameBody = (FrameBodyTRCK) frame.getBody();
       track = frameBody.getText();
     }
   }
   if (StringUtil.isValid(track)) return track;
   if (id3v11 != null) {
     track = getFirstValue(id3v11.getTrack());
   }
   return track;
 }
Ejemplo n.º 5
0
 public String getTitle() {
   String title = null;
   if (id3v2 != null) {
     AbstractID3v2Frame frame = getFrame(FRAME_TITLE);
     if (frame != null) {
       FrameBodyTIT2 frameBody = (FrameBodyTIT2) frame.getBody();
       title = frameBody.getText();
     }
     if (StringUtil.isValid(title)) return title;
   }
   if (id3v1 != null) {
     title = getFirstValue(id3v1.getTitle());
   }
   return title;
 }
Ejemplo n.º 6
0
 public String getComments() {
   String comments = null;
   if (id3v2 != null) {
     AbstractID3v2Frame frame = getFrame(FRAME_COMMENTS);
     if (frame != null) {
       FrameBodyCOMM frameBody = (FrameBodyCOMM) frame.getBody();
       comments = frameBody.getText();
     }
     if (StringUtil.isValid(comments)) return comments;
   }
   if (id3v1 != null) {
     comments = getFirstValue(id3v1.getComment());
   }
   return comments;
 }
Ejemplo n.º 7
0
 public String getAlbum() {
   String album = null;
   if (id3v2 != null) {
     AbstractID3v2Frame frame = getFrame(FRAME_ALBUM);
     if (frame != null) {
       FrameBodyTALB frameBody = (FrameBodyTALB) frame.getBody();
       album = frameBody.getText();
     }
     if (StringUtil.isValid(album)) return album;
   }
   if (id3v1 != null) {
     album = getFirstValue(id3v1.getAlbum());
   }
   return album;
 }
Ejemplo n.º 8
0
 public String getGenre() {
   String genre = null;
   if (id3v2 != null) {
     AbstractID3v2Frame frame = getFrame(FRAME_GENRE);
     if (frame != null) {
       FrameBodyTCON frame_body = (FrameBodyTCON) frame.getBody();
       if (frame_body != null) {
         genre = frame_body.getText();
       }
     }
     if (StringUtil.isValid(genre)) return genre;
   }
   if (id3v1 != null) {
     genre = getFirstValue(id3v1.getGenre());
   }
   return genre;
 }
Ejemplo n.º 9
0
 public String getYear() {
   String year = null;
   if (id3v2 != null) {
     AbstractID3v2Frame frame = getFrame(FRAME_YEAR);
     if (frame != null) {
       if (frame.getBody() instanceof FrameBodyTYER) {
         FrameBodyTYER frameBody = (FrameBodyTYER) frame.getBody();
         year = frameBody.getText();
       } else {
         log.trace("getYear(): frame=" + frame + ", class=" + frame.getBody().getClass());
       }
     }
     if (StringUtil.isValid(year)) return year;
   }
   if (id3v1 != null) {
     year = getFirstValue(id3v1.getYear());
   }
   return year;
 }