private async Task <SrStoredEpisodeTranscription> TransferTranscribedEpisode(Azure.SpeechBatchClient.Transcription transcription, SrStoredEpisode storedEpisode) { var channel0 = await TransferResultForChannel(storedEpisode, transcription, "0"); var channel1 = await TransferResultForChannel(storedEpisode, transcription, "1"); return(new SrStoredEpisodeTranscription { Status = StatusTranscribed, TranscriptionResultChannel0BlobIdentifier = channel0?.blobIdentifier ?? string.Empty, TranscriptionResultChannel0Url = channel0?.blobUri.ToString() ?? string.Empty, TranscriptionResultChannel1BlobIdentifier = channel1?.blobIdentifier ?? string.Empty, TranscriptionResultChannel1Url = channel1?.blobUri.ToString() ?? string.Empty, }); }
private async Task <(string blobIdentifier, Uri blobUri)?> TransferResultForChannel(SrStoredEpisode storedEpisode, Azure.SpeechBatchClient.Transcription transcription, string channel) { if (!transcription.ResultsUrls.ContainsKey($"channel_{channel}")) { return(null); } var targetBlobPrefix = storedEpisode.AudioBlobIdentifier + "__Transcription_"; var targetBlobIdentifier = $"{targetBlobPrefix}{channel}.json"; var resultsUri = transcription.ResultsUrls[$"channel_{channel}"]; var targetBlobUrl = await _storageTransfer.TransferBlockBlobIfNotExists( _transcriptionsContainerName, targetBlobIdentifier, resultsUri ); return(targetBlobIdentifier, targetBlobUrl); }