public static void SaveTags(SongFile songFile) { TagLib.File newFile = GetTagsFromFile(Caching.currentFile.fullPath); newFile.SetInterpret(songFile.Interpret); newFile.Tag.Title = songFile.Title; newFile.Tag.Album = songFile.Album; newFile.Tag.Comment = songFile.Comment; newFile.Tag.Track = (uint)songFile.Track; newFile.Tag.Year = (uint)songFile.Year; newFile.SetGenre(songFile.Genre); newFile.SetImage(Caching.currentFile.Cover.ConvertToPicture()); newFile.Refresh(Caching.currentFile.fullPath); if (Caching.currentFile.Cover != null) { TagLib.File newFileTEMP = TagLib.File.Create(Caching.currentFile.fullPath); newFileTEMP.SetImage(Caching.currentFile.Cover.ConvertToPicture()); newFileTEMP.Save(); newFileTEMP.Dispose(); } }
private static void ProcessSong(string newFile) { Debug.WriteLine(newFile); TagLib.File newSong = TagLib.File.Create(newFile); /* * //Lyrics Test * Debug.WriteLine("(before)Test Lyrics: " + newSong.Tag.Lyrics); * * newSong.Tag.Lyrics = ""; * newSong.Tag.Lyrics = "Wad ya mine"; * * Debug.WriteLine("(after)Test Lyrics: " + newSong.Tag.Lyrics); */ newSong.Save(); if (newSong.Tag.FirstPerformer != null && newSong.Tag.Title != null) { string newFileName = GetFileName(newSong.Tag.FirstPerformer, newSong.Tag.Title); if (string.IsNullOrEmpty(newSong.Tag.Album)) { if (IsRemix(newSong.Tag.Title)) { newSong.Tag.Album = GetRealTitle(newSong.Tag.Title) + " (The Remixes)"; } else { newSong.Tag.Album = GetRealTitle(newSong.Tag.Title) + " - Single"; } } //TEMP newSong.Tag.Comment = " "; newSong.Tag.Comment = "Processed by TagEditor"; newSong.Tag.Genres = new string[] { "Electronic" }; newSong.Tag.Performers = new string[] { "DROELOE" }; newSong.Tag.Album = "A Matter Of Perspective"; newSong.Tag.AlbumArtists = new string[] { "DROELOE" }; newSong.Refresh(newFile); //Manages the result folder for the processed song. This allows the user to sort the songs. if (Modes.exportTarget != Modes.ExportTarget.none) { if (Modes.exportTarget == Modes.ExportTarget.ONEFOLDER) { FileSystem.Files.Move(FileSystem.GetFileName(newFile, false), Paths.Import, newFileName, Paths.Export); } else if (Modes.exportTarget == Modes.ExportTarget.FOLDERS) { string newSortingString; switch (Modes.sortingTarget) { case Modes.SortingTarget.ALBUM: newSortingString = newSong.Tag.Album; break; case Modes.SortingTarget.PERFORMER: newSortingString = newSong.Tag.FirstPerformer; break; case Modes.SortingTarget.YEAR: newSortingString = newSong.Tag.Year.ToString(); break; case Modes.SortingTarget.GENRE: newSortingString = newSong.Tag.FirstGenre; break; case Modes.SortingTarget.none: newSortingString = "ERROR"; break; default: newSortingString = newSong.Tag.Album; break; } FileSystem.Files.Move( FileSystem.GetFileName(newFile, false), Paths.Import, newFileName, Paths.Export + @"/" + newSortingString.Replace(":", " ").Replace("/", "_") ); } } } if (Modes.imageCheck != Modes.ImageCheck.none) { CheckImage(newSong); } else { Debug.WriteLine(newFile + " does not have the required Tags!"); } }