Pergunta

Eu preciso de arquivos MP3 tag com um Cover Art em C # ...

Existe alguma maneira fácil de fazer isso? Eu encontrei UltraID3Lib como um exampel e é ótimo para a marcação ID3 regular, mas eu não posso lidar com a arte da capa. Se alguém sabe uma maneira fácil de fazer isso seria ótimo:)

Foi útil?

Solução

eu fizer algo como este :

private static void FixAlbumArt(FileInfo MyFile)
{
  //Find the jpeg file in the directory of the Mp3 File
  //We will embed this image into the ID3v2 tag
  FileInfo[] fiAlbumArt = MyFile.Directory.GetFiles("*.jpg");
  if (fiAlbumArt.Length < 1)
  {
    Console.WriteLine("No Album Art Found in {0}", MyFile.Directory.Name);
    return;
  }
  string AlbumArtFile = fiAlbumArt[0].FullName;

  //Create Mp3 Object
  UltraID3 myMp3 = new UltraID3();
  myMp3.Read(MyFile.FullName);
  ID3FrameCollection myArtworkCollection =
    myMp3.ID3v23Tag.Frames.GetFrames(MultipleInstanceFrameTypes.Picture);

  if (myArtworkCollection.Count > 0)
  {//Get Rid of the Bad Embedded Artwork
    #region Remove All Old Artwork
    for (int i = 0; i < myArtworkCollection.Count; i++)
    {
      ID3PictureFrame ra = (ID3PictureFrame)myArtworkCollection[0];
      try
      {
        myMp3.ID3v23Tag.Frames.Remove(FrameTypes.Picture);
      }
      catch { }
    }
    myArtworkCollection.Clear();

     //Save out our changes so that we are working with the
    //most up to date file and tags
    myMp3.ID3v23Tag.WriteFlag = true;
    myMp3.Write();
    myMp3.Read(MyFile.FullName);
    #endregion Remove All Old Artwork
  }
  //Create a PictureFrame object, pointing it at the image on my PC
  ID3PictureFrame AlbumArt =
    new ID3PictureFrame(
    (System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(AlbumArtFile),
    PictureTypes.CoverFront, "Attached picture", TextEncodingTypes.ISO88591);
  myMp3.ID3v23Tag.Frames.Add(AlbumArt);
  myMp3.ID3v23Tag.WriteFlag = true;
  myMp3.Write();

  myMp3 = null;
}

Eu estou no trabalho e esqueceu de ligar o FolderShare, então não posso mostrar-lhe a minha versão aparadas para baixo onde eu passar em um objeto de imagem, mas isso tem tudo que você precisa para começar o trabalho feito com um pouco de hacking . Boa sorte.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top