Package org.farng.mp3

Examples of org.farng.mp3.InvalidTagException


    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);
      } else if (mp3.hasID3v1Tag()) {
        parse = getID3v1Parse(mp3);
      } else {
        throw new ParseException("No textual content available");
      }
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);
      } else if (mp3.hasID3v1Tag()) {
        parse = getID3v1Parse(mp3);
      } else {
        throw new ParseException("No textual content available");
      }
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(), 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

            // we have a parenthesis
            if (openIndex >= 0 && openIndex < token.length()) {
                close = option.getCloseParenthesis(open);
                closeIndex = TagUtility.findMatchingParenthesis(token, openIndex);
                if (closeIndex < 0) {
                    throw new TagException("Unmatched parenthesis in \"" + token + "\" at position : " + openIndex);
                }
                tokenArray = new String[5];
                tokenArray[0] = open;
                tokenArray[1] = close;
                tokenArray[2] = token.substring(0, openIndex);
View Full Code Here

            file.close();

            // copy, then delete
            TagUtility.copyFile(originalFile, newFile);
            if (!originalFile.delete()) {
                throw new TagException("Unable to delete original file: " + originalFile.getName());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.farng.mp3.InvalidTagException

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.