Fixed: (PassThePopcorn) Generate titles for full discs

This commit is contained in:
Bogdan 2025-02-04 18:23:38 +02:00 committed by bakerboy448
parent 98ee9c1703
commit fbf4ff6777
2 changed files with 51 additions and 1 deletions

View file

@ -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; }

View file

@ -93,7 +93,7 @@ public IList<ReleaseInfo> 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<ReleaseInfo> 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<string>();
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<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
private string GetDownloadUrl(int torrentId)