Package org.cmc.music.myid3

Examples of org.cmc.music.myid3.UnicodeMetrics$UnicodeMetricsUTF16WithBOM


      {
        Debug.debug("log: " + s);
      }
    };

    MusicMetadataSet srcSet = new MyID3().read(mp3File, listener);

    Debug.debug("srcSet", srcSet);

    String name = mp3File.getName();
    if (name.toLowerCase().endsWith(".mp3"))
      name = name.substring(0, name.length() - 4);
    name += ".1.mp3";
    File temp = new File(mp3File.getParentFile(), name);

    MyID3v2Write.Filter filter = new MyID3v2Write.Filter() {
      public boolean filter(String frameid)
      {
        /*
         * Only write "song title" and "album name" frames.
         *
         * Discard all others (such as "artist name").
         */
        if (frameid.equals("TIT2"))
          return false;
        if (frameid.equals("TALB"))
          return false;

        return true;
      }
    };

    IMusicMetadata metadata = srcSet.merged;
    new MyID3().write(mp3File, temp, srcSet, metadata, filter, listener);

    MusicMetadataSet temp_set = new MyID3().read(temp, listener);
  }
View Full Code Here


      return;

    Debug.debug();
    Debug.debug("file", mp3File);

    MusicMetadataSet src_set = new MyID3().read(mp3File);

    if (src_set == null)
    {
      Debug.debug("No id3 metadata found.");
      return;
View Full Code Here

      return;

    Debug.debug();
    Debug.debug("file", mp3File);

    MusicMetadataSet src_set = new MyID3().read(mp3File);

    if (src_set == null)
    {
      Debug.debug("No id3 metadata found.");
      return;
View Full Code Here

      return;

    Debug.debug();
    Debug.debug("file", mp3File);

    MusicMetadataSet src_set = new MyID3().read(mp3File);

    if (src_set == null)
    {
      Debug.debug("No id3 metadata found.");
      return;
View Full Code Here

      Debug.debug();
      Debug.debug("file", src);

      File dst = new File(dstFolder, src.getName());

      MusicMetadataSet src_set = new MyID3().read(src);

      if (src_set == null)
      {
        System.out.println("No id3 metadata found.");
        continue;
      }

      Debug.debug("src_set", src_set); // dump all info.
      Debug.debug("src_set", src_set.merged.getArtist());
      Debug.debug("src_set", src_set.merged.getAlbum());
      Debug.debug("src_set", src_set.merged.getSongTitle());

      String id3v1_artist = src_set.id3v1Raw.values.getArtist();
      String id3v2_artist = src_set.id3v2Raw.values.getArtist();

      byte id3v1_tag_bytes[] = src_set.id3v1Raw.bytes; // tag bytes
      byte id3v2_tag_bytes[] = src_set.id3v2Raw.bytes; // tag bytes

      Vector id3v2_frames = src_set.id3v2Raw.frames; //
      if (id3v2_frames.size() > 1)
      {
        MyID3v2Frame first_frame = (MyID3v2Frame) id3v2_frames.get(0);
        String frame_frame_id = first_frame.frameID;
        byte frame_frame_bytes[] = first_frame.dataBytes;
      }

      new MyID3().write(src, dst, src_set, src_set.merged);
      if (dst.exists())
      {
        MusicMetadataSet dst_set = new MyID3().read(dst);
        Debug.debug("dst_set", dst_set);

        String src_s = src_set.merged.toString();
        String dst_s = dst_set.merged.toString();
        if (!src_s.equals(dst_s))
View Full Code Here

  public static void setFieldExample(File srcFile, File dstFile, String artist)
      throws Exception
  {
    // Since this is an example, I do no checking of parameters.

    MusicMetadataSet src_set = new MyID3().read(srcFile);

    IMusicMetadata metadataToWrite;
    if (src_set != null)
    {
      // The source file DID have an ID3v1 or ID3v2 tag (or both).
      // We'll update those values.
      metadataToWrite = src_set.merged;
    } else
    {
      // The file did not have an ID3v1 or ID3v2 tag, so
      // we need to add new tag(s).
      metadataToWrite = MusicMetadata.createEmptyMetadata();
    }

    // here we set or update the artist field.
    metadataToWrite.setArtist(artist);

    new MyID3().write(srcFile, dstFile, src_set, metadataToWrite);
  }
View Full Code Here

  public HashMap<String, String> parseFile(String Media, String FilePath) {
   
    File File = new File(FilePath);
   
    try {
      IMusicMetadata Tags = new MyID3().read(File).getSimplified();
     
      ParsedData.put("title", Tags.getSongTitle());
      ParsedData.put("artist", Tags.getArtist());
     
    } catch (Exception e) {}
View Full Code Here

     * The listener receives log message as the library parses and writes
     * the mp3 file.
     *
     * It writes them to the console using the Debug class.
     */
    MyID3Listener listener = new MyID3Listener() {
      public void log()
      {
        Debug.debug();
      }

View Full Code Here

  {
    if (listener != null)
      listener.log("reading string with encoding",
          getCharacterEncodingFullName(charEncodingCode));

    UnicodeMetrics unicodeMetrics = UnicodeMetrics
        .getInstance(charEncodingCode);
    int unicodeMetricsEnd = unicodeMetrics.findEndWithoutTerminator(bytes,
        start);
    int unicodeMetricsLength = unicodeMetricsEnd - start;

    String charsetName = getCharacterEncodingName(charEncodingCode);
    return new String(bytes, start, unicodeMetricsLength, charsetName);
View Full Code Here

  }

  private int findStringDataLength(byte bytes[], int start,
      int charEncodingCode) throws IOException
  {
    UnicodeMetrics unicodeMetrics = UnicodeMetrics
        .getInstance(charEncodingCode);
    int unicodeMetricsEnd = unicodeMetrics.findEndWithTerminator(bytes,
        start);
    int unicodeMetricsLength = unicodeMetricsEnd - start;
    return unicodeMetricsLength;
  }
View Full Code Here

TOP

Related Classes of org.cmc.music.myid3.UnicodeMetrics$UnicodeMetricsUTF16WithBOM

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.