Package org.jaudiotagger.tag.id3.framebody

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

@author : Paul Taylor @author : Eric Farng @version $Id: FrameBodyIPLS.java 923 2010-10-16 21:59:49Z paultaylor $

      else if (frame.getBody() instanceof FrameBodyCOMM) {
        FrameBodyCOMM body = (FrameBodyCOMM) frame.getBody();
        track.getTrackData().addComment(body.getText());
      }
      else if (frame.getBody() instanceof FrameBodyPOPM) {
        FrameBodyPOPM body = (FrameBodyPOPM) frame.getBody();
        track.getTrackData().addRating(String.valueOf(body.getRating()));
      }
      else if (frame.getBody() instanceof AbstractFrameBodyTextInfo) {
        AbstractFrameBodyTextInfo body = (AbstractFrameBodyTextInfo) frame.getBody();
        for (int i = 0; i < body.getNumberOfValues(); i++) {
          track.getTrackData().addTagFieldValues(key, body.getValueAtIndex(i));
        }
      }
    }
  }
View Full Code Here


        else if (FieldKey.TRACK_TOTAL.equals(key)) {
          track.getTrackData().addTrackTotal(body.getTrackTotal());
        }
      }
      else if (frame.getBody() instanceof FrameBodyTPOS) {
        FrameBodyTPOS body = (FrameBodyTPOS) frame.getBody();
        if (FieldKey.DISC_NO.equals(key)) {
          track.getTrackData().addDisc(body.getDiscNo());
        }
        else if (FieldKey.DISC_TOTAL.equals(key)) {
          track.getTrackData().addDiscTotal(body.getDiscTotal());
        }
      }
      else if (frame.getBody() instanceof FrameBodyCOMM) {
        FrameBodyCOMM body = (FrameBodyCOMM) frame.getBody();
        track.getTrackData().addComment(body.getText());
      }
      else if (frame.getBody() instanceof FrameBodyPOPM) {
        FrameBodyPOPM body = (FrameBodyPOPM) frame.getBody();
        track.getTrackData().addRating(String.valueOf(body.getRating()));
      }
      else if (frame.getBody() instanceof AbstractFrameBodyTextInfo) {
        AbstractFrameBodyTextInfo body = (AbstractFrameBodyTextInfo) frame.getBody();
        for (int i = 0; i < body.getNumberOfValues(); i++) {
          track.getTrackData().addTagFieldValues(key, body.getValueAtIndex(i));
        }
      }
    }
  }
View Full Code Here

          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) {
        tag.deleteField(FieldKey.DISC_NO);
View Full Code Here

    }

    for (TagField field : fields) {
      ID3v24Frame frame = (ID3v24Frame) field;
      if (frame.getBody() instanceof FrameBodyTRCK) {
        FrameBodyTRCK body = (FrameBodyTRCK) frame.getBody();
        if (FieldKey.TRACK.equals(key)) {
          track.getTrackData().addTrack(body.getTrackNo());
        }
        else if (FieldKey.TRACK_TOTAL.equals(key)) {
          track.getTrackData().addTrackTotal(body.getTrackTotal());
        }
      }
      else if (frame.getBody() instanceof FrameBodyTPOS) {
        FrameBodyTPOS body = (FrameBodyTPOS) frame.getBody();
        if (FieldKey.DISC_NO.equals(key)) {
          track.getTrackData().addDisc(body.getDiscNo());
        }
        else if (FieldKey.DISC_TOTAL.equals(key)) {
          track.getTrackData().addDiscTotal(body.getDiscTotal());
        }
      }
      else if (frame.getBody() instanceof FrameBodyCOMM) {
        FrameBodyCOMM body = (FrameBodyCOMM) frame.getBody();
        track.getTrackData().addComment(body.getText());
      }
      else if (frame.getBody() instanceof FrameBodyPOPM) {
        FrameBodyPOPM body = (FrameBodyPOPM) frame.getBody();
        track.getTrackData().addRating(String.valueOf(body.getRating()));
      }
      else if (frame.getBody() instanceof AbstractFrameBodyTextInfo) {
        AbstractFrameBodyTextInfo body = (AbstractFrameBodyTextInfo) frame.getBody();
        for (int i = 0; i < body.getNumberOfValues(); i++) {
          track.getTrackData().addTagFieldValues(key, body.getValueAtIndex(i));
        }
      }
    }
  }
View Full Code Here

          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) {
        tag.deleteField(FieldKey.DISC_NO);
View Full Code Here

    @Override
    protected TagData getTagData(TagField tagField) {
        if (tagField instanceof TagTextField) {
            TagTextField vtf = (TagTextField) tagField;
            if (tagField instanceof AbstractID3v2Frame && ((AbstractID3v2Frame) tagField).getBody() instanceof FrameBodyTXXX) {
                FrameBodyTXXX t = (FrameBodyTXXX) ((AbstractID3v2Frame) tagField).getBody();
                return new TagData(t.getDescription(), vtf.getContent(), vtf.getContent().toUpperCase());
            } else if (tagField instanceof AbstractID3v2Frame) {
                return new TagData(vtf.getId(), vtf.getContent(), vtf.getContent().toUpperCase());
            }
        }
        return null;
View Full Code Here

        try {
            Class<AbstractID3v2FrameBody> c = (Class<AbstractID3v2FrameBody>) Class.forName("org.jaudiotagger.tag.id3.framebody.FrameBody" + identifier);
            frameBody = c.newInstance();
        } catch (ClassNotFoundException cnfe) {
            logger.severe(cnfe.getMessage());
            frameBody = new FrameBodyUnsupported(identifier);
        }
        //Instantiate Interface/Abstract should not happen
        catch (InstantiationException ie) {
            logger.log(Level.SEVERE, "InstantiationException:" + identifier, ie);
            throw new RuntimeException(ie);
View Full Code Here

        }
        //No class defined for this frame type,use FrameUnsupported
        catch (ClassNotFoundException cex) {
            //logger.info(getLoggingFilename() + ":" + "Identifier not recognised:" + identifier + " using FrameBodyUnsupported");
            try {
                frameBody = new FrameBodyUnsupported(byteBuffer, frameSize);
            }
            //Should only throw InvalidFrameException but unfortunately legacy hierachy forces
            //read method to declare it can throw InvalidtagException
            catch (InvalidFrameException ife) {
                throw ife;
View Full Code Here

        try {
            Class<AbstractID3v2FrameBody> c = (Class<AbstractID3v2FrameBody>) Class.forName("org.jaudiotagger.tag.id3.framebody.FrameBody" + bodyIdentifier);
            frameBody = c.newInstance();
        } catch (ClassNotFoundException cnfe) {
            logger.log(Level.SEVERE, cnfe.getMessage(), cnfe);
            frameBody = new FrameBodyUnsupported(identifier);
        }
        //Instantiate Interface/Abstract should not happen
        catch (InstantiationException ie) {
            logger.log(Level.SEVERE, ie.getMessage(), ie);
            throw new RuntimeException(ie);
View Full Code Here

                //logger.info("DEPRECATED:Orig id is:" + frame.getIdentifier() + ":New id is:" + identifier);
            }
        }
        // Unknown Frame e.g NCON
        else {
            this.frameBody = new FrameBodyUnsupported((FrameBodyUnsupported) frame.getBody());
            identifier = frame.getIdentifier();
            //logger.info("v2:UNKNOWN:Orig id is:" + frame.getIdentifier() + ":New id is:" + identifier);
        }
    }
View Full Code Here

TOP

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

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.