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
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc;
using Icarus.Controllers.Utilities;
using Icarus.Models;
using Icarus.Database.Contexts;
using Icarus.Controllers.Managers;
namespace Icarus.Controllers.V1;
@@ -49,16 +50,7 @@ public class SongCompressedDataController : BaseController
var sng = context.RetrieveRecord(new Song{ SongID = id });
SongData song = await cmp.RetrieveCompressedSong(sng);
var filename = string.Empty;
if (randomizeFilename.HasValue && randomizeFilename.Value)
{
filename = Managers.DirectoryManager.GenerateFilename(10) + Constants.FileExtensions.ZIP_EXTENSION;
}
else
{
filename = sng.Title + Constants.FileExtensions.ZIP_EXTENSION;
}
var filename = DirectoryManager.GenerateDownloadFilename(10, Constants.FileExtensions.ZIP_EXTENSION, sng.Title, randomizeFilename);
return File(song.Data, "application/x-msdownload", filename);
}