TagLib 锐利不编辑艺术家 [英] TagLib sharp not editing artist

查看:86
本文介绍了TagLib 锐利不编辑艺术家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to save new artist and title id3 tags into tracks. Loading tags from tracks working good, also editing title for track is working fine. But when i try to edit performer (artist) it didn't change anything. Here is the code

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 成员的定义,但他们没有任何 set 方法.有大佬知道怎么解决吗?

Plus I looked the definiton of FirstPerformer and FirstPerformer members of TagLib class but they don't have any set method. Anyone know how to solve this?

推荐答案

陷入同样的​​问题.发现首先清除 Performers 使其按预期工作:

Stuck with the very same problem. Found that clearing Performers first makes it work as intended:

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();
}

这篇关于TagLib 锐利不编辑艺术家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆