IPhone track title
- by woodbase
If you have an IPhone, you probably know that the name in the playlist comes from the “Title”-attribute instead of the filename. Usually that is not a problem. But when I plug my IPhone to the car stereo the tracks are sorted alphabetically by the “title”-attribute. That becomes a problem when You have an e-book where each chapter starts with “Track 01”. You can manually update this in the file properties (from the context menu in Windows Explorer), but doing so for +200 tracks – no thank you :) The FileInfo-class does not contain a property for this special audio file attribute. However the problem is easily solved using TagLib. The method below, not optimized in any way - just solving the problem at hand, will set the “title”-attribute to the file name. private static void UpdateTitleAttr(string dirPath, string fileFilter) { var files = System.IO.Directory.GetFiles(dirPath, fileFilter); foreach (var file in files) { var f = TagLib.File.Create(file); var newTitle = f.Name.Substring(f.Name.LastIndexOf(@"\") + 1); f.Tag.Title = newTitle; f.Save(); } } So now I can hear e-books while driving :P