Package org.jaudiotagger.audio.mp3

Examples of org.jaudiotagger.audio.mp3.MP3File


    public void display()
    {
  clear();

  try {
      MP3File m = new MP3File(getFile());
     
      jtAlbum.setText(m.getAlbum());
      jtArtist.setText(m.getArtist());
      jtTitle.setText(m.getTitle());
      jtYear.setText(m.getYear());
      jtComment.setText(m.getComment());

      // why call getFile().canRead()? an IOException should have
      // occured if we could not read the file
      setEnabled(getFile().canWrite());
  }
View Full Code Here


     * Writes id3 tags to file.
     */
    protected void save()
    {
  try {
      MP3File m = new MP3File(getFile());

      m.setTitle(jtTitle.getText());
      m.setArtist(jtArtist.getText());
      m.setAlbum(jtAlbum.getText());
      m.setYear(jtYear.getText());
      m.setComment(jtComment.getText());

      m.writeTags();

      setStatus(XNap.tr("Changes successfully saved."));
  }
  catch (Exception e) {
      setStatus(XNap.tr("Could not write ID Tags to file"));
View Full Code Here

    this.fileName = file.getName();
    File sub = oneUp(file);
    this.subDirectory = sub.getName();
    this.rootDirectory = oneUp(sub).getName();

    MP3File mp3File = new MP3File(file);
    try {
      tag1 = mp3File.getID3V1Tag();
      if(tag1==null){
        tag1 = new ID3V1_0Tag();
      }
    } catch (ID3Exception e) {
      tag1 = new ID3V1_0Tag();
View Full Code Here

    return nullGuard(parameters.get("full"));

  }

  public void persist(String directory) {
    MP3File mp3File = new MP3File(new File(directory + getFull()));
    ID3V1Tag tag1 = null;
    try {
      tag1 = mp3File.getID3V1Tag();
      if(tag1==null){
        tag1 = new ID3V1_0Tag();
      }
    } catch (ID3Exception e) {
      tag1 = new ID3V1_0Tag();
    }
    if(!"".equals(getTitle())) tag1.setTitle(getTitle());
    tag1.setAlbum(getAlbum());
    tag1.setArtist(getArtist());
    tag1.setComment(getComment());
    try {
      tag1.setGenre(Genre.lookupGenre(getGenre()));
    } catch (ID3Exception e) {
    }
    tag1.setYear(getYear());
    mp3File.setID3Tag(tag1);
    try {
      mp3File.sync();
    } catch (ID3Exception e) {
    }
  }
View Full Code Here

*/
public class MP3 {

    public static void main(String[] args) {
        try {
            MP3File mp3 = new MP3File(new File("C:/JPlayer/teste2.mp3"));
            TagOptionSingleton.getInstance().setDefaultSaveMode(TagConstant.MP3_FILE_SAVE_OVERWRITE);

//            // setup id3v1
//            ID3v1 id3v1 = mp3.getID3v1Tag();
//            Iterator t = id3v1.iterator();
//            id3v1.setTitle("Oi2");
//            mp3.setID3v1Tag(id3v1);


            mp3.getID3v2Tag().setAlbumTitle("owwwww");



//            // setup id3v2
//            AbstractID3v2Frame frame;
//            AbstractID3v2FrameBody frameBody;
//            frameBody = new FrameBodyTALB((byte) 0, "albumTitle");
//            frame = new ID3v2_4Frame(frameBody);

//            mp3.getID3v2Tag().setFrame(frame);
//
//            // setup lyrics3v2
//            AbstractLyrics3 lyrics3 = mp3.getLyrics3Tag();
//
//            Lyrics3v2Field field;
//            AbstractLyrics3v2FieldBody fieldBody;
//            fieldBody = new FieldBodyEAL("albumTitle");
//            field = new Lyrics3v2Field(fieldBody);
//            lyrics3.setField(field);
//
            // setup filename tag
//            frameBody = new FrameBodyTALB((byte) 0, "albumTitle");
//            frame = new ID3v2_4Frame(frameBody);
//            filenameId3.setFrame(frame);
            TagOptionSingleton.getInstance().setFilenameTagSave(true);

            mp3.save();
           


            System.out.println(mp3.toString());
        } catch (Exception ex) {
            Logger.getLogger(MP3.class.getName()).log(Level.SEVERE, null, ex);
        }


View Full Code Here

        montarGeneros();
        jTextField_Interp.setCrepzBuscador(this);
        jTextField_Album.setCrepzBuscador(this);

        try {
            mp3File = new MP3File(musica.getCaminho());
            setDadosv2();
        } catch (IOException ex) {
            throw new Exception("-Erro ao Carregar Propriedades do arquivo " + musica.getNome() + " \n", ex);
        } catch (TagException ex) {
            throw new Exception("-Erro ao Carregar Propriedades do arquivo " + mp3File.getMp3file().getName() + " \n", ex);
View Full Code Here

                String caminho = file.getAbsolutePath().trim().replace('\\', '/');
                if (listaNegra.contains(caminho)) {
                    System.out.println("Não importado, pois está na lista temporária de regeição: " + caminho);
                    return null;
                }
                MP3File mp3;
                try {
                    mp3 = new MP3File(caminho);
                    MusicaS musica = getMusica(mp3, file);
                    if (organizarPastas) {
                        File destinoF = new File(destino);
                        destinoF.mkdirs();
                        destinoF = new File(destinoF.getAbsolutePath() + "/" + file.getName());
                        if (!destinoF.getAbsolutePath().equals(file.getAbsolutePath())) {
                            if (file.renameTo(destinoF)) {
                                file = destinoF;
                            }
                            caminho = file.getAbsolutePath().replace('\\', '/');
                            mp3 = new MP3File(caminho);
                            musica = getMusica(mp3, file);
                        }

                    }
                    if (musica != null) {
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

    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

TOP

Related Classes of org.jaudiotagger.audio.mp3.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.