Package org.blinkenlights.jid3

Examples of org.blinkenlights.jid3.MP3File


    public void write(final RandomAccessFile file) throws IOException {
        final String str;
        final Iterator iterator;
        final byte[] buffer = new byte[6];
        final MP3File mp3 = new MP3File();
        mp3.seekMP3Frame(file);
        final long mp3start = file.getFilePointer();
        file.seek(0);
        ID3v2_3Frame frame;
        str = "ID3";
        for (int i = 0; i < str.length(); i++) {
View Full Code Here


    public void write(final RandomAccessFile file) throws IOException {
        final String str;
        ID3v2_2Frame frame;
        final Iterator iterator;
        final byte[] buffer = new byte[6];
        final MP3File mp3 = new MP3File();
        mp3.seekMP3Frame(file);
        final long mp3start = file.getFilePointer();
        file.seek(0);

        // write the first 10 tag bytes
        str = "ID3";
View Full Code Here

*
*/
public class TagTestHelpLibrary {

  public static MP3File createMP3FileMockForID3v1(ID3v1 id3){
    MP3File mp3FileMock = EasyMock.createMock(MP3File.class);
    EasyMock.expect(mp3FileMock.hasID3v2Tag()).andReturn(false);
    EasyMock.expect(mp3FileMock.hasID3v1Tag()).andReturn(true);
    EasyMock.expect(mp3FileMock.getID3v1Tag()).andReturn(id3).times(2);
    return mp3FileMock;
  }
View Full Code Here

    EasyMock.expect(mp3FileMock.getID3v1Tag()).andReturn(id3).times(2);
    return mp3FileMock;
  }
 
  public static MP3File createMP3FileMockForID3v2(AbstractID3v2 id3){
    MP3File mp3FileMock = EasyMock.createMock(MP3File.class);
    EasyMock.expect(mp3FileMock.hasID3v2Tag()).andReturn(true);
    EasyMock.expect(mp3FileMock.getID3v2Tag()).andReturn(id3).times(2);
    return mp3FileMock;
  }
View Full Code Here

    this.testID3v2Genre("(13)", "Pop");
  }

  private void testID3v1Genre(String input, String expectedOutput) throws ID3TagFileException {
    ID3v1 id3Mock = EasyMock.createMock(ID3v1.class);
    MP3File mp3FileMock = TagTestHelpLibrary.createMP3FileMockForID3v1(id3Mock);

    EasyMock.expect(id3Mock.getSongGenre()).andReturn(input);
    EasyMock.replay(id3Mock, mp3FileMock);

    ID3Tag tag = jidID3TagFactory.getID3Tag(mp3FileMock);
View Full Code Here

    EasyMock.verify(id3Mock, mp3FileMock);
  }
 
  private void testID3v2Genre(String input, String expectedOutput) throws ID3TagFileException {
    AbstractID3v2 id3Mock = EasyMock.createMock(AbstractID3v2.class);
    MP3File mp3FileMock = TagTestHelpLibrary.createMP3FileMockForID3v2(id3Mock);

    EasyMock.expect(id3Mock.getSongGenre()).andReturn(input);
    EasyMock.replay(id3Mock, mp3FileMock);

    ID3Tag tag = jidID3TagFactory.getID3Tag(mp3FileMock);
View Full Code Here

    jidID3TagFactory.getID3Tag(fileMock);
  }
 
  @Test
  public void ID3v1Test() throws ID3TagFileException{
    MP3File mp3FileMock = TagTestHelpLibrary.createMP3FileMockForID3v1(null);
    EasyMock.replay(mp3FileMock);
   
    ID3Tag id3Tag = jidID3TagFactory.getID3Tag(mp3FileMock);
 
    assertTrue(id3Tag.getClass().equals(ID3v1TagImpl.class));
View Full Code Here

    EasyMock.verify(mp3FileMock);
  }
 
  @Test
  public void ID3v2Test() throws ID3TagFileException{
    MP3File mp3FileMock = TagTestHelpLibrary.createMP3FileMockForID3v2(null);
    EasyMock.replay(mp3FileMock);
   
    ID3Tag id3Tag = jidID3TagFactory.getID3Tag(mp3FileMock);
 
    assertTrue(id3Tag.getClass().equals(ID3v2TagImpl.class));
View Full Code Here

    if (isM4A(file)) {
      throw new ID3M4AException(file);
    }

    try {
      MP3File mp3File = new MP3File(file, NOT_WRITEABLE);
      return getID3Tag(mp3File);

    } catch (IOException e) {
      throw new ID3TagFileException(e, file);
    } catch (TagException e) {
View Full Code Here

   *       </ul>
   */
  public static String[] getIDTags(String file) {
    String[] ret = new String[3];
    try {
      MP3File mp3 = new MP3File(file);
      String mtitle = null, martist=null, malbum=null;
      if(mp3.hasID3v1Tag()) {
        mtitle = mp3.getID3v1Tag().getTitle();
        martist = mp3.getID3v1Tag().getArtist();
        malbum = mp3.getID3v1Tag().getAlbum();
      } else if(mp3.hasID3v2Tag()) {
        mtitle = mp3.getID3v2Tag().getSongTitle();
        martist = mp3.getID3v2Tag().getLeadArtist();
        malbum = mp3.getID3v2Tag().getAlbumTitle();
      }
      ret[0] = toUTF8(martist);
      ret[1] = toUTF8(malbum);
      ret[2] = toUTF8(mtitle);
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.blinkenlights.jid3.MP3File

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.