diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-12-30 17:22:18 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-12-30 17:22:18 -0600 |
| commit | 2f554d1ccbb2fa677b810c861c389a6142576573 (patch) | |
| tree | 32cf8b6cffc008f543a524fa3b9148d67cc0c4f0 | |
| parent | 36b20bee334ded439b2d5f4b5d797ba3ca6d0e6c (diff) | |
| download | slskd-2f554d1ccbb2fa677b810c861c389a6142576573.tar.gz | |
broadcast file completions
| -rw-r--r-- | src/slskd/Transfers/Downloads/DownloadService.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index 4c3a7298..5a4aa170 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -31,6 +31,7 @@ namespace slskd.Transfers.Downloads using Microsoft.EntityFrameworkCore; using Serilog; using slskd.Integrations.FTP; + using slskd.Relay; /// <summary> /// Manages downloads. @@ -41,18 +42,21 @@ namespace slskd.Transfers.Downloads IOptionsMonitor<Options> optionsMonitor, ISoulseekClient soulseekClient, IDbContextFactory<TransfersDbContext> contextFactory, + IRelayService relayService, IFTPService ftpClient) { Client = soulseekClient; OptionsMonitor = optionsMonitor; ContextFactory = contextFactory; FTP = ftpClient; + Relay = relayService; } private ConcurrentDictionary<Guid, CancellationTokenSource> CancellationTokens { get; } = new ConcurrentDictionary<Guid, CancellationTokenSource>(); private ISoulseekClient Client { get; } private IDbContextFactory<TransfersDbContext> ContextFactory { get; } private IFTPService FTP { get; } + private IRelayService Relay { get; } private ILogger Log { get; } = Serilog.Log.ForContext<DownloadService>(); private IOptionsMonitor<Options> OptionsMonitor { get; } @@ -224,6 +228,8 @@ namespace slskd.Transfers.Downloads // argue both ways for that being the correct behavior. revisit this later. MoveFile(file.Filename, OptionsMonitor.CurrentValue.Directories.Incomplete, OptionsMonitor.CurrentValue.Directories.Downloads); + Relay.BroadcastFileDownloadCompletedNotification(file.Filename); + if (OptionsMonitor.CurrentValue.Integration.Ftp.Enabled) { _ = FTP.UploadAsync(file.Filename.ToLocalFilename(OptionsMonitor.CurrentValue.Directories.Downloads)); |
