Coverage Report - org.jaudiotagger.test.TestCreatingTag
 
Classes in this File Line Coverage Branch Coverage Complexity
TestCreatingTag
0%
0/36
0%
0/4
10
 
 1  
 package org.jaudiotagger.test;
 2  
 
 3  
 import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException;
 4  
 import org.jaudiotagger.audio.exceptions.ReadOnlyFileException;
 5  
 import org.jaudiotagger.audio.mp3.MP3File;
 6  
 import org.jaudiotagger.tag.TagException;
 7  
 import org.jaudiotagger.tag.id3.AbstractID3v2Tag;
 8  
 import org.jaudiotagger.tag.id3.ID3v23Frame;
 9  
 import org.jaudiotagger.tag.id3.ID3v23Tag;
 10  
 import org.jaudiotagger.tag.id3.framebody.FrameBodyTCOP;
 11  
 
 12  
 import java.io.File;
 13  
 import java.io.FileNotFoundException;
 14  
 import java.io.IOException;
 15  
 
 16  
 /**
 17  
  */
 18  0
 public class TestCreatingTag
 19  
 {
 20  
     public static void main(final String[] args)
 21  
     {
 22  0
         MP3File mp3 = null;
 23  
         // Open the MP3 File
 24  
         try
 25  
         {
 26  0
             mp3 = new MP3File("D:/Code/jthink/opensrc/jaudiotagger/testdatatmp/testv1.mp3");
 27  
         }
 28  0
         catch (IOException e)
 29  
         {
 30  
             // TODO Auto-generated catch block
 31  0
             e.printStackTrace();
 32  
         }
 33  0
         catch (TagException e)
 34  
         {
 35  
             // TODO Auto-generated catch block
 36  0
             e.printStackTrace();
 37  
         }
 38  0
         catch (ReadOnlyFileException e)
 39  
         {
 40  
             // TODO Auto-generated catch block
 41  0
             e.printStackTrace();
 42  
         }
 43  0
         catch (InvalidAudioFrameException e)
 44  
         {
 45  
             // TODO Auto-generated catch block
 46  0
             e.printStackTrace();
 47  0
         }
 48  0
         if (mp3.hasID3v2Tag())
 49  
         {
 50  0
             AbstractID3v2Tag tag = mp3.getID3v2Tag();
 51  0
             if (tag.hasFrameOfType("TCOP"))
 52  
             {
 53  0
                 System.out.println("A TCOP frame has been   found");
 54  0
                 Object currentFrame = tag.getFrame("TCOP");
 55  0
                 System.out.println(currentFrame.toString());
 56  0
             }
 57  
             else
 58  
             {
 59  0
                 FrameBodyTCOP fBodyTCOP = new FrameBodyTCOP();
 60  0
                 fBodyTCOP.setText("4 Text to be displayed");
 61  
                 //Create TCOP frame and add it to the MP3
 62  0
                 ID3v23Frame frameTCOP = new ID3v23Frame("TCOP");
 63  0
                 frameTCOP.setBody(fBodyTCOP);
 64  0
                 ID3v23Tag tagTCOP = new ID3v23Tag();
 65  0
                 tagTCOP.setFrame(frameTCOP);
 66  0
                 mp3.setID3v2TagOnly(tagTCOP);
 67  
             }
 68  
         }
 69  
 
 70  0
         File overRight = new File("D:/Code/jthink/opensrc/jaudiotagger/testdatatmp/testv1.mp3");
 71  
         try
 72  
         {
 73  
             //mp3.setFile(overRight);
 74  
             //mp3.save(overRight);
 75  0
             mp3.save();
 76  
         }
 77  0
         catch (FileNotFoundException e)
 78  
         {
 79  
             // TODO Auto-generated catch block
 80  0
             e.printStackTrace();
 81  
         }
 82  0
         catch (IOException e)
 83  
         {
 84  
             // TODO Auto-generated catch block
 85  0
             e.printStackTrace();
 86  
         }
 87  0
         catch (TagException e)
 88  
         {
 89  
             // TODO Auto-generated catch block
 90  0
             e.printStackTrace();
 91  0
         }
 92  0
     }
 93  
 }