From 6bb54ab3a57c9ab16819d1374cfc38056a1bab64 Mon Sep 17 00:00:00 2001 From: TwistedUmbrellaX <1173913+AbandonedCart@users.noreply.github.com> Date: Sat, 16 Nov 2024 20:14:01 -0500 Subject: [PATCH] 10.10.2 (#378) * Hotfix for the 10.10.2 API change * Support 10.10.1 retroactively for now * Log a message indicating the action --- IntroSkipper/Manager/MediaSegmentUpdateManager.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/IntroSkipper/Manager/MediaSegmentUpdateManager.cs b/IntroSkipper/Manager/MediaSegmentUpdateManager.cs index dafe45a..9dc9162 100644 --- a/IntroSkipper/Manager/MediaSegmentUpdateManager.cs +++ b/IntroSkipper/Manager/MediaSegmentUpdateManager.cs @@ -39,8 +39,17 @@ namespace IntroSkipper.Manager cancellationToken.ThrowIfCancellationRequested(); try { - var existingSegments = await _mediaSegmentManager.GetSegmentsAsync(episode.EpisodeId, null).ConfigureAwait(false); - await Task.WhenAll(existingSegments.Select(s => _mediaSegmentManager.DeleteSegmentAsync(s.Id))).ConfigureAwait(false); + try + { + var existingSegments = await _mediaSegmentManager.GetSegmentsAsync(episode.EpisodeId, null, true).ConfigureAwait(false); + await Task.WhenAll(existingSegments.Select(s => _mediaSegmentManager.DeleteSegmentAsync(s.Id))).ConfigureAwait(false); + } + catch (Exception vs) + { + _logger.LogError(vs, "GetSegmentsAsync failed. 10.10.1 compatibility enabled."); + var existingSegments = await _mediaSegmentManager.GetSegmentsAsync(episode.EpisodeId, null).ConfigureAwait(false); + await Task.WhenAll(existingSegments.Select(s => _mediaSegmentManager.DeleteSegmentAsync(s.Id))).ConfigureAwait(false); + } var newSegments = await _segmentProvider.GetMediaSegments(new MediaSegmentGenerationRequest { ItemId = episode.EpisodeId }, cancellationToken).ConfigureAwait(false);