Package entagged.audioformats.mp3.util.id3frames

Examples of entagged.audioformats.mp3.util.id3frames.GenericId3Frame


    }
    /*
     * Now convert some Special Fields.
     */
    // TDAT, TIME and TYEAR -> to -> TDRC
    TimeId3Frame tdrc = createTimeField((TextId3Frame) specialStore
        .get(DATE), (TextId3Frame) specialStore.get(TIME),
        (TextId3Frame) specialStore.get(YEAR));
    source.set(tdrc);
    source.setRepresentedVersion(Id3v2Tag.ID3V24);
    return source;
View Full Code Here


   *            The old TYER field. Maybe <code>null</code>
   * @return A time field containing given data.
   */
  private static TimeId3Frame createTimeField(TextId3Frame tdat,
      TextId3Frame time, TextId3Frame tyer) {
    TimeId3Frame result = null;
    Calendar calendar = new GregorianCalendar();
    calendar.clear();
    try {
      if (tdat != null) {
        if (tdat.getContent().length() == 4) {
          calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(tdat
              .getContent().substring(0, 2)));
          calendar.set(Calendar.MONTH, Integer.parseInt(tdat
              .getContent().substring(2, 4)) - 1);
        } else {
          System.err
              .println("Field TDAT ignroed, since it is not spec conform: \""
                  + tdat.getContent() + "\"");
        }
      }
      if (time != null) {
        if (time.getContent().length() == 4) {
          calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(time
              .getContent().substring(0, 2)));
          calendar.set(Calendar.MINUTE, Integer.parseInt(time
              .getContent().substring(2, 4)));
        } else {
          System.err
              .println("Field TIME ignroed, since it is not spec conform: \""
                  + time.getContent() + "\"");
        }
      }
      if (tyer != null) {
        if (tyer.getContent().length() == 4) {
          calendar.set(Calendar.YEAR, Integer.parseInt(tyer
              .getContent()));
        } else {
          System.err
              .println("Field TYER ignroed, since it is not spec conform: \""
                  + tyer.getContent() + "\"");
        }
      }
      result = new TimeId3Frame(RECORD_DAT, calendar);
    } catch (NumberFormatException e) {
      System.err.println("Numberformatexception occured "
          + "in timestamp interpretation, date is set to zero.");
      e.printStackTrace();
      calendar.clear();
View Full Code Here

    // Comment
    else if (field.startsWith("COMM"))
      return new CommId3Frame(data, version);
    // Universal file id
    else if (field.startsWith("UFID"))
      return new UfidId3Frame(data, version);
    else if (field.startsWith("APIC"))
      return new ApicId3Frame(data, version);
    // Any other frame
    else
      return new GenericId3Frame(field, data, version);
View Full Code Here

TOP

Related Classes of entagged.audioformats.mp3.util.id3frames.GenericId3Frame

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.