public int Act(DownloadFileOptions options) { _correlationId = Guid.NewGuid().ToString(); var outputFileName = options.FileName; if (string.IsNullOrEmpty(outputFileName)) { outputFileName = Path.GetFileNameWithoutExtension(options.Url); } var extension = options.Extension; if (string.IsNullOrEmpty(extension)) { extension = Path.GetExtension(options.Url); } var request = new DownloadRequest( url: options.Url, outputFileName: outputFileName, outputExtension: extension, correlationId: _correlationId); var response = _fileDownloaderService.Download(request).Result; if (response.IsValid) { _auditor.AuditSuccess("Url", request.Url, "FileDownloaded", response); return(0); } _auditor.AuditFailure("Url", request.Url, "FileDownloadFailed", response); return(1); }
private VideoFileInfoExtractResponse ExtractVideoFileInformation(CreateThumbnailSheetOptions options) { var request = new VideoFileInfoExtractRequest(options.VideoFilePath, _correlationId); var response = _videoFileInfoExtractionService.Extract(request); if (response.IsValid) { _auditor.AuditSuccess("VideoFile", options.VideoFilePath, "InfoExtracted", response); } else { _auditor.AuditFailure("VideoFile", options.VideoFilePath, "InfoExtractionFailed", response); } return(response); }
public int Act(CreateThumbnailsOptions options) { _correlationId = Guid.NewGuid().ToString(); var request = new ThumbnailCreationRequest(options.VideoFilePath, options.ThumbnailsEverySecond, _correlationId); var response = _thumbnailCreationService.Create(request); if (response.IsValid) { _auditor.AuditSuccess("VideoFile", options.VideoFilePath, "ThumbnailsCreated", response); } else { _auditor.AuditFailure("VideoFile", options.VideoFilePath, "ThumbnailCreationFailed", response); } return(response.IsValid ? 0 : 1); }