diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornApi.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornApi.cs index d126f0d1b..0867ad1ba 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornApi.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornApi.cs @@ -37,6 +37,7 @@ public class PassThePopcornTorrent public string Seeders { get; set; } public string Leechers { get; set; } public string ReleaseName { get; set; } + public string ReleaseGroup { get; set; } public bool Checked { get; set; } public bool GoldenPopcorn { get; set; } public string FreeleechType { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs index fa5791a62..e7e2b30c1 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs @@ -93,7 +93,7 @@ public IList ParseResponse(IndexerResponse indexerResponse) torrentInfos.Add(new TorrentInfo { Guid = $"PassThePopcorn-{id}", - Title = title, + Title = GetTitle(torrent, result), Year = int.Parse(result.Year), InfoUrl = GetInfoUrl(result.GroupId, id), DownloadUrl = GetDownloadUrl(id), @@ -119,6 +119,55 @@ public IList ParseResponse(IndexerResponse indexerResponse) return torrentInfos; } + private static string GetTitle(PassThePopcornTorrent torrent, PassThePopcornMovie result) + { + var title = torrent.ReleaseName; + + if (torrent.Container.ToUpperInvariant() is "M2TS" or "ISO" or "VOB IFO" || !torrent.ReleaseName.Contains(result.Year)) + { + title = $"{result.Title} ({result.Year})"; + + var titleTags = new List(); + + if (torrent.Resolution.IsNotNullOrWhiteSpace()) + { + titleTags.Add(torrent.Resolution); + } + + if (torrent.Source.IsNotNullOrWhiteSpace()) + { + titleTags.Add(torrent.Source); + } + + if (torrent.Codec.IsNotNullOrWhiteSpace()) + { + titleTags.Add(torrent.Codec); + } + + if (torrent.Container.IsNotNullOrWhiteSpace()) + { + titleTags.Add(torrent.Container.ToUpperInvariant()); + } + + if (torrent.RemasterTitle.IsNotNullOrWhiteSpace()) + { + titleTags.Add(torrent.RemasterTitle); + } + + if (titleTags.Any()) + { + title += $" {string.Join(" / ", titleTags)}"; + } + + if (torrent.ReleaseGroup.IsNotNullOrWhiteSpace()) + { + title += $" -{torrent.ReleaseGroup}"; + } + } + + return title; + } + public Action, DateTime?> CookiesUpdater { get; set; } private string GetDownloadUrl(int torrentId)