[PM] fix: search subdirectories using item.Id as folderId when getting downloaod links

This commit is contained in:
Cucumberrbob 2025-02-18 11:51:30 +00:00
parent fe241db5db
commit 5a78125053
No known key found for this signature in database
GPG key ID: 2B935C47401C3614

View file

@ -285,12 +285,15 @@ public class PremiumizeTorrentClient(ILogger<PremiumizeTorrentClient> logger, IH
foreach (var item in folder.Content) foreach (var item in folder.Content)
{ {
if (!String.IsNullOrWhiteSpace(item.Link))
{
Log($"Found item {item.Name} in folder {folder.Name} ({folderId}) with link {item.Link}", torrent);
if (item.Type == "file") if (item.Type == "file")
{ {
if (String.IsNullOrWhiteSpace(item.Link))
{
Log($"Found item {item.Name} in folder {folder.Name} ({folderId}), but has no link", torrent);
continue;
}
if (torrent.DownloadMinSize > 0) if (torrent.DownloadMinSize > 0)
{ {
if (item.Link.Length < torrent.DownloadMinSize * 1024 * 1024) if (item.Link.Length < torrent.DownloadMinSize * 1024 * 1024)
@ -319,17 +322,21 @@ public class PremiumizeTorrentClient(ILogger<PremiumizeTorrentClient> logger, IH
continue; continue;
} }
} }
}
Log($"Found item {item.Name} in folder {folder.Name} ({folderId})", torrent);
downloadLinks.Add(item.Link); downloadLinks.Add(item.Link);
} }
else if (item.Type == "folder")
{
Log($"Found subfolder {item.Name} in {folder.Name} ({folderId}), searching subfolder for files", torrent);
var subDownloadLinks = await GetAllDownloadLinks(torrent, item.Id);
downloadLinks.AddRange(subDownloadLinks);
}
else else
{ {
Log($"Found item {item.Name} in folder {folder.Name} ({folderId}), but has no link", torrent); Log($"Found item {item.Name} with unknown type {item.Type} in folder {folder.Name} ({folderId})", torrent);
} }
var subDownloadLinks = await GetAllDownloadLinks(torrent, item.FolderId);
downloadLinks.AddRange(subDownloadLinks);
} }
return downloadLinks; return downloadLinks;