[RD] mark torrent failed when all files excluded by filters

This commit is contained in:
Cucumberrbob 2025-03-08 13:46:07 +00:00
parent 097ea93410
commit 2ae3b85dac
No known key found for this signature in database
GPG key ID: 2B935C47401C3614

View file

@ -144,7 +144,7 @@ public class RealDebridTorrentClient(ILogger<RealDebridTorrentClient> logger, IH
public async Task SelectFiles(Data.Models.Data.Torrent torrent)
{
IList<TorrentClientFile> files;
List<TorrentClientFile> files;
Log("Seleting files", torrent);
@ -155,32 +155,17 @@ public class RealDebridTorrentClient(ILogger<RealDebridTorrentClient> logger, IH
}
else
{
Log("Selecting all files", torrent);
Log("Selecting files", torrent);
files = [.. torrent.Files];
}
Log($"Selecting {files.Count}/{torrent.Files.Count} files", torrent);
files = files.Where(f => fileFilter.IsDownloadable(torrent, f.Path, f.Bytes)).ToList();
if (files.Count == 0)
{
Log($"Filtered all files out! Downloading ALL files instead!", torrent);
files = torrent.Files;
}
Log($"Selecting {files.Count}/{torrent.Files.Count} files", torrent);
var fileIds = files.Select(m => m.Id.ToString()).ToArray();
Log($"Selecting files:");
foreach (var file in files)
{
Log($"{file.Id}: {file.Path} ({file.Bytes}b)");
}
Log("", torrent);
await GetClient().Torrents.SelectFilesAsync(torrent.RdId!, [.. fileIds]);
}