private async Task Enrich(int episodeId, SrStoredEpisode storedEpisode, SrStoredEpisodeTranscription storedEpisodeTranscription) { _logger.LogInformation($"Enriching episode {episodeId}..."); var storedEnrichedEpisode = new SrStoredEnrichedEpisode { OriginalLocale = storedEpisode.AudioLocale }; var title = storedEpisode.Episode.Title; var description = storedEpisode.Episode.Description; var transcription = storedEpisodeTranscription.CombinedDisplayResult; var locale = storedEpisode.AudioLocale; _logger.LogInformation($"Analyzing episode {episodeId} texts for sv-SE..."); var swedishTexts = await AnalyzeTexts(episodeId, title, description, transcription, locale, "sv-SE"); storedEnrichedEpisode.Title_SV = swedishTexts.Title; storedEnrichedEpisode.Description_SV = swedishTexts.Description; storedEnrichedEpisode.Transcription_SV = swedishTexts.Transcription; _logger.LogInformation($"Analyzing episode {episodeId} texts for en-US..."); var englishTexts = await AnalyzeTexts(episodeId, title, description, transcription, locale, "en-US"); storedEnrichedEpisode.Title_EN = englishTexts.Title; storedEnrichedEpisode.Description_EN = englishTexts.Description; storedEnrichedEpisode.Transcription_EN = englishTexts.Transcription; if (locale == "sv-SE") { storedEnrichedEpisode.Title_Original = storedEnrichedEpisode.Title_SV; storedEnrichedEpisode.Description_Original = storedEnrichedEpisode.Description_SV; storedEnrichedEpisode.Transcription_Original = storedEnrichedEpisode.Transcription_SV; } else if (locale == "en-US") { storedEnrichedEpisode.Title_Original = storedEnrichedEpisode.Title_EN; storedEnrichedEpisode.Description_Original = storedEnrichedEpisode.Description_EN; storedEnrichedEpisode.Transcription_Original = storedEnrichedEpisode.Transcription_EN; } else { var customTexts = await AnalyzeTexts(episodeId, title, description, transcription, locale, locale); storedEnrichedEpisode.Title_Original = customTexts.Title; storedEnrichedEpisode.Description_Original = customTexts.Description; storedEnrichedEpisode.Transcription_Original = customTexts.Transcription; } await _storage.StoreEnrichedEpisode(episodeId, storedEnrichedEpisode); _logger.LogInformation($"Enriched episode {episodeId}..."); }
private async Task GenerateSpeak(int episodeId, SrStoredEpisode storedEpisode, SrStoredEnrichedEpisode enrichedEpisode) { _logger.LogInformation($"Generating speaker for episode {episodeId}..."); var episodeSpeech = new SrStoredEpisodeSpeech(); if (enrichedEpisode.Transcription_EN != null) { var result = await CreateAndUploadSpeech(episodeId, storedEpisode, enrichedEpisode.Transcription_EN.Text, "en-US", EnUsVoice); if (result != null) { episodeSpeech.SpeechBlobIdenitifier_EN = result.Value.Key; episodeSpeech.SpeechUrl_EN = result.Value.Value; } } if (enrichedEpisode.Transcription_SV != null) { var result = await CreateAndUploadSpeech(episodeId, storedEpisode, enrichedEpisode.Transcription_SV.Text, "sv-SE", SvSeVoice); if (result != null) { episodeSpeech.SpeechBlobIdenitifier_SV = result.Value.Key; episodeSpeech.SpeechUrl_SV = result.Value.Value; } } await _storage.StoreEpisodeSpeech(episodeId, episodeSpeech); _logger.LogInformation($"Generated speaker for episode {episodeId}..."); }
private async Task Summarize(int episodeId, SrStoredEpisode storedEpisode, SrStoredEpisodeTranscription storedEpisodeTranscription, SrStoredEnrichedEpisode storedEnrichedEpisode, SrStoredEpisodeSpeech episodeSpeech) { _logger.LogInformation($"Summarizing episode {episodeId}..."); var summarizedEpisode = new SrStoredSummarizedEpisode { EpisodeId = episodeId, OriginalAudioUrl = storedEpisode.OriginalAudioUrl, AudioUrl = storedEpisode.AudioUrl, AudioLocale = storedEpisode.AudioLocale, Title = storedEpisode.Episode.Title, Description = storedEpisode.Episode.Description, Url = storedEpisode.Episode.Url, PublishDateUtc = storedEpisode.Episode.PublishDateUtc, ImageUrl = storedEpisode.Episode.ImageUrl, ProgramId = storedEpisode.Episode.Program.Id, ProgramName = storedEpisode.Episode.Program.Name, Transcription = storedEpisodeTranscription.CombinedDisplayResult, Title_Original = storedEnrichedEpisode.Title_Original, Description_Original = storedEnrichedEpisode.Description_Original, Transcription_Original = storedEnrichedEpisode.Transcription_Original, Title_EN = storedEnrichedEpisode.Title_EN, Description_EN = storedEnrichedEpisode.Description_EN, Transcription_EN = storedEnrichedEpisode.Transcription_EN, SpeechUrl_EN = episodeSpeech.SpeechUrl_EN, Title_SV = storedEnrichedEpisode.Title_SV, Description_SV = storedEnrichedEpisode.Description_SV, Transcription_SV = storedEnrichedEpisode.Transcription_SV, SpeechUrl_SV = episodeSpeech.SpeechUrl_SV }; await _summaryStorage.StoreSummarizedEpisode(episodeId, summarizedEpisode); _logger.LogInformation($"Summarized episode {episodeId}..."); }