Fixed: (AnimeBytes) Include year in release title for series with year in filenames

pull/2321/head
Bogdan 1 week ago
parent 2b4a6def2a
commit 523e46af2a

@ -122,7 +122,7 @@ namespace NzbDrone.Core.Test.IndexerTests.AnimeBytesTests
var fifthTorrentInfo = releases.ElementAt(28) as TorrentInfo; var fifthTorrentInfo = releases.ElementAt(28) as TorrentInfo;
fifthTorrentInfo.Title.Should().Be("[-ZR-] Dr. STONE: STONE WARS S02 [Web][MKV][h264][1080p][AAC 2.0][Dual Audio][Softsubs (-ZR-)]"); fifthTorrentInfo.Title.Should().Be("[-ZR-] Dr. STONE: STONE WARS 2021 S02 [Web][MKV][h264][1080p][AAC 2.0][Dual Audio][Softsubs (-ZR-)]");
fifthTorrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent); fifthTorrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
fifthTorrentInfo.DownloadUrl.Should().Be("https://animebytes.tv/torrent/944509/download/somepass"); fifthTorrentInfo.DownloadUrl.Should().Be("https://animebytes.tv/torrent/944509/download/somepass");
fifthTorrentInfo.InfoUrl.Should().Be("https://animebytes.tv/torrent/944509/group"); fifthTorrentInfo.InfoUrl.Should().Be("https://animebytes.tv/torrent/944509/group");

@ -569,7 +569,7 @@ namespace NzbDrone.Core.Indexers.Definitions
if (_settings.UseFilenameForSingleEpisodes) if (_settings.UseFilenameForSingleEpisodes)
{ {
var files = torrent.Files; var files = torrent.Files.ToList();
if (files.Count > 1) if (files.Count > 1)
{ {
@ -607,11 +607,13 @@ namespace NzbDrone.Core.Indexers.Definitions
} }
} }
var useYearInTitle = year is > 0 && torrent.Files.Any(f => f.FileName.Contains(year.Value.ToString()));
foreach (var title in synonyms) foreach (var title in synonyms)
{ {
var releaseTitle = groupName is "Movie" or "Live Action Movie" ? var releaseTitle = groupName is "Movie" or "Live Action Movie" ?
$"{releaseGroup}{title} {year} {infoString}" : $"{releaseGroup}{title} {year} {infoString}" :
$"{releaseGroup}{title} {releaseInfo} {infoString}"; $"{releaseGroup}{title}{(useYearInTitle ? $" {year}" : string.Empty)} {releaseInfo} {infoString}";
var guid = new Uri(details + "?nh=" + HashUtil.CalculateMd5(title)); var guid = new Uri(details + "?nh=" + HashUtil.CalculateMd5(title));
@ -650,7 +652,7 @@ namespace NzbDrone.Core.Indexers.Definitions
{ {
var advancedSeasonRegex = new Regex(@"\b(?:(?<season>\d+)(?:st|nd|rd|th) Season|Season (?<season>\d+))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); var advancedSeasonRegex = new Regex(@"\b(?:(?<season>\d+)(?:st|nd|rd|th) Season|Season (?<season>\d+))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
var seasonCharactersRegex = new Regex(@"(I{2,})$", RegexOptions.Compiled); var seasonCharactersRegex = new Regex(@"(I{2,})$", RegexOptions.Compiled);
var seasonNumberRegex = new Regex(@"\b(?<!Part[- ._])(?:S)?(?<season>[2-9])$", RegexOptions.Compiled); var seasonNumberRegex = new Regex(@"(?<!Part[- ._])(?<!\d+[/])(?:S)?(?<season>[2-9])$", RegexOptions.Compiled);
foreach (var title in titles) foreach (var title in titles)
{ {
@ -755,7 +757,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public int Matches { get; set; } public int Matches { get; set; }
[JsonPropertyName("Groups")] [JsonPropertyName("Groups")]
public AnimeBytesGroup[] Groups { get; set; } public IReadOnlyCollection<AnimeBytesGroup> Groups { get; set; }
} }
public class AnimeBytesGroup public class AnimeBytesGroup
@ -783,16 +785,16 @@ namespace NzbDrone.Core.Indexers.Definitions
public string Image { get; set; } public string Image { get; set; }
[JsonPropertyName("SynonymnsV2")] [JsonPropertyName("SynonymnsV2")]
public Dictionary<string, string> Synonymns { get; set; } public IReadOnlyDictionary<string, string> Synonymns { get; set; }
[JsonPropertyName("Description")] [JsonPropertyName("Description")]
public string Description { get; set; } public string Description { get; set; }
[JsonPropertyName("Tags")] [JsonPropertyName("Tags")]
public List<string> Tags { get; set; } public IReadOnlyCollection<string> Tags { get; set; }
[JsonPropertyName("Torrents")] [JsonPropertyName("Torrents")]
public List<AnimeBytesTorrent> Torrents { get; set; } public IReadOnlyCollection<AnimeBytesTorrent> Torrents { get; set; }
} }
public class AnimeBytesTorrent public class AnimeBytesTorrent
@ -831,7 +833,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public int FileCount { get; set; } public int FileCount { get; set; }
[JsonPropertyName("FileList")] [JsonPropertyName("FileList")]
public List<AnimeBytesFile> Files { get; set; } public IReadOnlyCollection<AnimeBytesFile> Files { get; set; }
[JsonPropertyName("UploadTime")] [JsonPropertyName("UploadTime")]
public string UploadTime { get; set; } public string UploadTime { get; set; }

Loading…
Cancel
Save