[TB] Add downloading via zip functionality
This commit is contained in:
parent
469f1dbbad
commit
dc9c7ff050
1 changed files with 15 additions and 3 deletions
|
|
@ -288,9 +288,21 @@ public class TorBoxTorrentClient(ILogger<TorBoxTorrentClient> logger, IHttpClien
|
|||
{
|
||||
var torrentId = await GetClient().Torrents.GetHashInfoAsync(torrent.Hash, skipCache: true);
|
||||
|
||||
return torrent.Files.Where(file => fileFilter.IsDownloadable(torrent, file.Path, file.Bytes))
|
||||
.Select(file => $"https://torbox.app/fakedl/{torrentId?.Id}/{file.Id}")
|
||||
.ToList();
|
||||
bool allFilesDownloadable = torrent.Files.All(file => fileFilter.IsDownloadable(torrent, file.Path, file.Bytes));
|
||||
|
||||
if (allFilesDownloadable && torrent.DownloadClient != Data.Enums.DownloadClient.Symlink)
|
||||
{
|
||||
logger.LogDebug("Downloading files from TorBox as a zip.");
|
||||
return [$"https://torbox.app/fakedl/{torrentId?.Id}/zip"];
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogDebug("Downloading files from TorBox individually.");
|
||||
return torrent.Files
|
||||
.Where(file => fileFilter.IsDownloadable(torrent, file.Path, file.Bytes))
|
||||
.Select(file => $"https://torbox.app/fakedl/{torrentId?.Id}/{file.Id}")
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<String> GetFileName(String downloadUrl)
|
||||
|
|
|
|||
Loading…
Reference in a new issue