* #79: Added query parameter to randomize filename when downloading songs Right now only the endpoint has this parameter added * #79: Added functionality to the comressed song endpoint * Added functionality to the download cover art
This commit was merged in pull request #96.
This commit is contained in:
@@ -37,14 +37,15 @@ public class SongDataController : BaseController
|
||||
|
||||
|
||||
[HttpGet("download/{id}")]
|
||||
public IActionResult Download(int id)
|
||||
public IActionResult Download(int id, [FromQuery] bool? randomizeFilename)
|
||||
{
|
||||
var songContext = new SongContext(_connectionString);
|
||||
var songMetaData = songContext.RetrieveRecord(new Song { SongID = id});
|
||||
|
||||
var song = _songMgr.RetrieveSong(songMetaData).Result;
|
||||
|
||||
return File(song.Data, "application/x-msdownload", songMetaData.Filename);
|
||||
var filename = DirectoryManager.GenerateDownloadFilename(10, Constants.FileExtensions.WAV_EXTENSION, songMetaData.Title, randomizeFilename);
|
||||
|
||||
return File(song.Data, "application/x-msdownload", filename);
|
||||
}
|
||||
|
||||
// Assumes that the song already has metadata such as
|
||||
|
||||
Reference in New Issue
Block a user