remove trials and demos from results

This commit is contained in:
13xforever 2020-04-04 00:34:41 +05:00
parent 37a13ddb1f
commit aac4ddb4c6

View File

@ -6,6 +6,7 @@ using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using CompatApiClient;
@ -140,6 +141,7 @@ namespace CompatBot.Commands
.OrderByDescending(i => i.score)
.Select(i => i.title)
.Distinct(StringComparer.InvariantCultureIgnoreCase)
.Where(title => !Regex.IsMatch(title, @"\b(demo|trial)\b", RegexOptions.IgnoreCase | RegexOptions.Singleline))
.Take(number)
.ToList();
if (resultList.Count > 0)
@ -618,7 +620,7 @@ namespace CompatBot.Commands
var title = mcScore.Title;
var matches = db.Thumbnail
.Where(t => t.MetacriticId == null)
//.Where(t => t.MetacriticId == null)
.AsEnumerable()
.Select(t => (thumb: t, coef: t.Name.GetFuzzyCoefficientCached(title)))
.Where(i => i.coef > 0.90)
@ -675,6 +677,7 @@ namespace CompatBot.Commands
Config.Log.Warn(e);
}
}
matches = matches.Where(i => !Regex.IsMatch(i.thumb.Name, @"\b(demo|trial)\b", RegexOptions.IgnoreCase | RegexOptions.Singleline)).ToList();
//var bestMatch = matches.FirstOrDefault();
//Config.Log.Trace($"Best title match for [{item.Title}] is [{bestMatch.thumb.Name}] with score {bestMatch.coef:0.0000}");
if (matches.Count > 0)