Exemple #1
0
        public async Task <IActionResult> GetCoverArt(SubsonicRequest request, int?size)
        {
            var result = await SubsonicService.GetCoverArt(request, size).ConfigureAwait(false);

            if (result?.IsNotFoundResult != false)
            {
                return(NotFound());
            }

            if (!result.IsSuccess)
            {
                Logger.LogWarning($"GetCoverArt Failed For [{JsonConvert.SerializeObject(request)}]");
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }

            return(File(result.Data.Bytes,
                        result.ContentType,
                        $"{result.Data.Caption ?? request.id}.jpg",
                        result.LastModified,
                        result.ETag));
        }