Package org.jaudiotagger.tag.id3.framebody

Examples of org.jaudiotagger.tag.id3.framebody.FrameBodyTPOS

@author : Paul Taylor @author : Eric Farng @version $Id: FrameBodyTPOS.java 895 2010-04-15 15:21:45Z paultaylor $

        ID3v1Tag v1tag = (ID3v1Tag) tag;
        String title = v1tag.getFirst(FieldKey.TITLE);
        System.out.println(title);
      }
      if (tag instanceof ID3v23Tag) {
        ID3v23Tag v23tag = (ID3v23Tag) tag;
        String title = v23tag.getFirst(FieldKey.TITLE);
        System.out.println(title);
      }
    } catch (CannotReadException e) {
      e.printStackTrace();
    } catch (IOException e) {
View Full Code Here


      tagv1.setField(FieldKey.ALBUM, "New Concept Engl"); //$NON-NLS-1$
      tagv1.setField(FieldKey.TITLE, "New Concept Engli"); //$NON-NLS-1$
      tagv1.setField(FieldKey.ARTIST, "New Concept Englis"); //$NON-NLS-1$
      audioFile.setTag(tagv1);

      Tag tagv23 = new ID3v23Tag();
      tagv23.setField(FieldKey.ALBUM, "New Concept En"); //$NON-NLS-1$
      tagv23.setField(FieldKey.TITLE, "New Concept En"); //$NON-NLS-1$
      tagv23.setField(FieldKey.ARTIST, "New Concept "); //$NON-NLS-1$
      tagv23.setField(FieldKey.TRACK, "1"); //$NON-NLS-1$
      audioFile.setTag(tagv23);

      AudioFileIO.write(audioFile);
    } catch (CannotReadException e) {
      e.printStackTrace();
View Full Code Here

      tagv1.setField(FieldKey.YEAR, audioTag.getYear());
      tagv1.setField(FieldKey.GENRE, audioTag.getGenre());
      tagv1.setField(FieldKey.COMMENT, audioTag.getComment());
      audioFile.setTag(tagv1);

      Tag tagv23 = new ID3v23Tag();
      tagv23.setField(FieldKey.ALBUM, audioTag.getAlbum());
      tagv23.setField(FieldKey.TITLE, audioTag.getTitle());
      tagv23.setField(FieldKey.ARTIST, audioTag.getArtist());
      if (!audioTag.getTrack().isEmpty()) {
        tagv23.setField(FieldKey.TRACK, audioTag.getTrack());
      }
      tagv23.setField(FieldKey.YEAR, audioTag.getYear());
      tagv23.setField(FieldKey.GENRE, audioTag.getGenre());
      tagv23.setField(FieldKey.COMMENT, audioTag.getComment());
      tagv23.setField(FieldKey.ALBUM_ARTIST, audioTag.getAlbumArtist());
      audioFile.setTag(tagv23);

      AudioFileIO.write(audioFile);
    } catch (TagException e) {
      e.printStackTrace();
View Full Code Here

        return false;
    }

    private boolean isId3v23Tag() throws IOException {
        int id3tagsize;
        ID3v23Tag id3tag = new ID3v23Tag();
        ByteBuffer bb = ByteBuffer.allocate(AbstractID3v2Tag.TAG_HEADER_LENGTH);
        raf.seek(0);
        raf.getChannel().read(bb);
        if (id3tag.seek(bb)) {
            id3tagsize = id3tag.readSize(bb);
            raf.seek(id3tagsize);
            //FLAC Stream immediately after end of id3 tag
            if (isFlacHeader()) {
                return true;
            }
View Full Code Here

            tag.deleteField(FieldKey.TRACK);
          tag.addField(tag.createField(FieldKey.TRACK, "0"));
        }

        TagField field = tag.getFirstField(FieldKey.TRACK_TOTAL);
      ID3v24Frame frame = (ID3v24Frame) field;
      FrameBodyTRCK body = (FrameBodyTRCK) frame.getBody();
      body.setTrackTotal(Integer.valueOf(trackData.getTrackTotal()));

      trackFieldUpdated = true;
      }
      if (!trackFieldUpdated) {
        tag.deleteField(FieldKey.TRACK);
      }

      if (!Util.isEmpty(trackData.getDisc())) {
        tag.deleteField(FieldKey.DISC_NO);
        tag.addField(tag.createField(FieldKey.DISC_NO, trackData.getDisc()));
        discFieldUpdated = true;
      }
      if (!Util.isEmpty(trackData.getDiscTotal())) {
        if (!discFieldUpdated) {
            tag.deleteField(FieldKey.DISC_NO);
          tag.addField(tag.createField(FieldKey.DISC_NO, "0"));
        }

        TagField field = tag.getFirstField(FieldKey.DISC_TOTAL);
      ID3v24Frame frame = (ID3v24Frame) field;
      FrameBodyTPOS body = (FrameBodyTPOS) frame.getBody();
      body.setDiscTotal(Integer.valueOf(trackData.getDiscTotal()));

        discFieldUpdated = true;
      }
      if (!discFieldUpdated) {
View Full Code Here

    try {
      MP3File mp3file = new MP3File(rawFile);
      ArrayList<String> info = new ArrayList<String>();

      if (mp3file.hasID3v2Tag()) {
        ID3v24Tag id3v24tag = mp3file.getID3v2TagAsv24();

        info.add(id3v24tag.getFirst(ID3v24Frames.FRAME_ID_ARTIST).trim());
        info.add(id3v24tag.getFirst(ID3v24Frames.FRAME_ID_ALBUM).trim());
        info.add(id3v24tag.getFirst(ID3v24Frames.FRAME_ID_TITLE).trim());
        try {
          int year = new Integer(id3v24tag.getFirst(ID3v24Frames.FRAME_ID_YEAR).trim()).intValue();
          if (year > 0) {
            info.add(id3v24tag.getFirst(ID3v24Frames.FRAME_ID_YEAR).trim());
          }
        } catch (Exception ex) {
        }
        info.add(mp3file.getMP3AudioHeader().getTrackLengthAsString().trim());
        info.add(mp3file.getMP3AudioHeader().getBitRate().trim() + "kbps");
View Full Code Here

        {
            AudioFile f = AudioFileIO.read(file);
            Tag tag = f.getTag();
            if (tag == null)
            {
                tag = new ID3v24Tag();
            }
            tag.setField(FieldKey.ALBUM, song.getAlbum());
            tag.setField(FieldKey.ALBUM_ARTIST, song.getAlbumArtist());
            tag.setField(FieldKey.ARTIST, song.getArtist());
            tag.setField(FieldKey.COMPOSER, song.getComposer());
View Full Code Here

        {
            AudioFile f = AudioFileIO.read(file);
            Tag tag = f.getTag();
            if (tag == null)
            {
                tag = new ID3v24Tag();
            }
            tag.setField(FieldKey.ALBUM, track.getAlbum());
            tag.setField(FieldKey.ALBUM_ARTIST, track.getAlbumArtist());
            tag.setField(FieldKey.ARTIST, track.getArtist());
            tag.setField(FieldKey.COMPOSER, track.getComposer());
View Full Code Here

    }

    private void parseID3v2Tag( MP3File f ) {

        ID3v24Tag v2tag  = f.getID3v2TagAsv24();

        artistTitle = v2tag.getFirst( ID3v24Frames.FRAME_ID_ARTIST );
        albumArtist = v2tag.getFirst( FieldKey.ALBUM_ARTIST );
        albumTitle  = v2tag.getFirst( ID3v24Frames.FRAME_ID_ALBUM );
        trackTitle  = v2tag.getFirst( ID3v24Frames.FRAME_ID_TITLE );
        albumYear   = v2tag.getFirst( ID3v24Frames.FRAME_ID_YEAR );
        genre       = v2tag.getFirst( ID3v24Frames.FRAME_ID_GENRE );

        String trackN = v2tag.getFirst( ID3v24Frames.FRAME_ID_TRACK );

        if ( ! trackN.equals("") ) {
            try {
                trackNumber = Integer.parseInt(trackN);
            } catch (final NumberFormatException e) {
                log.warn("Could not parse track number: " + trackN, e);
            }
        }

        Artwork artwork = v2tag.getFirstArtwork();

        if ( artwork != null ) {
            try {
                coverArt = artwork.getImage();
            } catch (final IOException ioe) {
View Full Code Here

        } else {
            MP3File mp3File;
            try {
                mp3File = new MP3File(file, MP3File.LOAD_ALL, false);

                ID3v24Tag id3v2tag = mp3File.getID3v2TagAsv24();
                if (id3v2tag == null) {
                    id3v2tag = new ID3v24Tag();
                }
                copyTagFields(id3v2tag, track);

                ID3v11Tag id3v1Tag = new ID3v11Tag(id3v2tag);
                mp3File.setID3v1Tag(id3v1Tag);
View Full Code Here

TOP

Related Classes of org.jaudiotagger.tag.id3.framebody.FrameBodyTPOS

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.