From cfbaf893188283cf9368a33ee27847ccbfebcca2 Mon Sep 17 00:00:00 2001 From: Garfield69 Date: Tue, 10 May 2022 14:49:46 +1200 Subject: [PATCH] erairaws: append optional subs to title. resolves #13234 --- src/Jackett.Common/Indexers/EraiRaws.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Jackett.Common/Indexers/EraiRaws.cs b/src/Jackett.Common/Indexers/EraiRaws.cs index beb9141fb..01a167a01 100644 --- a/src/Jackett.Common/Indexers/EraiRaws.cs +++ b/src/Jackett.Common/Indexers/EraiRaws.cs @@ -68,6 +68,8 @@ namespace Jackett.Common.Indexers new DisplayInfoConfigurationItem("", "

Please note that the following stats are not available for this indexer. Default values are used instead.

") ); + configData.AddDynamic("include-subs", new BoolConfigurationItem("Enable appending SubTitles to the Title")); + // Config item for title detail parsing configData.AddDynamic("title-detail-parsing", new BoolConfigurationItem("Enable Title Detail Parsing")); configData.AddDynamic( @@ -83,6 +85,7 @@ namespace Jackett.Common.Indexers private string RSSKey => ((StringConfigurationItem)configData.GetDynamic("rssKey")).Value; private bool IsTitleDetailParsingEnabled => ((BoolConfigurationItem)configData.GetDynamic("title-detail-parsing")).Value; + private bool IsSubsEnabled => ((BoolConfigurationItem)configData.GetDynamic("include-subs")).Value; public string RssFeedUri => SiteLink + RSS_PATH + "&" + RSSKey; @@ -200,9 +203,14 @@ namespace Jackett.Common.Indexers guid = builder.Uri; } + var subs = ""; + if (IsSubsEnabled) + { + subs = string.Concat(" JAPANESE [Subs: ", fi.SubTitles, "]"); + } yield return new ReleaseInfo { - Title = string.Concat(fi.Title, " - ", fi.Quality), + Title = string.Concat(fi.Title, " - ", fi.Quality, subs), Guid = guid, MagnetUri = fi.MagnetLink, InfoHash = fi.InfoHash, @@ -247,6 +255,7 @@ namespace Jackett.Common.Indexers var size = rssItem.SelectSingleNode("erai:size", nsm)?.InnerText; var description = rssItem.SelectSingleNode("description")?.InnerText; var quality = rssItem.SelectSingleNode("erai:resolution", nsm)?.InnerText; + var subs = rssItem.SelectSingleNode("erai:subtitles", nsm)?.InnerText; item = new RssFeedItem { @@ -256,7 +265,8 @@ namespace Jackett.Common.Indexers PublishDate = publishDate, Size = size, Description = description, - Quality = quality + Quality = quality, + SubTitles = subs }; return item.IsValid(); } @@ -280,6 +290,8 @@ namespace Jackett.Common.Indexers public string Quality { get; private set; } + public string SubTitles { get; private set; } + /// /// Check there is enough information to process the item. /// @@ -307,6 +319,7 @@ namespace Jackett.Common.Indexers Size = ReleaseInfo.GetBytes(feedItem.Size); DetailsLink = ParseDetailsLink(feedItem.Description); InfoHash = feedItem.InfoHash; + SubTitles = feedItem.SubTitles.Replace("[", " ").Replace("]", " ").ToUpper(); if (Uri.TryCreate(feedItem.Link, UriKind.Absolute, out Uri magnetUri)) MagnetLink = magnetUri; @@ -339,6 +352,8 @@ namespace Jackett.Common.Indexers public string Quality { get; } + public string SubTitles { get; } + public string Title { get; set; } public Uri MagnetLink { get; }