Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TagLib sharp not editing artist

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

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?

like image 713
Ali Yeşilkanat Avatar asked Jun 25 '13 08:06

Ali Yeşilkanat


2 Answers

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();
}
like image 144
Ilya Olkhovskiy Avatar answered Nov 07 '22 13:11

Ilya Olkhovskiy


TagLib.File f = TagLib.File.Create(yourFile);
f.Tag.AlbumArtists = new string[] { "Artist 1", "Artist 2", ... };
like image 30
Sledge Avatar answered Nov 07 '22 13:11

Sledge