Intermediate commit
This commit is contained in:
@@ -47,7 +47,7 @@ namespace UmlautAdaptarr.Models
|
||||
{
|
||||
return [];
|
||||
}
|
||||
var cleanTitle = germanTitle.RemoveAccentButKeepGermanUmlauts();
|
||||
var cleanTitle = germanTitle.RemoveAccentButKeepGermanUmlauts().GetCleanTitle();
|
||||
|
||||
// Start with base variations including handling umlauts
|
||||
var baseVariations = new List<string>
|
||||
|
||||
@@ -13,14 +13,13 @@ namespace UmlautAdaptarr.Services
|
||||
{
|
||||
var prefix = item.MediaType;
|
||||
var normalizedTitle = item.Title.RemoveAccentButKeepGermanUmlauts().ToLower();
|
||||
// TODO maybe we need to also add the media type (movie/book/show etc)
|
||||
|
||||
cache.Set($"{prefix}_extid_{item.ExternalId}", item);
|
||||
cache.Set($"{prefix}_title_{normalizedTitle}", item);
|
||||
|
||||
foreach (var variation in item.TitleSearchVariations)
|
||||
foreach (var variation in item.TitleMatchVariations)
|
||||
{
|
||||
var normalizedVariation = item.Title.RemoveAccentButKeepGermanUmlauts().ToLower();
|
||||
var normalizedVariation = variation.RemoveAccentButKeepGermanUmlauts().ToLower();
|
||||
var cacheKey = $"{prefix}_var_{normalizedVariation}";
|
||||
cache.Set(cacheKey, item);
|
||||
|
||||
@@ -28,7 +27,7 @@ namespace UmlautAdaptarr.Services
|
||||
var indexPrefix = normalizedVariation[..Math.Min(VARIATION_LOOKUP_CACHE_LENGTH, variation.Length)].ToLower();
|
||||
if (!VariationIndex.ContainsKey(indexPrefix))
|
||||
{
|
||||
VariationIndex[indexPrefix] = new HashSet<string>();
|
||||
VariationIndex[indexPrefix] = [];
|
||||
}
|
||||
VariationIndex[indexPrefix].Add(cacheKey);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace UmlautAdaptarr.Services
|
||||
}
|
||||
|
||||
// Use CacheService to find a matching SearchItem by title
|
||||
var searchItem = cacheService.SearchItemByTitle(mediaType, originalTitle);
|
||||
var searchItem = cacheService.SearchItemByTitle(mediaType, normalizedOriginalTitle);
|
||||
if (searchItem != null)
|
||||
{
|
||||
// If a SearchItem is found, use its ExpectedTitle and titleMatchVariations for renaming
|
||||
|
||||
@@ -46,6 +46,11 @@ namespace UmlautAdaptarr.Utilities
|
||||
return stringBuilder.ToString().Normalize(NormalizationForm.FormC);
|
||||
}
|
||||
|
||||
public static string GetCleanTitle(this string text)
|
||||
{
|
||||
return text.Replace("(", "").Replace(")", "").Replace("?","").Replace(":", "");
|
||||
}
|
||||
|
||||
public static string ReplaceGermanUmlautsWithLatinEquivalents(this string text)
|
||||
{
|
||||
return text
|
||||
|
||||
Reference in New Issue
Block a user