New: Add PosterUrl to ReleaseInfo for parsing

pull/354/head
Qstick 4 years ago
parent a127e5a30f
commit e304461dfb

@ -238,7 +238,7 @@ namespace NzbDrone.Core.Indexers.Definitions
var torrentId = qDetailsLink.GetAttribute("href").Split('=').Last(); var torrentId = qDetailsLink.GetAttribute("href").Split('=').Last();
var link = _settings.BaseUrl + "torrents.php?action=download&id=" + torrentId; var link = _settings.BaseUrl + "torrents.php?action=download&id=" + torrentId;
var posterStr = qDetailsLink.GetAttribute("data-cover"); var posterStr = qDetailsLink.GetAttribute("data-cover");
var poster = !string.IsNullOrWhiteSpace(posterStr) ? new Uri(qDetailsLink.GetAttribute("data-cover")) : null; var poster = !string.IsNullOrWhiteSpace(posterStr) ? posterStr : null;
var files = ParseUtil.CoerceInt(row.QuerySelector("td:nth-child(3)").TextContent); var files = ParseUtil.CoerceInt(row.QuerySelector("td:nth-child(3)").TextContent);
var publishDate = DateTimeUtil.FromTimeAgo(row.QuerySelector("td:nth-child(4)").TextContent); var publishDate = DateTimeUtil.FromTimeAgo(row.QuerySelector("td:nth-child(4)").TextContent);
@ -276,6 +276,7 @@ namespace NzbDrone.Core.Indexers.Definitions
Categories = category, Categories = category,
DownloadUrl = link, DownloadUrl = link,
InfoUrl = details, InfoUrl = details,
PosterUrl = poster,
Guid = link, Guid = link,
ImdbId = imdb.GetValueOrDefault(), ImdbId = imdb.GetValueOrDefault(),
Seeders = seeders, Seeders = seeders,

@ -293,6 +293,15 @@ namespace NzbDrone.Core.Indexers.Cardigann
release.TvdbId = (int)ParseUtil.CoerceLong(tvdbId); release.TvdbId = (int)ParseUtil.CoerceLong(tvdbId);
value = release.TvdbId.ToString(); value = release.TvdbId.ToString();
break; break;
case "poster":
if (!string.IsNullOrWhiteSpace(value))
{
var poster = ResolvePath(value, searchUrlUri);
release.PosterUrl = poster.AbsoluteUri;
}
value = release.PosterUrl;
break;
//case "author": //case "author":
// release.Author = value; // release.Author = value;
@ -300,15 +309,6 @@ namespace NzbDrone.Core.Indexers.Cardigann
//case "booktitle": //case "booktitle":
// release.BookTitle = value; // release.BookTitle = value;
// break; // break;
//case "banner":
// if (!string.IsNullOrWhiteSpace(value))
// {
// var bannerurl = ResolvePath(value, searchUrlUri);
// release.BannerUrl = bannerurl;
// }
// value = release.BannerUrl.ToString();
// break;
default: default:
break; break;
} }

@ -205,6 +205,7 @@ namespace NzbDrone.Core.Indexers.Definitions
Title = row.Name, Title = row.Name,
InfoUrl = $"{_settings.BaseUrl}torrents/{row.Id}", InfoUrl = $"{_settings.BaseUrl}torrents/{row.Id}",
DownloadUrl = $"{_settings.BaseUrl}torrent/download/{row.Id}.{jsonResponse.Resource.Rsskey}", DownloadUrl = $"{_settings.BaseUrl}torrent/download/{row.Id}.{jsonResponse.Resource.Rsskey}",
PosterUrl = row.PosterImage,
PublishDate = row.CreatedAt, PublishDate = row.CreatedAt,
Categories = _categories.MapTrackerCatToNewznab(row.CategoryId), Categories = _categories.MapTrackerCatToNewznab(row.CategoryId),
Size = row.Size, Size = row.Size,

@ -255,7 +255,7 @@ namespace NzbDrone.Core.Indexers.Definitions
var details = new Uri(_settings.BaseUrl + mainLink.GetAttribute("href")); var details = new Uri(_settings.BaseUrl + mainLink.GetAttribute("href"));
var posterMatch = _posterRegex.Match(mainLink.GetAttribute("onmouseover")); var posterMatch = _posterRegex.Match(mainLink.GetAttribute("onmouseover"));
var poster = posterMatch.Success ? new Uri(_settings.BaseUrl + posterMatch.Groups[1].Value.Replace("\\", "/")) : null; var poster = posterMatch.Success ? _settings.BaseUrl + posterMatch.Groups[1].Value.Replace("\\", "/") : null;
var link = new Uri(_settings.BaseUrl + row.Children[4].FirstElementChild.GetAttribute("href")); var link = new Uri(_settings.BaseUrl + row.Children[4].FirstElementChild.GetAttribute("href"));
var description = row.Children[2].QuerySelector("span").TextContent; var description = row.Children[2].QuerySelector("span").TextContent;
@ -331,6 +331,7 @@ namespace NzbDrone.Core.Indexers.Definitions
Guid = details.AbsoluteUri, Guid = details.AbsoluteUri,
DownloadUrl = link.AbsoluteUri, DownloadUrl = link.AbsoluteUri,
InfoUrl = details.AbsoluteUri, InfoUrl = details.AbsoluteUri,
PosterUrl = poster,
PublishDate = publishDate, PublishDate = publishDate,
Categories = cat, Categories = cat,
ImdbId = imdb ?? 0, ImdbId = imdb ?? 0,

@ -242,6 +242,7 @@ namespace NzbDrone.Core.Indexers.Definitions
Title = title, Title = title,
Guid = details, Guid = details,
InfoUrl = details, InfoUrl = details,
PosterUrl = poster.AbsoluteUri,
DownloadUrl = link, DownloadUrl = link,
Categories = new List<IndexerCategory> { TvCategoryFromQualityParser.ParseTvShowQuality(title) }, Categories = new List<IndexerCategory> { TvCategoryFromQualityParser.ParseTvShowQuality(title) },
Size = size, Size = size,

@ -378,6 +378,7 @@ namespace NzbDrone.Core.Indexers.Definitions
Size = torrent.Size, Size = torrent.Size,
ImdbId = ParseUtil.GetImdbID(torrent.ImdbId).GetValueOrDefault(), ImdbId = ParseUtil.GetImdbID(torrent.ImdbId).GetValueOrDefault(),
DownloadUrl = $"{Settings.BaseUrl}/api/torrent/{torrent.Id}/download", DownloadUrl = $"{Settings.BaseUrl}/api/torrent/{torrent.Id}/download",
PosterUrl = torrent.Poster,
InfoUrl = torrent.Url, InfoUrl = torrent.Url,
Grabs = torrent.TimesCompleted, Grabs = torrent.TimesCompleted,
PublishDate = torrent.CreatedAt, PublishDate = torrent.CreatedAt,

@ -252,10 +252,11 @@ namespace NzbDrone.Core.Indexers.Definitions
release.UploadVolumeFactor = 1; release.UploadVolumeFactor = 1;
//if (!string.IsNullOrWhiteSpace(row.customcover.ToString())) if (!string.IsNullOrWhiteSpace(row.customcover.ToString()))
//{ {
// release.Poster = new Uri(SiteLink + row.customcover); release.PosterUrl = _settings.BaseUrl + row.customcover;
//} }
if (row.imdbid2 != null && row.imdbid2.ToString().StartsWith("tt")) if (row.imdbid2 != null && row.imdbid2.ToString().StartsWith("tt"))
{ {
release.ImdbId = ParseUtil.CoerceInt(row.imdbid2.ToString().Substring(2)); release.ImdbId = ParseUtil.CoerceInt(row.imdbid2.ToString().Substring(2));
@ -267,7 +268,7 @@ namespace NzbDrone.Core.Indexers.Definitions
descriptions.Add("Rating: " + row.rating); descriptions.Add("Rating: " + row.rating);
descriptions.Add("Plot: " + row.plot); descriptions.Add("Plot: " + row.plot);
//release.Poster = new Uri(SiteLink + "img/imdb/" + row.imdbid2 + ".jpg"); release.PosterUrl = _settings.BaseUrl + "img/imdb/" + row.imdbid2 + ".jpg";
} }
if ((int)row.p2p == 1) if ((int)row.p2p == 1)

@ -247,7 +247,7 @@ namespace NzbDrone.Core.Indexers.Definitions
release.InfoUrl = movie.Value<string>("url"); release.InfoUrl = movie.Value<string>("url");
//release.Poster = new Uri(movie.Value<string>("large_cover_image")); release.PosterUrl = new Uri(movie.Value<string>("large_cover_image")).AbsoluteUri;
release.Guid = release.DownloadUrl; release.Guid = release.DownloadUrl;
// map the quality to a newznab category for torznab compatibility (for Radarr, etc) // map the quality to a newznab category for torznab compatibility (for Radarr, etc)

@ -375,6 +375,7 @@ namespace NzbDrone.Core.Indexers.Definitions
InfoUrl = details.AbsoluteUri, InfoUrl = details.AbsoluteUri,
Guid = details.AbsoluteUri, Guid = details.AbsoluteUri,
DownloadUrl = link.AbsoluteUri, DownloadUrl = link.AbsoluteUri,
PosterUrl = poster.AbsoluteUri,
PublishDate = publishDate, PublishDate = publishDate,
Categories = cat, Categories = cat,
Size = size, Size = size,

@ -33,6 +33,8 @@ namespace NzbDrone.Core.Parser.Model
public int TmdbId { get; set; } public int TmdbId { get; set; }
public DateTime PublishDate { get; set; } public DateTime PublishDate { get; set; }
public string PosterUrl { get; set; }
public string Origin { get; set; } public string Origin { get; set; }
public string Source { get; set; } public string Source { get; set; }
public string Container { get; set; } public string Container { get; set; }

@ -27,6 +27,7 @@ namespace Prowlarr.Api.V1.Search
public string CommentUrl { get; set; } public string CommentUrl { get; set; }
public string DownloadUrl { get; set; } public string DownloadUrl { get; set; }
public string InfoUrl { get; set; } public string InfoUrl { get; set; }
public string PosterUrl { get; set; }
public IEnumerable<string> IndexerFlags { get; set; } public IEnumerable<string> IndexerFlags { get; set; }
public ICollection<IndexerCategory> Categories { get; set; } public ICollection<IndexerCategory> Categories { get; set; }
@ -65,6 +66,7 @@ namespace Prowlarr.Api.V1.Search
CommentUrl = releaseInfo.CommentUrl, CommentUrl = releaseInfo.CommentUrl,
DownloadUrl = releaseInfo.DownloadUrl, DownloadUrl = releaseInfo.DownloadUrl,
InfoUrl = releaseInfo.InfoUrl, InfoUrl = releaseInfo.InfoUrl,
PosterUrl = releaseInfo.PosterUrl,
Categories = releaseInfo.Categories, Categories = releaseInfo.Categories,
//ReleaseWeight //ReleaseWeight
@ -101,6 +103,7 @@ namespace Prowlarr.Api.V1.Search
model.Size = resource.Size; model.Size = resource.Size;
model.DownloadUrl = resource.DownloadUrl; model.DownloadUrl = resource.DownloadUrl;
model.InfoUrl = resource.InfoUrl; model.InfoUrl = resource.InfoUrl;
model.PosterUrl = resource.PosterUrl;
model.CommentUrl = resource.CommentUrl; model.CommentUrl = resource.CommentUrl;
model.IndexerId = resource.IndexerId; model.IndexerId = resource.IndexerId;
model.Indexer = resource.Indexer; model.Indexer = resource.Indexer;

Loading…
Cancel
Save