From 934cdf4c8678f56c4d93a39aaa82af35fb24ed9b Mon Sep 17 00:00:00 2001 From: Fergal Moran Date: Sun, 12 Nov 2017 21:41:17 +0000 Subject: [PATCH] Fixed invalid local file url --- server/Controllers/EntryController.cs | 9 ++++++--- server/Services/Processor/AudioUploadProcessService.cs | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/server/Controllers/EntryController.cs b/server/Controllers/EntryController.cs index aa91bd4..c59fe0f 100644 --- a/server/Controllers/EntryController.cs +++ b/server/Controllers/EntryController.cs @@ -46,9 +46,12 @@ namespace PodNoms.Api.Controllers { try { - var infoJobId = BackgroundJob.Enqueue(service => service.GetInformation(entry.Id)); - var extract = BackgroundJob.ContinueWith(infoJobId, service => service.DownloadAudio(entry.Id)); - var upload = BackgroundJob.ContinueWith(extract, service => service.UploadAudio(entry.Id, entry.AudioUrl)); + var infoJobId = BackgroundJob.Enqueue( + service => service.GetInformation(entry.Id)); + var extract = BackgroundJob.ContinueWith( + infoJobId, service => service.DownloadAudio(entry.Id)); + var upload = BackgroundJob.ContinueWith( + extract, service => service.UploadAudio(entry.Id, entry.AudioUrl)); } catch (InvalidOperationException ex) { diff --git a/server/Services/Processor/AudioUploadProcessService.cs b/server/Services/Processor/AudioUploadProcessService.cs index fee0890..c9e6c74 100644 --- a/server/Services/Processor/AudioUploadProcessService.cs +++ b/server/Services/Processor/AudioUploadProcessService.cs @@ -38,10 +38,15 @@ namespace PodNoms.Api.Services.Processor _logger.LogError($"Unable to find entry with id: {entryId}"); return false; } - entry.ProcessingStatus = ProcessingStatus.Uploading; + entry.ProcessingStatus = ProcessingStatus.Uploading;entry.ProcessingStatus = ProcessingStatus.Uploading; await _unitOfWork.CompleteAsync(); try { + // bit messy but can't figure how to pass youtube-dl job result to this job + // so using AudioUrl as a proxy + if (string.IsNullOrEmpty(localFile)) + localFile = entry.AudioUrl; + if (File.Exists(localFile)) { var fileName = new FileInfo(localFile).Name;