Partially implemented updating song metadata. Need to make it more dynamic, meaning only update attributes that have values sent with the request. #36

This commit is contained in:
amazing-username
2019-05-02 22:48:50 -04:00
parent c0d2891d86
commit b0265ebc97
3 changed files with 97 additions and 33 deletions
@@ -58,6 +58,25 @@ namespace Icarus.Controllers.Utilities
return song;
}
public void UpdateMetadata(Song song)
{
try
{
Console.WriteLine("Updating song metadata");
var filePath = song.SongPath;
TagLib.File fileTag = TagLib.File.Create(filePath);
fileTag.Tag.Title = song.Title;
fileTag.Tag.Genres = new []{song.Genre};
fileTag.Save();
Console.WriteLine("Song metadata updated");
}
catch (Exception ex)
{
var msg = ex.Message;
}
}
private void PrintMetadata()
{
Console.WriteLine("\n\nMetadata of the song:");