Example #1
0
 public ActionResult <SongInfoModel> SongAnalyze([FromBody] File file)
 {
     if (file.ContentType != "audio/wav" && file.ContentType != "audio/wave")
     {
         return(BadRequest());
     }
     try
     {
         var song = _songService.AnalyzeAudioFile(Convert.FromBase64String(file.Content),
                                                  HostingEnvironment.WebRootPath);
         if (song == null)
         {
             return(NotFound("Song not found"));
         }
         return(song);
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }