Temp image fix

This commit is contained in:
Fergal Moran
2018-04-27 02:22:05 +01:00
parent 4d400d7d21
commit faa8a87c59
14 changed files with 413 additions and 41 deletions

View File

@@ -8,6 +8,7 @@ using Hangfire;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using PodNoms.Api.Models;
@@ -25,6 +26,9 @@ namespace PodNoms.Api.Controllers {
public class EntryController : BaseAuthController {
private readonly IPodcastRepository _podcastRepository;
private readonly IEntryRepository _repository;
public IConfiguration _options { get; }
private readonly IUnitOfWork _unitOfWork;
private readonly IMapper _mapper;
private readonly IUrlProcessService _processor;
@@ -36,12 +40,14 @@ namespace PodNoms.Api.Controllers {
IPodcastRepository podcastRepository,
IUnitOfWork unitOfWork, IMapper mapper, IOptions<StorageSettings> storageSettings,
IOptions<AudioFileStorageSettings> audioFileStorageSettings,
IConfiguration options,
IUrlProcessService processor, ILoggerFactory logger,
UserManager<ApplicationUser> userManager,
IHttpContextAccessor contextAccessor) : base(contextAccessor, userManager) {
this._logger = logger.CreateLogger<EntryController>();
this._podcastRepository = podcastRepository;
this._repository = repository;
this._options = options;
this._storageSettings = storageSettings.Value;
this._unitOfWork = unitOfWork;
this._audioFileStorageSettings = audioFileStorageSettings.Value;
@@ -57,7 +63,10 @@ namespace PodNoms.Api.Controllers {
extractJobId, service => service.UploadAudio(entry.Id, entry.AudioUrl));
var notify = BackgroundJob.ContinueWith<INotifyJobCompleteService>(
uploadJobId, service => service.NotifyUser(entry.Podcast.AppUser.Id, "PodNoms", $"{entry.Title} has finished processing",
entry.Podcast.ImageUrl));
entry.Podcast.GetThumbnailUrl(
this._options.GetSection("Storage")["CdnUrl"],
this._options.GetSection("ImageFileStorageSettings")["ContainerName"])
));
} catch (InvalidOperationException ex) {
_logger.LogError($"Failed submitting job to processor\n{ex.Message}");
entry.ProcessingStatus = ProcessingStatus.Failed;