Package Resources

Examples of Resources.IDInfo


    category = new IDNode("Mp3 Datein");
    top.add(category);

    // original Tutorial
    mp3 = new IDNode(new IDInfo("JonneyEnglish.mp3","c:\\","Intpret2", "rock n roll",
        "adele21", 2011));
    category.add(mp3);
    mp3 = new IDNode(new IDInfo("SuckerPunch.mp3","c:\\","Intpret1", "rock",
        "franziska", 2011));
    category.add(mp3);
    mp3 = new IDNode(new IDInfo("mp32.mp3","c:\\","Intpret1", "rockers",
        "sanjeet", 2011));
    category.add(mp3);

  }
View Full Code Here


    * returns IDInfo
    */
  public  IDInfo readID3 (String filePath) throws IOException {
    String fileName = null;
    BinaryReader in = null;
    IDInfo id3 ;
    String title = null;
    String album = null;
    String interpret = null;
    int year = 0;
   
   
    try {
      in = new BinaryReader(filePath);
     
      // check for ID3 tag     
      if (!(in.readASCIChars(3).equals(new String("ID3")))) {
        throw new IOException();
      }
     
     
      // check correct version
      if(in.read() != 3){
        throw new IOException();
      }
     
     
      // skip revision number of version (1 bytes)
      in.skip(1);
     
      // read flags (check extended header)
      if ((in.read() & 64) == 64) {
        // TODO: read extended header and skip extended header and CRC data
        System.out.println("ja");
        throw new IOException();
      }
     
      // skip tag size (4 bytes)
      in.skip(4);
     
      String frame_id = in.readASCIChars(4);
      System.out.println(frame_id);
     
      // searching for frame_id
      //TODO: Interpret hinzufügen, bild
      //TODO: in Methode auslagern
      while(!( (frame_id.equals(new String("TALB")) || frame_id.equals(new String("TIT2")) || frame_id.equals(new String("TYER")))) ){
        // read frame size
        long sizeFrameBody = in.read();
        sizeFrameBody = sizeFrameBody << 8;
        sizeFrameBody += in.read();
        sizeFrameBody = sizeFrameBody << 8;
        sizeFrameBody += in.read();
        sizeFrameBody = sizeFrameBody << 8;
        sizeFrameBody += in.read();
       
        //long sizeFrameBody = in.read();
        long skippingSize = sizeFrameBody + 2;
       
        //skip frame
        in.skip(skippingSize);
        frame_id = in.readASCIChars(4);
        System.out.println(frame_id);
      }
     
      //
      if(frame_id.equals(new String("TIT2"))){
       
        title = readSingleInf(in, frame_id);
      }
      if(frame_id.equals(new String("TALB"))){
       
        album = readSingleInf(in, frame_id);
      }
    //  if(frame_id.equals(new String("TYER")))
    //  year = (int)readInf(in, frame_id);
      else{
        System.out.println("nein");
      }
     
       
     
    } finally {
      if (in != null) {
                in.close();
            }     
    }
 
    //IDInfo id3 = new IDInfo("sanjeet.mp3","c:\\","Intpret2", "bla bla", "sdfjsdfj", 2011);
   
    id3 = new IDInfo(fileName,filePath, interpret, title, album, year);
    System.out.println(filePath +", " + title + ", "  + album);
    return id3;
  }
View Full Code Here

TOP

Related Classes of Resources.IDInfo

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.