Package org.cmc.music.metadata

Examples of org.cmc.music.metadata.MusicMetadata


    if (artist == null)
      return null;
    if (artist.equalsIgnoreCase(VARIOUS_ARTISTS))
      artist = null;

    MusicMetadata result = new MusicMetadata("filename");

    result.setAlbum(album);
    result.setArtist(artist);
    result.setSongTitle(songTitle);
    if (trackNumberDescription != null)
      result.setTrackNumberDescription(trackNumberDescription);
    // result.getTrackNumber()

    return result;
  }
View Full Code Here


  }

  public IMusicMetadata parseTags(MyID3Listener listener, byte bytes[],
      boolean strict)
  {
    IMusicMetadata result = new MusicMetadata("ID3v1");

    int counter = 3;
    String title = getField(listener, bytes, counter, 30);
    counter += 30;
    result.setSongTitle(title);
    if (null != listener)
      listener.logWithLength("id3v1 title", title);

    String artist = getField(listener, bytes, counter, 30);
    counter += 30;
    result.setArtist(artist);
    if (null != listener)
      listener.logWithLength("id3v1 artist", artist);

    String album = getField(listener, bytes, counter, 30);
    counter += 30;
    result.setAlbum(album);
    if (null != listener)
      listener.logWithLength("id3v1 album", album);

    String yearString = getField(listener, bytes, counter, 4);
    counter += 4;
    Number year = null;
    try
    {
      if (null != yearString)
        year = Integer.valueOf(yearString);
    } catch (NumberFormatException e)
    {
      // ignore
    }
    result.setYear(year);
    if (null != listener)
    {
      listener.logWithLength("id3v1 year", yearString);
      if (null != yearString)
        listener.log("id3v1 year", year);
    }

    String comment = getField(listener, bytes, counter, 30);
    counter += 30;
    if (null != comment)
      result.addComment(comment);
    if (null != listener)
      listener.logWithLength("id3v1 comment", comment);

    if (bytes[counter - 2] == 0 && bytes[counter - 1] != 0)
    {
      int trackNumber = 0xff & bytes[counter - 1];
      // TODO: should we ignore 0x00 and 0xff track numbers?
      result.setTrackNumberNumeric(new Integer(trackNumber));

      if (null != listener)
        listener.log("id3v1 trackNumber: " + trackNumber);
    }

    int genre = 0xff & bytes[counter];
    if (genre < 80 && genre > 0)
    {
      result.setGenreID(new Integer(genre));
      result.setGenreName(ID3v1Genre.getNameForID(new Integer(genre)));

      if (null != listener)
        listener.log("id3v1 genre: " + genre);
    }
View Full Code Here

    return rectifier.rectifySongTitle(s);
  }

  public IMusicMetadata process(IMusicMetadata src)
  {
    IMusicMetadata result = new MusicMetadata(src.getMetadataName()
        + " clean", src);

    {
      String s = src.getArtist();
      // Debug.debug("before", s);
      s = processArtist(s);
      // Debug.debug("after", s);
      result.setArtist(s);
    }
    {
      String s = src.getAlbum();
      // Debug.debug("before album", s);
      s = processAlbum(s);
      // Debug.debug("after album", s);
      result.setAlbum(s);
    }
    {
      String s = src.getSongTitle();
      // Debug.debug("before", s);
      s = processSongTitle(s);
      // Debug.debug("after", s);
      result.setSongTitle(s);
    }

    return result;
  }
View Full Code Here

      throws ID3ReadException
  {
    // if (frames == null)
    // return null;
    //
    MusicMetadata result = new MusicMetadata("id3v2");

    for (int i = 0; i < TRANSLATORS.length; i++)
    {
      Translator translator = TRANSLATORS[i];
View Full Code Here

      throws ID3WriteException, IOException
  {
    Vector frames = new Vector();

    // make a local copy; we're going to clear keys as we translate them.
    metadata = new MusicMetadata(metadata);

    for (int i = 0; i < TRANSLATORS.length; i++)
    {
      Translator translator = TRANSLATORS[i];
View Full Code Here

  private List toFrames(MyID3Listener listener, boolean strict,
      IMusicMetadata metadata) throws UnsupportedEncodingException,
      IOException, ID3WriteException
  {
    // make a local copy.
    metadata = new MusicMetadata(metadata);

    IFrameFactory frameFactory = new FrameFactory();
    return ID3v2FrameTranslation.translateMetadataToFrames(listener,
        strict, metadata, frameFactory);
  }
View Full Code Here

TOP

Related Classes of org.cmc.music.metadata.MusicMetadata

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.