static void AddSongToDirectory(TagLib.File file) { file.Save(); string fileName = file.Name.Split('\\').Last(); string currentPosition = file.Name; string destination = directoryName + @"\" + file.Tag.Performers[0] + @"\" + file.Tag.Performers[0] + " - " + fileName; System.IO.File.Move(currentPosition, destination); }
private void CleanTitleData(TagLib.File file) { if(file.Tag.Title.IndexOfAny(new char[]{'[', '(','-'}) > -1) { int index = file.Tag.Title.IndexOfAny(new char[]{'[', '(','-'}); if (index > -1) { if(file.Tag.Title.Contains("(f") || file.Tag.Title.Contains(" f") || file.Tag.Title.Contains("(F") || file.Tag.Title.Contains(" F")) return; string newTitle = file.Tag.Title.Substring(0, index); file.Tag.Title = newTitle; file.Save(); } } }
private void ChangeMetadata(TagLib.Image.File file) { file.ImageTag.Comment = "Testing!"; file.ImageTag.Keywords = new string [] { "One", "Two", "Three" }; file.Save (); }
private void EditFileTags(TagLib.File file) { if(string.IsNullOrEmpty(file.Tag.FirstPerformer) || string.IsNullOrEmpty(file.Tag.Title) || string.IsNullOrEmpty(file.Tag.Album)) { DialogResult result = MessageBox.Show("The " + (string.IsNullOrEmpty(file.Tag.Title) ? "Title" : "Album name") + " is missing for this track. Would you like to edit?", file.Name.Substring(file.Name.LastIndexOf("\\") + 1), MessageBoxButtons.YesNo); if(result == System.Windows.Forms.DialogResult.Yes) { editForm = new EditForm(file.Tag.FirstPerformer,file.Tag.Title, file.Tag.Album); editForm.ShowDialog(this); file.Tag.Title = editForm.Title; file.Tag.Album = editForm.Album; file.Save(); } } }