5

我正在尝试将新的艺术家和标题 id3 标签保存到曲目中。从轨道加载标签运行良好,轨道的编辑标题也运行良好。但是当我尝试编辑表演者 (艺术家)时,它并没有改变任何东西。这是代码

public void renameID3(string artist,string title)
{ 
   using (TagLib.File f = TagLib.File.Create(FInfo.FullName))
        {
            f.Tag.Artists[0] = artist; //Both of them are not ...
            f.Tag.Performers[0] = artist; //working


            f.Tag.Title = title; //This works fine
            f.Save();
        }
  }

另外,我查看了 TagLib 类的FirstPerformerFirstPerformer成员的定义,但它们没有任何设置方法。有谁知道如何解决这个问题?

4

3 回答 3

9

遇到了同样的问题。发现Performers首先清除使其按预期工作:

using(TagLib.File tlFile = TagLib.File.Create(newFileName)){
    //tlFile.Tag.Performers = new []{translateDict[author]}; //doesn't work
    tlFile.Tag.Performers = null; //clearing out performers
    tlFile.Tag.Performers = new []{translateDict[author]}; //works now
    tlFile.Save();
}
于 2013-06-25T22:22:55.527 回答
1
TagLib.File f = TagLib.File.Create(yourFile);
f.Tag.AlbumArtists = new string[] { "Artist 1", "Artist 2", ... };
于 2015-02-11T17:29:13.843 回答
0

这对我有用:

TagLib.File file = TagLib.File.Create (fname);
file.Tag.Performers = new String[1] { artist };
file.Save();
于 2016-07-25T13:43:00.653 回答