diff --git a/ScopedServices/PlatformService/FC2Service.cs b/ScopedServices/PlatformService/FC2Service.cs index bb61c04..179c161 100644 --- a/ScopedServices/PlatformService/FC2Service.cs +++ b/ScopedServices/PlatformService/FC2Service.cs @@ -174,7 +174,9 @@ await fC2LiveDLService.CreateJobAsync(video: video, TypeInfoResolver = SourceGenerationContext.Default })); - if (null != DiscordService) await DiscordService.SendStartRecordingMessageAsync(video, channel); + if (null != DiscordService + && channel.Hide != true) + await DiscordService.SendStartRecordingMessageAsync(video, channel); } } else diff --git a/ScopedServices/PlatformService/TwitcastingService.cs b/ScopedServices/PlatformService/TwitcastingService.cs index 53f89ba..fbdb929 100644 --- a/ScopedServices/PlatformService/TwitcastingService.cs +++ b/ScopedServices/PlatformService/TwitcastingService.cs @@ -143,7 +143,9 @@ await twitcastingRecorderService.CreateJobAsync(video: video, video.Status = VideoStatus.Recording; logger.LogInformation("{channelId} is now lived! Start recording.", channel.id); - if (null != DiscordService) await DiscordService.SendStartRecordingMessageAsync(video, channel); + if (null != DiscordService + && channel.Hide != true) + await DiscordService.SendStartRecordingMessageAsync(video, channel); } } else @@ -192,7 +194,9 @@ await DownloadThumbnailAsync( { video.SourceStatus = VideoStatus.Reject; video.Note = "Video source is detected access required."; - if (null != DiscordService) await DiscordService.SendDeletedMessageAsync(video, channel); + if (null != DiscordService + && (null == channel || channel.Hide != true)) + await DiscordService.SendDeletedMessageAsync(video, channel); logger.LogInformation("Video source is {status} because it is detected access required.", Enum.GetName(typeof(VideoStatus), video.SourceStatus)); @@ -208,9 +212,10 @@ await DownloadThumbnailAsync( if (video.Status >= VideoStatus.Archived && video.Status < VideoStatus.Expired) { + // First detected video.SourceStatus = VideoStatus.Deleted; - if (null != DiscordService) - // First detected + if (null != DiscordService + && (null == channel || channel.Hide != true)) await DiscordService.SendDeletedMessageAsync(video, channel); } diff --git a/ScopedServices/PlatformService/TwitchService.cs b/ScopedServices/PlatformService/TwitchService.cs index f2eafa8..848e95c 100644 --- a/ScopedServices/PlatformService/TwitchService.cs +++ b/ScopedServices/PlatformService/TwitchService.cs @@ -147,7 +147,9 @@ await streamlinkService.CreateJobAsync(video: video, video.Status = VideoStatus.Recording; logger.LogInformation("{channelId} is now lived! Start recording.", channel.id); - if (null != DiscordService) await DiscordService.SendStartRecordingMessageAsync(video, channel); + if (null != DiscordService + && channel.Hide != true) + await DiscordService.SendStartRecordingMessageAsync(video, channel); } await videoRepository.AddOrUpdateAsync(video); diff --git a/ScopedServices/PlatformService/YoutubeService.cs b/ScopedServices/PlatformService/YoutubeService.cs index 8484a47..2e229a8 100644 --- a/ScopedServices/PlatformService/YoutubeService.cs +++ b/ScopedServices/PlatformService/YoutubeService.cs @@ -118,7 +118,8 @@ public override async Task UpdateVideoDataAsync(Video video, CancellationToken c video.Note = "Video skipped because it is not live stream."; // First detected if (video.Status != VideoStatus.Skipped - && null != DiscordService) + && null != DiscordService + && channel.Hide != true) await DiscordService.SendSkippedMessageAsync(video, channel); video.Status = VideoStatus.Skipped; @@ -219,7 +220,8 @@ public override async Task UpdateVideoDataAsync(Video video, CancellationToken c video.Note = "Video skipped because it is not live stream."; // First detected if (video.Status != VideoStatus.Skipped - && null != DiscordService) + && null != DiscordService + && channel.Hide != true) await DiscordService.SendSkippedMessageAsync(video, channel); video.Status = VideoStatus.Skipped; @@ -296,7 +298,9 @@ public override async Task UpdateVideoDataAsync(Video video, CancellationToken c { // First detected video.SourceStatus = VideoStatus.Deleted; - if (null != DiscordService) await DiscordService.SendDeletedMessageAsync(video, channel); + if (null != DiscordService + && (null == channel || channel.Hide != true)) + await DiscordService.SendDeletedMessageAsync(video, channel); } video.SourceStatus = VideoStatus.Deleted; @@ -327,7 +331,9 @@ public override async Task UpdateVideoDataAsync(Video video, CancellationToken c if (video.Status != VideoStatus.Missing) { video.SourceStatus = VideoStatus.Missing; - if (null != DiscordService) await DiscordService.SendSkippedMessageAsync(video, channel); + if (null != DiscordService + && (null == channel || channel.Hide != true)) + await DiscordService.SendSkippedMessageAsync(video, channel); } video.Status = VideoStatus.Missing; @@ -371,7 +377,9 @@ public override async Task UpdateVideoDataAsync(Video video, CancellationToken c if (video.SourceStatus != VideoStatus.Edited) { video.SourceStatus = VideoStatus.Edited; - if (null != DiscordService) await DiscordService.SendDeletedMessageAsync(video, channel); + if (null != DiscordService + && (null == channel || channel.Hide != true)) + await DiscordService.SendDeletedMessageAsync(video, channel); } video.SourceStatus = VideoStatus.Edited; @@ -392,7 +400,8 @@ public override async Task UpdateVideoDataAsync(Video video, CancellationToken c video.Note = "Video is Skipped because it is detected access required or copyright notice."; // First detected if (video.Status != VideoStatus.Skipped - && null != DiscordService) + && null != DiscordService + && (null == channel || channel.Hide != true)) await DiscordService.SendSkippedMessageAsync(video, channel); video.Status = VideoStatus.Skipped; @@ -404,7 +413,9 @@ public override async Task UpdateVideoDataAsync(Video video, CancellationToken c { video.SourceStatus = VideoStatus.Reject; video.Note = "Video source is detected access required or copyright notice."; - if (null != DiscordService) await DiscordService.SendDeletedMessageAsync(video, channel); + if (null != DiscordService + && (null == channel || channel.Hide != true)) + await DiscordService.SendDeletedMessageAsync(video, channel); } video.SourceStatus = VideoStatus.Reject; @@ -425,7 +436,10 @@ await ytarchiveService.CreateJobAsync(video: video, video.Status = VideoStatus.Recording; logger.LogInformation("{videoId} is now lived! Start recording.", video.id); - if (null != DiscordService) await DiscordService.SendStartRecordingMessageAsync(video, channel); + if (null != DiscordService + && (null == channel + || channel.Hide != true)) + await DiscordService.SendStartRecordingMessageAsync(video, channel); } if (video.Status < 0) diff --git a/SingletonServices/RecordService.cs b/SingletonServices/RecordService.cs index 622112e..aecee82 100644 --- a/SingletonServices/RecordService.cs +++ b/SingletonServices/RecordService.cs @@ -303,6 +303,7 @@ public async Task ProcessFinishedVideoAsync(VideoService videoService, using IDisposable __ = LogContext.PushProperty("videoId", video.id); await channelService.UpdateChannelLatestVideoAsync(video); + Channel? channel = await channelService.GetByChannelIdAndSourceAsync(video.ChannelId, video.Source); try { @@ -312,10 +313,10 @@ public async Task ProcessFinishedVideoAsync(VideoService videoService, _logger.LogInformation("Video {videoId} is successfully uploaded to Storage.", video.id); await videoService.UpdateVideoArchivedTimeAsync(video); - if (_discordService != null) - await _discordService.SendArchivedMessageAsync( - video, - await channelService.GetByChannelIdAndSourceAsync(video.ChannelId, video.Source)); + if (null != _discordService + && (null == channel + || channel.Hide != true)) + await _discordService.SendArchivedMessageAsync(video, channel); } catch (Exception e) {