Merge pull request #708 from Cucumberrbob/fix/pm-nested-files

[PM] fix: search subdirectories using `item.Id` not `item.FolderId`
This commit is contained in:
Roger Far 2025-02-23 11:23:38 -07:00 committed by GitHub
commit a4b95923b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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;