diff --git a/server/RdtClient.Service/RdtClient.Service.csproj b/server/RdtClient.Service/RdtClient.Service.csproj index 0ab2013..f17b86d 100644 --- a/server/RdtClient.Service/RdtClient.Service.csproj +++ b/server/RdtClient.Service/RdtClient.Service.csproj @@ -22,7 +22,7 @@ - + diff --git a/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs b/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs index 7a523e7..1a9e5dc 100644 --- a/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs +++ b/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs @@ -40,20 +40,20 @@ public class TorBoxTorrentClient(ILogger logger, IHttpClien { foreach (var inner in ae.InnerExceptions) { - logger.LogError(inner, $"The connection to RealDebrid has failed: {inner.Message}"); + logger.LogError(inner, $"The connection to TorBox has failed: {inner.Message}"); } throw; } catch (TaskCanceledException ex) when (ex.InnerException is TimeoutException) { - logger.LogError(ex, $"The connection to RealDebrid has timed out: {ex.Message}"); + logger.LogError(ex, $"The connection to TorBox has timed out: {ex.Message}"); throw; } catch (TaskCanceledException ex) { - logger.LogError(ex, $"The connection to RealDebrid has timed out: {ex.Message}"); + logger.LogError(ex, $"The connection to TorBox has timed out: {ex.Message}"); throw; } @@ -120,13 +120,9 @@ public class TorBoxTorrentClient(ILogger logger, IHttpClien public async Task AddMagnet(String magnetLink) { - // var seeding = Settings.Get.Integrations.Default.FinishedAction; + var user = await GetClient().User.GetAsync(true); - // Line is not working right now, will disable seeding and fix in december when I have time again. - // var seed = (seeding == TorrentFinishedAction.RemoveAllTorrents || seeding == TorrentFinishedAction.RemoveRealDebrid) ? 3 : 2; - - var seed = 3; - var result = await GetClient().Torrents.AddMagnetAsync(magnetLink, seed, false); + var result = await GetClient().Torrents.AddMagnetAsync(magnetLink, user.Data?.Settings?.SeedTorrents ?? 3, false); if (result.Error == "ACTIVE_LIMIT") { @@ -141,11 +137,9 @@ public class TorBoxTorrentClient(ILogger logger, IHttpClien public async Task AddFile(Byte[] bytes) { - // Line is not working right now, will disable seeding and fix in december when I have time again. - // var seed = (seeding == TorrentFinishedAction.RemoveAllTorrents || seeding == TorrentFinishedAction.RemoveRealDebrid) ? 3 : 2; - const Int32 seed = 3; + var user = await GetClient().User.GetAsync(true); - var result = await GetClient().Torrents.AddFileAsync(bytes, seed); + var result = await GetClient().Torrents.AddFileAsync(bytes, user.Data?.Settings?.SeedTorrents ?? 3); if (result.Error == "ACTIVE_LIMIT") { using var stream = new MemoryStream(bytes); @@ -161,17 +155,16 @@ public class TorBoxTorrentClient(ILogger logger, IHttpClien { var availability = await GetClient().Torrents.GetAvailabilityAsync(hash, listFiles: true); - if (availability.Data != null || availability.Data?.Count < 0) + if (availability.Data != null && availability.Data.Count > 0) { return (availability.Data[0]?.Files ?? []).Select(file => new TorrentClientAvailableFile - { - Filename = file.Name, - Filesize = file.Size - }) - .ToList(); + { + Filename = file.Name, + Filesize = file.Size + }).ToList(); } - return []; + return new List(); } public Task SelectFiles(Data.Models.Data.Torrent torrent)