broadcastthenet: Season Search enhancement (#5174)

- If only a season is searched, format it in a way expected by the indexer
This commit is contained in:
James
2019-05-03 15:54:30 -04:00
committed by garfield69
parent ff62b775db
commit 992d2776d3

View File

@@ -1,7 +1,8 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Jackett.Common.Models;
using Jackett.Common.Models.IndexerConfig;
@@ -91,6 +92,13 @@ namespace Jackett.Common.Indexers
var btnOffset = query.Offset;
var releases = new List<ReleaseInfo>();
// If only the season is searched for then change format to match expected format
var seasonOnlyMatch = new Regex(@".*\s[Ss]{1}\d{2}(?<![Ee]{1}\d{2,3})?$").Match(searchString);
if (seasonOnlyMatch.Success)
{
searchString = Regex.Replace(searchString, @"[Ss]{1}\d{2}", $"Season {query.Season}");
}
var parameters = new JArray();
parameters.Add(new JValue(configData.Key.Value));
parameters.Add(new JValue(searchString.Trim()));