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

This commit is contained in:
Bogdan 2024-12-31 01:55:55 +02:00
parent 2b4a6def2a
commit 523e46af2a
2 changed files with 11 additions and 9 deletions

View file

@ -122,7 +122,7 @@ public async Task should_parse_recent_feed_from_animebytes()
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.DownloadUrl.Should().Be("https://animebytes.tv/torrent/944509/download/somepass");
fifthTorrentInfo.InfoUrl.Should().Be("https://animebytes.tv/torrent/944509/group");

View file

@ -569,7 +569,7 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
if (_settings.UseFilenameForSingleEpisodes)
{
var files = torrent.Files;
var files = torrent.Files.ToList();
if (files.Count > 1)
{
@ -607,11 +607,13 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
}
}
var useYearInTitle = year is > 0 && torrent.Files.Any(f => f.FileName.Contains(year.Value.ToString()));
foreach (var title in synonyms)
{
var releaseTitle = groupName is "Movie" or "Live Action Movie" ?
$"{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));
@ -650,7 +652,7 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
{
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 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)
{
@ -755,7 +757,7 @@ public class AnimeBytesResponse
public int Matches { get; set; }
[JsonPropertyName("Groups")]
public AnimeBytesGroup[] Groups { get; set; }
public IReadOnlyCollection<AnimeBytesGroup> Groups { get; set; }
}
public class AnimeBytesGroup
@ -783,16 +785,16 @@ public class AnimeBytesGroup
public string Image { get; set; }
[JsonPropertyName("SynonymnsV2")]
public Dictionary<string, string> Synonymns { get; set; }
public IReadOnlyDictionary<string, string> Synonymns { get; set; }
[JsonPropertyName("Description")]
public string Description { get; set; }
[JsonPropertyName("Tags")]
public List<string> Tags { get; set; }
public IReadOnlyCollection<string> Tags { get; set; }
[JsonPropertyName("Torrents")]
public List<AnimeBytesTorrent> Torrents { get; set; }
public IReadOnlyCollection<AnimeBytesTorrent> Torrents { get; set; }
}
public class AnimeBytesTorrent
@ -831,7 +833,7 @@ public class AnimeBytesTorrent
public int FileCount { get; set; }
[JsonPropertyName("FileList")]
public List<AnimeBytesFile> Files { get; set; }
public IReadOnlyCollection<AnimeBytesFile> Files { get; set; }
[JsonPropertyName("UploadTime")]
public string UploadTime { get; set; }