[RD] mark torrent failed when all files excluded by filters
This commit is contained in:
parent
097ea93410
commit
2ae3b85dac
1 changed files with 3 additions and 18 deletions
|
|
@ -144,7 +144,7 @@ public class RealDebridTorrentClient(ILogger<RealDebridTorrentClient> logger, IH
|
||||||
|
|
||||||
public async Task SelectFiles(Data.Models.Data.Torrent torrent)
|
public async Task SelectFiles(Data.Models.Data.Torrent torrent)
|
||||||
{
|
{
|
||||||
IList<TorrentClientFile> files;
|
List<TorrentClientFile> files;
|
||||||
|
|
||||||
Log("Seleting files", torrent);
|
Log("Seleting files", torrent);
|
||||||
|
|
||||||
|
|
@ -155,32 +155,17 @@ public class RealDebridTorrentClient(ILogger<RealDebridTorrentClient> logger, IH
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log("Selecting all files", torrent);
|
Log("Selecting files", torrent);
|
||||||
files = [.. torrent.Files];
|
files = [.. torrent.Files];
|
||||||
}
|
}
|
||||||
|
|
||||||
Log($"Selecting {files.Count}/{torrent.Files.Count} files", torrent);
|
|
||||||
|
|
||||||
files = files.Where(f => fileFilter.IsDownloadable(torrent, f.Path, f.Bytes)).ToList();
|
files = files.Where(f => fileFilter.IsDownloadable(torrent, f.Path, f.Bytes)).ToList();
|
||||||
|
|
||||||
if (files.Count == 0)
|
Log($"Selecting {files.Count}/{torrent.Files.Count} files", torrent);
|
||||||
{
|
|
||||||
Log($"Filtered all files out! Downloading ALL files instead!", torrent);
|
|
||||||
|
|
||||||
files = torrent.Files;
|
|
||||||
}
|
|
||||||
|
|
||||||
var fileIds = files.Select(m => m.Id.ToString()).ToArray();
|
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]);
|
await GetClient().Torrents.SelectFilesAsync(torrent.RdId!, [.. fileIds]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue