mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: (Cardigann) Don't die if no categories can be mapped for a release
Fixes #105
This commit is contained in:
@@ -80,13 +80,13 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
r.InfoUrl == null ? null : new XElement("comments", r.InfoUrl),
|
||||
r.PublishDate == DateTime.MinValue ? new XElement("pubDate", XmlDateFormat(DateTime.Now)) : new XElement("pubDate", XmlDateFormat(r.PublishDate)),
|
||||
new XElement("size", r.Size),
|
||||
r.Category == null ? null : from c in r.Category select new XElement("category", c.Id),
|
||||
r.Categories == null ? null : from c in r.Categories select new XElement("category", c.Id),
|
||||
new XElement(
|
||||
"enclosure",
|
||||
new XAttribute("url", r.DownloadUrl ?? t.MagnetUrl ?? string.Empty),
|
||||
r.Size == null ? null : new XAttribute("length", r.Size),
|
||||
new XAttribute("type", protocol == DownloadProtocol.Torrent ? "application/x-bittorrent" : "application/x-nzb")),
|
||||
r.Category == null ? null : from c in r.Category select GetNabElement("category", c.Id, protocol),
|
||||
r.Categories == null ? null : from c in r.Categories select GetNabElement("category", c.Id, protocol),
|
||||
r.IndexerFlags == null ? null : from f in r.IndexerFlags select GetNabElement("tag", f.Name, protocol),
|
||||
GetNabElement("rageid", r.TvRageId, protocol),
|
||||
GetNabElement("thetvdb", r.TvdbId, protocol),
|
||||
|
@@ -449,7 +449,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
Guid = guid.AbsoluteUri,
|
||||
DownloadUrl = linkUri.AbsoluteUri,
|
||||
PublishDate = publishDate,
|
||||
Category = category,
|
||||
Categories = category,
|
||||
Description = description,
|
||||
Size = size,
|
||||
Seeders = seeders,
|
||||
|
@@ -294,7 +294,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
rCat = rCat.Substring(rCatIdx + 4);
|
||||
}
|
||||
|
||||
release.Category = _categories.MapTrackerCatToNewznab(rCat);
|
||||
release.Categories = _categories.MapTrackerCatToNewznab(rCat);
|
||||
|
||||
if (row.QuerySelector("img[alt=\"Gold Torrent\"]") != null)
|
||||
{
|
||||
|
@@ -50,7 +50,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
|
||||
InfoHash = row.InfoHash,
|
||||
InfoUrl = details,
|
||||
Guid = details,
|
||||
Category = cats,
|
||||
Categories = cats,
|
||||
PublishDate = row.CreatedAt,
|
||||
Size = row.FileSize,
|
||||
Files = row.FileCount,
|
||||
|
@@ -297,7 +297,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
release.Title = release.Title.Substring(0, insertPoint) + " Season 1 " + release.Title.Substring(insertPoint);
|
||||
}
|
||||
|
||||
release.Category = currentCategories;
|
||||
release.Categories = currentCategories;
|
||||
|
||||
//release.Description = row.QuerySelector("span.tags")?.TextContent;
|
||||
release.Guid = _baseUrl + qTitleLink.GetAttribute("href");
|
||||
|
@@ -209,7 +209,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
InfoHash = row.InfoHash,
|
||||
InfoUrl = details,
|
||||
Guid = details,
|
||||
Category = _categories.MapTrackerCatDescToNewznab(row.Category),
|
||||
Categories = _categories.MapTrackerCatDescToNewznab(row.Category),
|
||||
PublishDate = DateTime.Parse(row.CreatedAt, CultureInfo.InvariantCulture),
|
||||
Size = row.Size,
|
||||
Grabs = row.Grabs,
|
||||
|
@@ -104,12 +104,12 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
|
||||
torrentInfo.DownloadVolumeFactor = 0;
|
||||
torrentInfo.MinimumRatio = 1;
|
||||
|
||||
torrentInfo.Category = _categories.MapTrackerCatToNewznab(torrent.Resolution);
|
||||
torrentInfo.Categories = _categories.MapTrackerCatToNewznab(torrent.Resolution);
|
||||
|
||||
// Default to TV if category could not be mapped
|
||||
if (torrentInfo.Category == null || !torrentInfo.Category.Any())
|
||||
if (torrentInfo.Categories == null || !torrentInfo.Categories.Any())
|
||||
{
|
||||
torrentInfo.Category = new List<IndexerCategory> { NewznabStandardCategory.TV };
|
||||
torrentInfo.Categories = new List<IndexerCategory> { NewznabStandardCategory.TV };
|
||||
}
|
||||
|
||||
results.Add(torrentInfo);
|
||||
|
@@ -194,17 +194,17 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
var cats = MapTrackerCatToNewznab(value);
|
||||
if (cats.Any())
|
||||
{
|
||||
if (release.Category == null || fieldModifiers.Contains("noappend"))
|
||||
if (release.Categories == null || fieldModifiers.Contains("noappend"))
|
||||
{
|
||||
release.Category = cats;
|
||||
release.Categories = cats;
|
||||
}
|
||||
else
|
||||
{
|
||||
release.Category = release.Category.Union(cats).ToList();
|
||||
release.Categories = release.Categories.Union(cats).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
value = release.Category.ToString();
|
||||
value = release.Categories.ToString();
|
||||
break;
|
||||
case "size":
|
||||
release.Size = ReleaseInfo.GetBytes(value);
|
||||
|
@@ -262,7 +262,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
release.MinimumRatio = 1.1;
|
||||
release.MinimumSeedTime = 432000; // 120 hours
|
||||
release.Title = row.name;
|
||||
release.Category = _categories.MapTrackerCatToNewznab(row.category.ToString());
|
||||
release.Categories = _categories.MapTrackerCatToNewznab(row.category.ToString());
|
||||
release.Size = row.size;
|
||||
release.Seeders = row.seeders;
|
||||
release.Peers = row.leechers + release.Seeders;
|
||||
|
@@ -59,7 +59,7 @@ namespace NzbDrone.Core.Indexers.FileList
|
||||
Guid = string.Format("FileList-{0}", id),
|
||||
Title = result.Name,
|
||||
Size = result.Size,
|
||||
Category = _categories.MapTrackerCatDescToNewznab(result.Category),
|
||||
Categories = _categories.MapTrackerCatDescToNewznab(result.Category),
|
||||
DownloadUrl = GetDownloadUrl(id),
|
||||
InfoUrl = GetInfoUrl(id),
|
||||
Seeders = result.Seeders,
|
||||
|
@@ -88,11 +88,11 @@ namespace NzbDrone.Core.Indexers.Gazelle
|
||||
var category = torrent.Category;
|
||||
if (category == null || category.Contains("Select Category"))
|
||||
{
|
||||
release.Category = _capabilities.Categories.MapTrackerCatToNewznab("1");
|
||||
release.Categories = _capabilities.Categories.MapTrackerCatToNewznab("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
release.Category = _capabilities.Categories.MapTrackerCatDescToNewznab(category);
|
||||
release.Categories = _capabilities.Categories.MapTrackerCatDescToNewznab(category);
|
||||
}
|
||||
|
||||
torrentInfos.Add(release);
|
||||
@@ -120,11 +120,11 @@ namespace NzbDrone.Core.Indexers.Gazelle
|
||||
var category = result.Category;
|
||||
if (category == null || category.Contains("Select Category"))
|
||||
{
|
||||
release.Category = _capabilities.Categories.MapTrackerCatToNewznab("1");
|
||||
release.Categories = _capabilities.Categories.MapTrackerCatToNewznab("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
release.Category = _capabilities.Categories.MapTrackerCatDescToNewznab(category);
|
||||
release.Categories = _capabilities.Categories.MapTrackerCatDescToNewznab(category);
|
||||
}
|
||||
|
||||
torrentInfos.Add(release);
|
||||
|
@@ -335,7 +335,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
DownloadUrl = link.AbsoluteUri,
|
||||
InfoUrl = details.AbsoluteUri,
|
||||
PublishDate = publishDate,
|
||||
Category = cat,
|
||||
Categories = cat,
|
||||
ImdbId = imdb ?? 0,
|
||||
Size = size,
|
||||
Grabs = grabs,
|
||||
|
@@ -308,7 +308,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
DownloadUrl = link.AbsoluteUri,
|
||||
InfoUrl = details.AbsoluteUri,
|
||||
PublishDate = publishDate,
|
||||
Category = cat,
|
||||
Categories = cat,
|
||||
Size = size,
|
||||
Files = files,
|
||||
Grabs = grabs,
|
||||
|
@@ -290,7 +290,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
catLink = catLink.Substring(catSplit + 9);
|
||||
}
|
||||
|
||||
release.Category = _categories.MapTrackerCatToNewznab(catLink);
|
||||
release.Categories = _categories.MapTrackerCatToNewznab(catLink);
|
||||
|
||||
var grabs = row.QuerySelector("td:nth-child(6)").TextContent;
|
||||
release.Grabs = ParseUtil.CoerceInt(grabs);
|
||||
|
@@ -198,7 +198,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
InfoUrl = details,
|
||||
Guid = details,
|
||||
PublishDate = publishDate,
|
||||
Category = _categories.MapTrackerCatToNewznab(torrent.Category.ToString()),
|
||||
Categories = _categories.MapTrackerCatToNewznab(torrent.Category.ToString()),
|
||||
Size = torrent.Size,
|
||||
Seeders = torrent.Seeders,
|
||||
Peers = torrent.Seeders + torrent.PartialSeeders + torrent.Leechers,
|
||||
|
@@ -329,7 +329,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
}
|
||||
|
||||
var category = item.Category;
|
||||
release.Category = _categories.MapTrackerCatToNewznab(category);
|
||||
release.Categories = _categories.MapTrackerCatToNewznab(category);
|
||||
|
||||
release.DownloadUrl = _baseUrl + "/tor/download.php?tid=" + id;
|
||||
release.InfoUrl = _baseUrl + "/t/" + id;
|
||||
|
@@ -112,7 +112,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||
MinimumSeedTime = 345600,
|
||||
DownloadVolumeFactor = free ? 0 : 1,
|
||||
UploadVolumeFactor = 1,
|
||||
Category = new List<IndexerCategory> { NewznabStandardCategory.Movies }
|
||||
Categories = new List<IndexerCategory> { NewznabStandardCategory.Movies }
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@@ -360,7 +360,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
DownloadUrl = link,
|
||||
PublishDate = publishDate,
|
||||
Size = size,
|
||||
Category = _categories.MapTrackerCatToNewznab(cat),
|
||||
Categories = _categories.MapTrackerCatToNewznab(cat),
|
||||
Files = files,
|
||||
Grabs = grabs,
|
||||
Seeders = seeders,
|
||||
|
@@ -58,7 +58,7 @@ namespace NzbDrone.Core.Indexers.Rarbg
|
||||
var torrentInfo = new TorrentInfo();
|
||||
|
||||
torrentInfo.Guid = GetGuid(torrent);
|
||||
torrentInfo.Category = _capabilities.Categories.MapTrackerCatDescToNewznab(torrent.category);
|
||||
torrentInfo.Categories = _capabilities.Categories.MapTrackerCatDescToNewznab(torrent.category);
|
||||
torrentInfo.Title = torrent.title;
|
||||
torrentInfo.Size = torrent.size;
|
||||
torrentInfo.DownloadUrl = torrent.download;
|
||||
|
@@ -307,7 +307,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
Peers = seeders + leechers,
|
||||
Grabs = (int)grabs,
|
||||
Files = (int)files,
|
||||
Category = _categories.MapTrackerCatToNewznab(category),
|
||||
Categories = _categories.MapTrackerCatToNewznab(category),
|
||||
ImdbId = imdb ?? 0,
|
||||
MinimumRatio = 1,
|
||||
MinimumSeedTime = 172800, // 48 hours
|
||||
|
@@ -208,7 +208,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
InfoUrl = _baseUrl + $"shows/{r.Page}/",
|
||||
PublishDate = r.Release_Date.DateTime,
|
||||
Files = 1,
|
||||
Category = new List<IndexerCategory> { NewznabStandardCategory.TVAnime },
|
||||
Categories = new List<IndexerCategory> { NewznabStandardCategory.TVAnime },
|
||||
Seeders = 1,
|
||||
Peers = 2,
|
||||
MinimumRatio = 1,
|
||||
|
@@ -232,7 +232,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
release.MinimumRatio = 1.1;
|
||||
release.MinimumSeedTime = 172800; // 48 hours
|
||||
release.Title = row.name;
|
||||
release.Category = _categories.MapTrackerCatToNewznab(row.category.ToString());
|
||||
release.Categories = _categories.MapTrackerCatToNewznab(row.category.ToString());
|
||||
release.Size = row.size;
|
||||
release.Seeders = row.seeders;
|
||||
release.Peers = row.leechers + release.Seeders;
|
||||
|
@@ -239,7 +239,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
var torrentItem = new TorrentInfo
|
||||
{
|
||||
Title = item.Name,
|
||||
Category = _categories.MapTrackerCatToNewznab(item.Category.ToString()),
|
||||
Categories = _categories.MapTrackerCatToNewznab(item.Category.ToString()),
|
||||
Guid = details,
|
||||
InfoUrl = details,
|
||||
InfoHash = item.InfoHash, // magnet link is auto generated from infohash
|
||||
|
@@ -245,7 +245,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
DownloadUrl = link.AbsoluteUri,
|
||||
InfoUrl = details.AbsoluteUri,
|
||||
PublishDate = publishDate,
|
||||
Category = _categories.MapTrackerCatToNewznab(row.c.ToString()),
|
||||
Categories = _categories.MapTrackerCatToNewznab(row.c.ToString()),
|
||||
Size = (long)row.size,
|
||||
Files = (int)row.files,
|
||||
Grabs = (int)row.completed,
|
||||
|
@@ -305,7 +305,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
Guid = details.AbsoluteUri,
|
||||
DownloadUrl = link.AbsoluteUri,
|
||||
PublishDate = publishDate,
|
||||
Category = cats,
|
||||
Categories = cats,
|
||||
Size = size,
|
||||
Grabs = grabs,
|
||||
Seeders = seeders,
|
||||
|
@@ -299,7 +299,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
release.MinimumSeedTime = 72 * 60 * 60;
|
||||
var qCatLink = row.QuerySelector("a[href^=\"/browse_elastic.php?cat=\"]");
|
||||
var catStr = qCatLink.GetAttribute("href").Split('=')[1];
|
||||
release.Category = _categories.MapTrackerCatToNewznab(catStr);
|
||||
release.Categories = _categories.MapTrackerCatToNewznab(catStr);
|
||||
var qDetailsLink = row.QuerySelector("a[href^=\"/details.php?id=\"]");
|
||||
var qDetailsTitle = row.QuerySelector("td:has(a[href^=\"/details.php?id=\"]) b");
|
||||
release.Title = qDetailsTitle.TextContent.Trim();
|
||||
|
@@ -54,7 +54,7 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D
|
||||
InfoHash = row.Id,
|
||||
InfoUrl = details,
|
||||
Guid = details,
|
||||
Category = _categories.MapTrackerCatDescToNewznab(row.Attributes.Category),
|
||||
Categories = _categories.MapTrackerCatDescToNewznab(row.Attributes.Category),
|
||||
PublishDate = DateTime.Parse(row.Attributes.CreatedAt, CultureInfo.InvariantCulture),
|
||||
Size = row.Attributes.Size,
|
||||
Files = row.Attributes.Files,
|
||||
|
@@ -378,7 +378,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
Guid = details.AbsoluteUri,
|
||||
DownloadUrl = link.AbsoluteUri,
|
||||
PublishDate = publishDate,
|
||||
Category = cat,
|
||||
Categories = cat,
|
||||
Size = size,
|
||||
Grabs = grabs,
|
||||
Seeders = seeders,
|
||||
|
@@ -160,7 +160,7 @@ namespace NzbDrone.Core.Indexers
|
||||
releaseInfo.DownloadUrl = GetDownloadUrl(item);
|
||||
releaseInfo.InfoUrl = GetInfoUrl(item);
|
||||
releaseInfo.CommentUrl = GetCommentUrl(item);
|
||||
releaseInfo.Category = GetCategory(item);
|
||||
releaseInfo.Categories = GetCategory(item);
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -11,6 +11,7 @@ namespace NzbDrone.Core.Parser.Model
|
||||
public ReleaseInfo()
|
||||
{
|
||||
IndexerFlags = new List<IndexerFlag>();
|
||||
Categories = new List<IndexerCategory>();
|
||||
}
|
||||
|
||||
public string Guid { get; set; }
|
||||
@@ -37,7 +38,7 @@ namespace NzbDrone.Core.Parser.Model
|
||||
public string Container { get; set; }
|
||||
public string Codec { get; set; }
|
||||
public string Resolution { get; set; }
|
||||
public ICollection<IndexerCategory> Category { get; set; }
|
||||
public ICollection<IndexerCategory> Categories { get; set; }
|
||||
|
||||
public ICollection<IndexerFlag> IndexerFlags { get; set; }
|
||||
|
||||
|
@@ -65,7 +65,7 @@ namespace Prowlarr.Api.V1.Search
|
||||
CommentUrl = releaseInfo.CommentUrl,
|
||||
DownloadUrl = releaseInfo.DownloadUrl,
|
||||
InfoUrl = releaseInfo.InfoUrl,
|
||||
Categories = releaseInfo.Category,
|
||||
Categories = releaseInfo.Categories,
|
||||
|
||||
//ReleaseWeight
|
||||
MagnetUrl = torrentInfo.MagnetUrl,
|
||||
|
Reference in New Issue
Block a user