Package helliker.id3

Examples of helliker.id3.MP3File


    try {
      tmp = File.createTempFile("nutch", ".mp3");
      FileOutputStream fos = new FileOutputStream(tmp);
      fos.write(raw);
      fos.close();
      MP3File mp3 = new MP3File(tmp);

      if (mp3.hasID3v2Tag()) {
        parse = getID3v2Parse(mp3, content.getMetadata(), content);
      } else if (mp3.hasID3v1Tag()) {
        parse = getID3v1Parse(mp3, content.getMetadata(), content);
      } else {
        return new ParseStatus().getEmptyParseResult(content.getUrl(),
            getConf());
      }
View Full Code Here


   */
  public SongData( String path ) throws SongDataException {
    this.path = tagPrep(path);
    AbstractMP3Tag tag = null;
        try {
      MP3File mp3file = new MP3File(path);
      if (mp3file.hasID3v2Tag()) {
        tag = mp3file.getID3v2Tag();
      } else if (mp3file.hasID3v1Tag()) {
        tag = mp3file.getID3v1Tag();
      } else {
        throw new SongDataException( "No MP3 ID tag found for \""+path+"\"" );
      }
        } catch (TagException tE) {
            throw new SongDataException( "(TagException) Broken MP3 ID tag found for \""+path+"\"" );
View Full Code Here

    try {
      tmp = File.createTempFile("nutch", ".mp3");
      FileOutputStream fos = new FileOutputStream(tmp);
      fos.write(raw);
      fos.close();
      MP3File mp3 = new MP3File(tmp);

      if (mp3.hasID3v2Tag()) {
        parse = getID3v2Parse(mp3, content.getMetadata());
      } else if (mp3.hasID3v1Tag()) {
        parse = getID3v1Parse(mp3, content.getMetadata());
      } else {
        return new ParseStatus(ParseStatus.FAILED,
                               ParseStatus.FAILED_MISSING_CONTENT,
                               "No textual content available").getEmptyParse(conf);
View Full Code Here

            AbstractID3v2FrameBody frameBody;
            frameBody = new FrameBodyCOMM((byte) 0, "eng", comment, comment);
            frame = new ID3v2_3Frame(frameBody);
            id3v2.setFrame(frame);

            MP3File mp3File = new MP3File(file);
            TagOptionSingleton.getInstance().setDefaultSaveMode(TagConstant.MP3_FILE_SAVE_OVERWRITE);
            mp3File.setID3v1Tag(id3v1);
            mp3File.setID3v2Tag(id3v2);
            mp3File.save();
            // very dirty, TODO: prevent Jid3lib to generate the ".original" files
            File originalFile = new File(FilenameUtils.removeExtension(file.toString()) + ".original.mp3");
            if(originalFile.exists())
                originalFile.delete();
        } catch (TagException ex) {
View Full Code Here

        int size;
        final String str;
        final Iterator iterator;
        ID3v2_4Frame frame;
        final byte[] buffer = new byte[6];
        final MP3File mp3 = new MP3File();
        mp3.seekMP3Frame(file);
        final long mp3start = file.getFilePointer();
        file.seek(0);
        str = "ID3";
        for (int i = 0; i < str.length(); i++) {
            buffer[i] = (byte) str.charAt(i);
View Full Code Here

     */
    public FilenameTag(final FilenameTag copyObject) {
        super(copyObject);
        composite = (AbstractFilenameComposite) TagUtility.copyObject(copyObject.composite);
        id3tag = new ID3v2_4(copyObject.id3tag);
        mp3file = new MP3File(copyObject.mp3file);
        extension = copyObject.extension;
    }
View Full Code Here

    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

TOP

Related Classes of helliker.id3.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.