From 116ca29131592ae8e22770a1002741024b135c2f Mon Sep 17 00:00:00 2001
From: Roger Far
Date: Sun, 24 Nov 2024 06:05:23 -0700
Subject: [PATCH] Ignore the "Only download available files on debrid provider"
for real-debrid and disable the instant availability completely for Real
Debrid.
---
.../add-new-torrent.component.html | 51 ------------------
.../TorrentClients/PremiumizeTorrentClient.cs | 3 +-
.../TorrentClients/RealDebridTorrentClient.cs | 53 ++++---------------
3 files changed, 10 insertions(+), 97 deletions(-)
diff --git a/client/src/app/add-new-torrent/add-new-torrent.component.html b/client/src/app/add-new-torrent/add-new-torrent.component.html
index a083d1d..a519870 100644
--- a/client/src/app/add-new-torrent/add-new-torrent.component.html
+++ b/client/src/app/add-new-torrent/add-new-torrent.component.html
@@ -71,24 +71,6 @@
-
-
-
-
-
-
When a torrent is fully downloaded on the provider, perform this action.
-
- This option is only available for RealDebrid. AllDebrid, Premiumize, and Torbox will always download the full torrent.
-
-
-
0"
@@ -223,39 +205,6 @@
-
-
-
-
- These files are available for immediate download from your debrid provider.
- It is possible that there are more files in the torrent, which are not shown here.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/server/RdtClient.Service/Services/TorrentClients/PremiumizeTorrentClient.cs b/server/RdtClient.Service/Services/TorrentClients/PremiumizeTorrentClient.cs
index b7e8382..cb170c2 100644
--- a/server/RdtClient.Service/Services/TorrentClients/PremiumizeTorrentClient.cs
+++ b/server/RdtClient.Service/Services/TorrentClients/PremiumizeTorrentClient.cs
@@ -117,8 +117,7 @@ public class PremiumizeTorrentClient(ILogger logger, IH
public Task> GetAvailableFiles(String hash)
{
- var result = new List();
- return Task.FromResult>(result);
+ return Task.FromResult>([]);
}
public Task SelectFiles(Torrent torrent)
diff --git a/server/RdtClient.Service/Services/TorrentClients/RealDebridTorrentClient.cs b/server/RdtClient.Service/Services/TorrentClients/RealDebridTorrentClient.cs
index ccfb781..9cc8ad0 100644
--- a/server/RdtClient.Service/Services/TorrentClients/RealDebridTorrentClient.cs
+++ b/server/RdtClient.Service/Services/TorrentClients/RealDebridTorrentClient.cs
@@ -137,62 +137,27 @@ public class RealDebridTorrentClient(ILogger logger, IH
return result.Id;
}
- public async Task> GetAvailableFiles(String hash)
+ public Task> GetAvailableFiles(String hash)
{
- try
- {
- var result = await GetClient().Torrents.GetAvailableFiles(hash);
-
- var files = result.SelectMany(m => m.Value).SelectMany(m => m.Value).SelectMany(m => m.Values);
-
- var groups = files.Where(m => m.Filename != null).GroupBy(m => $"{m.Filename}-{m.Filesize}");
-
- var torrentClientAvailableFiles = groups.Select(m => new TorrentClientAvailableFile
- {
- Filename = m.First().Filename!,
- Filesize = m.First().Filesize
- })
- .ToList();
-
- return torrentClientAvailableFiles;
- }
- catch (RealDebridException exception)
- {
- if (exception.ErrorCode == 36)
- {
- return [];
- }
-
- throw;
- }
+ return Task.FromResult>([]);
}
public async Task SelectFiles(Data.Models.Data.Torrent torrent)
{
- var files = torrent.Files;
+ IList files;
Log("Seleting files", torrent);
- if (torrent.DownloadAction == TorrentDownloadAction.DownloadAvailableFiles)
- {
- Log($"Determining which files are already available on RealDebrid", torrent);
-
- var availableFiles = await GetAvailableFiles(torrent.Hash);
-
- Log($"Found {files.Count}/{torrent.Files.Count} available files on RealDebrid", torrent);
-
- files = torrent.Files.Where(m => availableFiles.Any(f => m.Path.EndsWith(f.Filename))).ToList();
- }
- else if (torrent.DownloadAction == TorrentDownloadAction.DownloadAll)
- {
- Log("Selecting all files", torrent);
- files = [.. torrent.Files];
- }
- else if (torrent.DownloadAction == TorrentDownloadAction.DownloadManual)
+ if (torrent.DownloadAction == TorrentDownloadAction.DownloadManual)
{
Log("Selecting manual selected files", torrent);
files = torrent.Files.Where(m => torrent.ManualFiles.Any(f => m.Path.EndsWith(f))).ToList();
}
+ else
+ {
+ Log("Selecting all files", torrent);
+ files = [.. torrent.Files];
+ }
Log($"Selecting {files.Count}/{torrent.Files.Count} files", torrent);