Added functionality to the download cover art

This commit is contained in:
kdeng00
2024-06-16 18:57:27 -04:00
parent 0b57cb2107
commit ec5d796bdd
4 changed files with 56 additions and 43 deletions
+3 -2
View File
@@ -74,15 +74,16 @@ public class CoverArtController : BaseController
}
[HttpGet("data/download/{id}")]
public async Task<IActionResult> Download(int id)
public async Task<IActionResult> Download(int id, [FromQuery] bool? randomizeFilename)
{
var songContext = new SongContext(_connectionString);
var covMgr = new CoverArtManager(this._config);
var songMetaData = songContext.RetrieveRecord(new Song { SongID = id});
var filename = songMetaData.Title + Constants.FileExtensions.JPG_EXTENSION;
var c = covMgr.GetCoverArt(songMetaData);
var filename = DirectoryManager.GenerateDownloadFilename(10, Constants.FileExtensions.JPG_EXTENSION, songMetaData.Title, randomizeFilename);
var data = await c.GetData();
return File(data, "application/x-msdownload", filename);