From 49d2a78b0edc5237411f770bb8584b96c361d9c1 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 7 Aug 2024 08:33:38 -0500 Subject: stub EventBus --- src/slskd/Core/EventBus.cs | 42 ++++++++++++++++++++++++ src/slskd/Transfers/Downloads/DownloadService.cs | 3 ++ 2 files changed, 45 insertions(+) create mode 100644 src/slskd/Core/EventBus.cs (limited to 'src') diff --git a/src/slskd/Core/EventBus.cs b/src/slskd/Core/EventBus.cs new file mode 100644 index 00000000..b90e3fc2 --- /dev/null +++ b/src/slskd/Core/EventBus.cs @@ -0,0 +1,42 @@ +// +// Copyright (c) slskd Team. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. +// + +using System.Threading.Tasks; + +namespace slskd; + +public enum EventType +{ + NOOP, + DOWNLOAD_FILE_COMPLETE, + DOWNLOAD_DIRECTORY_COMPLETE, +} + +public class EventData +{ +} + +/// +/// The application event bus. +/// +public class EventBus +{ + public async Task RaiseAsync(EventType type, T data) + { + + } +} \ No newline at end of file diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index 32903bf9..69e2d2c4 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -331,6 +331,9 @@ namespace slskd.Transfers.Downloads _ = Relay.NotifyFileDownloadCompleteAsync(finalFilename); } + // todo: raise DOWNLOAD_FILE_COMPLETE + // todo: determine if there are any pending transfers in this same directory, and if not raise DOWNLOAD_DIRECTORY_COMPLETE + if (OptionsMonitor.CurrentValue.Integration.Ftp.Enabled) { _ = FTP.UploadAsync(finalFilename); -- cgit v1.2.3