From ea83a7ef2b464fcd5f3d5f51b1d051253066619f Mon Sep 17 00:00:00 2001 From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com> Date: Wed, 8 Jun 2022 16:15:59 -0500 Subject: [PATCH] Notify the user after auto skipping an intro --- .../AutoSkip.cs | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/AutoSkip.cs b/ConfusedPolarBear.Plugin.IntroSkipper/AutoSkip.cs index c8542c6..c067b06 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/AutoSkip.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/AutoSkip.cs @@ -149,17 +149,30 @@ public class AutoSkip : IServerEntryPoint continue; } + // Notify the user that an introduction is being skipped for them. + _sessionManager.SendMessageCommand( + session.Id, + session.Id, + new MessageCommand() + { + Text = "Automatically skipped intro", + TimeoutMs = 2000, + }, + CancellationToken.None); + // Send the seek command _logger.LogDebug("Sending seek command to {Session}", deviceId); - var seekCommand = new PlaystateRequest - { - Command = PlaystateCommand.Seek, - ControllingUserId = session.UserId.ToString("N"), - SeekPositionTicks = (long)intro.IntroEnd * TimeSpan.TicksPerSecond, - }; - - _sessionManager.SendPlaystateCommand(session.Id, session.Id, seekCommand, CancellationToken.None); + _sessionManager.SendPlaystateCommand( + session.Id, + session.Id, + new PlaystateRequest + { + Command = PlaystateCommand.Seek, + ControllingUserId = session.UserId.ToString("N"), + SeekPositionTicks = (long)intro.IntroEnd * TimeSpan.TicksPerSecond, + }, + CancellationToken.None); // Flag that we've sent the seek command so that it's not sent repeatedly lock (_sentSeekCommandLock)