From fd6a8581d8974a4e7ee6f7b4ba9bd93638f2d4a6 Mon Sep 17 00:00:00 2001 From: pcjones Date: Wed, 4 Sep 2024 18:06:51 +0200 Subject: [PATCH] Also search for "GERMAN" if title ends with "Germany" and also match for title without "Germany" --- UmlautAdaptarr/Models/SearchItem.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/UmlautAdaptarr/Models/SearchItem.cs b/UmlautAdaptarr/Models/SearchItem.cs index 29fdabf..4e3239b 100644 --- a/UmlautAdaptarr/Models/SearchItem.cs +++ b/UmlautAdaptarr/Models/SearchItem.cs @@ -108,6 +108,20 @@ namespace UmlautAdaptarr.Models } + // if a german title ends with "Germany" (e.g. Good Luck Guys Germany) also add a search string that replaces Germany with GERMAN + // (e.g. Good Luck Guys GERMAN). This is because reality shows often have different formats in different countries with the same + // name. // also add a matching title without GERMAN + if (germanTitle?.EndsWith("germany", StringComparison.OrdinalIgnoreCase) ?? false) + { + TitleSearchVariations = [.. TitleSearchVariations, + .. + GenerateVariations( + (germanTitle[..^7] + "GERMAN").RemoveExtraWhitespaces(), + mediaType)]; + + allTitleVariations.AddRange(GenerateVariations(germanTitle[..^8].Trim(), mediaType)); + } + // If title contains ":" also match for "-" if (germanTitle?.Contains(':') ?? false) {