Can successfully save the coverart record, now need to work on downloading the cover art #50

This commit is contained in:
amazing-username
2019-07-13 10:13:15 -04:00
parent 026a528a81
commit 1004f6c93d
5 changed files with 78 additions and 9 deletions
+7 -4
View File
@@ -5,6 +5,7 @@ using System.IO;
using Icarus.Controllers.Utilities;
using Icarus.Database.Repositories;
using Icarus.Models;
using Icarus.Types;
namespace Icarus.Controllers.Managers
{
@@ -27,8 +28,12 @@ namespace Icarus.Controllers.Managers
public void SaveCoverArtToDatabase(ref Song song, ref CoverArt coverArt,
CoverArtRepository coverArtRepository)
{
// TODO: Implement saving Cover Art record to
// the database.
coverArtRepository.SaveCoverArt(coverArt);
coverArt = coverArtRepository.GetCoverArt(CoverArtField.SongTitle,
coverArt);
song.CoverArtId = coverArt.CoverArtId;
}
public CoverArt SaveCoverArt(Song song)
{
@@ -43,11 +48,9 @@ namespace Icarus.Controllers.Managers
ImagePath = imagePath
};
Console.WriteLine($"Cover path {imagePath}");
var metaData = new MetadataRetriever();
var imgBytes = metaData.RetrieveCoverArtBytes(song);
Console.WriteLine("Saving image");
File.WriteAllBytes(imagePath, imgBytes);
return coverArt;