1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-19 17:32:38 +01:00

New: Ignore Deluge torrents without a title

(cherry picked from commit a0d29331341320268552660658b949179c963793)
This commit is contained in:
Mark McDowall 2024-06-25 15:52:12 -07:00 committed by Bogdan
parent 7dc64c595c
commit fcb0d8a930

View File

@ -124,14 +124,23 @@ public override IEnumerable<DownloadClientItem> GetItems()
} }
var items = new List<DownloadClientItem>(); var items = new List<DownloadClientItem>();
var ignoredCount = 0;
foreach (var torrent in torrents) foreach (var torrent in torrents)
{ {
if (torrent.Hash == null) // Silently ignore torrents with no hash
if (torrent.Hash.IsNullOrWhiteSpace())
{ {
continue; continue;
} }
// Ignore torrents without a name, but track to log a single warning for all invalid torrents.
if (torrent.Name.IsNullOrWhiteSpace())
{
ignoredCount++;
continue;
}
var item = new DownloadClientItem(); var item = new DownloadClientItem();
item.DownloadId = torrent.Hash.ToUpper(); item.DownloadId = torrent.Hash.ToUpper();
item.Title = torrent.Name; item.Title = torrent.Name;
@ -189,6 +198,11 @@ public override IEnumerable<DownloadClientItem> GetItems()
items.Add(item); items.Add(item);
} }
if (ignoredCount > 0)
{
_logger.Warn("{0} torrent(s) were ignored becuase they did not have a title, check Deluge and remove any invalid torrents");
}
return items; return items;
} }