#103: Added method to create song and moving some code around
This commit is contained in:
@@ -366,6 +366,27 @@ public class SongManager : BaseManager
|
||||
return song;
|
||||
}
|
||||
|
||||
public int Create(IFormFile file, string filePath, string prompt)
|
||||
{
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
using (var filestream = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
Console.WriteLine(prompt);
|
||||
file.CopyTo(filestream);
|
||||
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
private bool SongRecordChanged(Song currentSong, Song songUpdates)
|
||||
{
|
||||
|
||||
@@ -153,7 +153,7 @@ public class SongDataController : BaseController
|
||||
case "wav":
|
||||
// song = _songMgr.SaveSongToFileSystem(up.SongData, up.CoverArtData, song);
|
||||
// TODO: Make sure the tmp file gets deleted
|
||||
return BadRequest(".wav files are not supported");
|
||||
return BadRequest("No support for .wav files");
|
||||
case "flac":
|
||||
song = _songMgr.SaveFlacSongToFileSystem(up.SongData, up.CoverArtData, song);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user