Package org.farng.mp3.id3

Examples of org.farng.mp3.id3.ID3v2_4


     * and then used here.
     *
     * @param mp3tag Any MP3Tag object can be used and will be converted into a new ID3v2_4 object.
     */
    public void setID3v2Tag(final AbstractMP3Tag mp3tag) {
        id3v2tag = new ID3v2_4(mp3tag);
    }
View Full Code Here


     * exists in two or more tags but is not equal across all of them.
     *
     * @return a HashSet of unsynchronized fragments
     */
    public Set getUnsynchronizedFragments() {
        final ID3v2_4 total = new ID3v2_4(id3v2tag);
        final Set set = new HashSet(32);
        total.append(id3v1tag);
        total.append(lyrics3tag);
        total.append(filenameTag);
        total.append(id3v2tag);
        final ID3v2_4 id3v1 = new ID3v2_4(id3v1tag);
        final ID3v2_4 lyrics3 = new ID3v2_4(lyrics3tag);
        final ID3v2_4 filename = new ID3v2_4(filenameTag);
        final AbstractID3v2 id3v2 = id3v2tag;
        final Iterator iterator = total.iterator();
        while (iterator.hasNext()) {
            final AbstractID3v2Frame frame = (AbstractID3v2Frame) iterator.next();
            final String identifier = frame.getIdentifier();
            if (id3v2 != null) {
                if (id3v2.hasFrame(identifier)) {
                    if (!id3v2.getFrame(identifier).isSubsetOf(frame)) {
                        set.add(identifier);
                    }
                }
            }
            if (id3v1.hasFrame(identifier)) {
                if (!id3v1.getFrame(identifier).isSubsetOf(frame)) {
                    set.add(identifier);
                }
            }
            if (lyrics3.hasFrame(identifier)) {
                if (!lyrics3.getFrame(identifier).isSubsetOf(frame)) {
                    set.add(identifier);
                }
            }
            if (filename.hasFrame(identifier)) {
                if (!filename.getFrame(identifier).isSubsetOf(frame)) {
                    set.add(identifier);
                }
            }
        }
        return set;
View Full Code Here

            // adjustid3v2padding needs all handles on the file closed;
            rfile = new RandomAccessFile(file, "rw");
            if (TagOptionSingleton.getInstance().isId3v2Save()) {
                if (id3v2tag == null) {
                    if (saveMode == TagConstant.MP3_FILE_SAVE_OVERWRITE) {
                        (new ID3v2_4()).delete(rfile);
                    }
                } else {
                    if (saveMode == TagConstant.MP3_FILE_SAVE_WRITE) {
                        id3v2tag.write(rfile);
                    } else if (saveMode == TagConstant.MP3_FILE_SAVE_APPEND) {
View Full Code Here

     * Creates a new FilenameTag object.
     */
    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

     * @param frame the frame to set
     */
    public void setFrame(final AbstractID3v2Frame frame) {
        if (frame != null) {
            if (id3tag == null) {
                id3tag = new ID3v2_4();
            }
            id3tag.setFrame(frame);
            if (composite != null) {
                composite.setFrame(frame);
            }
View Full Code Here

        }
        return stringBuffer.toString();
    }

    public ID3v2_4 createId3Tag() {
        ID3v2_4 newTag = null;
        if (beforeComposite != null) {
            newTag = beforeComposite.createId3Tag();
        }
        if (afterComposite != null) {
            if (newTag != null) {
                newTag.append(afterComposite.createId3Tag());
            } else {
                newTag = afterComposite.createId3Tag();
            }
        }
        return newTag;
View Full Code Here

                final Lyrics3v2Field newField = new Lyrics3v2Field(new FieldBodyLYR(lyricOld.getLyric()));
                fieldMap.put(newField.getIdentifier(), newField);
            } else {
                Lyrics3v2Field newField;
                final Iterator iterator;
                iterator = (new ID3v2_4(mp3tag)).iterator();
                while (iterator.hasNext()) {
                    try {
                        newField = new Lyrics3v2Field((AbstractID3v2Frame) iterator.next());
                        this.fieldMap.put(newField.getIdentifier(), newField);
                    } catch (TagException ex) {
View Full Code Here

     * @param abstractMP3Tag superset tag
     *
     * @return true if this tag is a subset of the argument
     */
    public boolean isSubsetOf(final AbstractMP3Tag abstractMP3Tag) {
        final AbstractID3v2 subset = new ID3v2_4(this);
        final AbstractID3v2 superset = new ID3v2_4(abstractMP3Tag);
        final Iterator iterator = subset.iterator();
        while (iterator.hasNext()) {
            final AbstractID3v2Frame subsetFrame = (AbstractID3v2Frame) iterator.next();
            final String identifier = subsetFrame.getIdentifier();
            final AbstractID3v2Frame supersetFrame = superset.getFrame(identifier);
            if (supersetFrame == null) {
                return false;
            }
            if (!subsetFrame.isSubsetOf(supersetFrame)) {
                return false;
View Full Code Here

        return composite;
    }

    public static FilenameTag createEmptyFilenameTag() {
        final FilenameTag filenameTag = new FilenameTag();
        filenameTag.setId3tag(new ID3v2_4());
        return filenameTag;
    }
View Full Code Here

    public static FilenameTag createFilenameTagFromMP3File(final MP3File mp3File) throws Exception {
        FilenameTag filenameTag = null;
        if (mp3File.getMp3file() != null) {
            filenameTag = new FilenameTag();
            final AbstractFilenameComposite composite;
            final ID3v2_4 id3tag;
            String filename = mp3File.getMp3file().getName();
            final int index = filename.lastIndexOf((int) '.');
            if (index >= 0) {
                filenameTag.setExtension(filename.substring(index + 1));
                filename = filename.substring(0, index);
View Full Code Here

TOP

Related Classes of org.farng.mp3.id3.ID3v2_4

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.