Added logging for cover art functionality

This commit is contained in:
amazing-username
2019-07-17 20:15:07 -04:00
parent 8ec7092272
commit a39c232c34
4 changed files with 35 additions and 17 deletions
+6 -4
View File
@@ -35,10 +35,7 @@ namespace Icarus.Controllers.V1
[Authorize("download:cover_art")]
public IActionResult Get(int id)
{
var coverArt = new CoverArt
{
CoverArtId = id
};
var coverArt = new CoverArt { CoverArtId = id };
var coverArtRepository = HttpContext
.RequestServices
@@ -49,13 +46,18 @@ namespace Icarus.Controllers.V1
if (coverArt != null)
{
_logger.Info("Found cover art record");
var coverArtBytes = System.IO.File.ReadAllBytes(
coverArt.ImagePath);
return File(coverArtBytes, "application/x-msdownload",
coverArt.SongTitle);
}
else
{
_logger.Info("Cover art not found");
return NotFound();
}
}
#endregion
}