mirror of https://github.com/jellyfin/jellyfin.git
commit
d7992bda67
|
@ -444,8 +444,8 @@ namespace MediaBrowser.Providers.Manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((originalPremiereDate ?? DateTime.MinValue) != (item.PremiereDate ?? DateTime.MinValue) ||
|
if ((originalPremiereDate ?? DateTime.MinValue) != (item.PremiereDate ?? DateTime.MinValue)
|
||||||
(originalProductionYear ?? -1) != (item.ProductionYear ?? -1))
|
|| (originalProductionYear ?? -1) != (item.ProductionYear ?? -1))
|
||||||
{
|
{
|
||||||
updateType |= ItemUpdateType.MetadataEdit;
|
updateType |= ItemUpdateType.MetadataEdit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
<Compile Include="../../SharedVersion.cs" />
|
<Compile Include="../../SharedVersion.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Diacritics" Version="3.3.14" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Code Analyzers-->
|
<!-- Code Analyzers-->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.3">
|
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.3">
|
||||||
|
|
|
@ -20,23 +20,8 @@ namespace Jellyfin.Extensions
|
||||||
/// <param name="text">The string to act on.</param>
|
/// <param name="text">The string to act on.</param>
|
||||||
/// <returns>The string without diacritics character.</returns>
|
/// <returns>The string without diacritics character.</returns>
|
||||||
public static string RemoveDiacritics(this string text)
|
public static string RemoveDiacritics(this string text)
|
||||||
{
|
=> Diacritics.Extensions.StringExtensions.RemoveDiacritics(
|
||||||
string withDiactritics = _nonConformingUnicode
|
_nonConformingUnicode.Replace(text, string.Empty));
|
||||||
.Replace(text, string.Empty)
|
|
||||||
.Normalize(NormalizationForm.FormD);
|
|
||||||
|
|
||||||
var withoutDiactritics = new StringBuilder();
|
|
||||||
foreach (char c in withDiactritics)
|
|
||||||
{
|
|
||||||
UnicodeCategory uc = CharUnicodeInfo.GetUnicodeCategory(c);
|
|
||||||
if (uc != UnicodeCategory.NonSpacingMark)
|
|
||||||
{
|
|
||||||
withoutDiactritics.Append(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return withoutDiactritics.ToString().Normalize(NormalizationForm.FormC);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks whether or not the specified string has diacritics in it.
|
/// Checks whether or not the specified string has diacritics in it.
|
||||||
|
@ -44,9 +29,8 @@ namespace Jellyfin.Extensions
|
||||||
/// <param name="text">The string to check.</param>
|
/// <param name="text">The string to check.</param>
|
||||||
/// <returns>True if the string has diacritics, false otherwise.</returns>
|
/// <returns>True if the string has diacritics, false otherwise.</returns>
|
||||||
public static bool HasDiacritics(this string text)
|
public static bool HasDiacritics(this string text)
|
||||||
{
|
=> Diacritics.Extensions.StringExtensions.HasDiacritics(text)
|
||||||
return !string.Equals(text, text.RemoveDiacritics(), StringComparison.Ordinal);
|
|| _nonConformingUnicode.IsMatch(text);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Counts the number of occurrences of [needle] in the string.
|
/// Counts the number of occurrences of [needle] in the string.
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace Jellyfin.Extensions.Tests
|
||||||
{
|
{
|
||||||
var copy = strings.Reverse().ToArray();
|
var copy = strings.Reverse().ToArray();
|
||||||
Array.Sort(copy, new AlphanumericComparator());
|
Array.Sort(copy, new AlphanumericComparator());
|
||||||
Assert.True(strings.SequenceEqual(copy));
|
Assert.Equal(strings, copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,15 @@ namespace Jellyfin.Extensions.Tests
|
||||||
[InlineData("", "")] // Identity edge-case (no diactritics)
|
[InlineData("", "")] // Identity edge-case (no diactritics)
|
||||||
[InlineData("Indiana Jones", "Indiana Jones")] // Identity (no diactritics)
|
[InlineData("Indiana Jones", "Indiana Jones")] // Identity (no diactritics)
|
||||||
[InlineData("a\ud800b", "ab")] // Invalid UTF-16 char stripping
|
[InlineData("a\ud800b", "ab")] // Invalid UTF-16 char stripping
|
||||||
|
[InlineData("åäö", "aao")] // Issue #7484
|
||||||
[InlineData("Jön", "Jon")] // Issue #7484
|
[InlineData("Jön", "Jon")] // Issue #7484
|
||||||
[InlineData("Jönssonligan", "Jonssonligan")] // Issue #7484
|
[InlineData("Jönssonligan", "Jonssonligan")] // Issue #7484
|
||||||
[InlineData("Kieślowski", "Kieslowski")] // Issue #7450
|
[InlineData("Kieślowski", "Kieslowski")] // Issue #7450
|
||||||
[InlineData("Cidadão Kane", "Cidadao Kane")] // Issue #7560
|
[InlineData("Cidadão Kane", "Cidadao Kane")] // Issue #7560
|
||||||
[InlineData("운명처럼 널 사랑해", "운명처럼 널 사랑해")] // Issue #6393 (Korean language support)
|
[InlineData("운명처럼 널 사랑해", "운명처럼 널 사랑해")] // Issue #6393 (Korean language support)
|
||||||
[InlineData("애타는 로맨스", "애타는 로맨스")] // Issue #6393
|
[InlineData("애타는 로맨스", "애타는 로맨스")] // Issue #6393
|
||||||
|
[InlineData("Le cœur a ses raisons", "Le coeur a ses raisons")] // Issue #8893
|
||||||
|
[InlineData("Béla Tarr", "Bela Tarr")] // Issue #8893
|
||||||
public void RemoveDiacritics_ValidInput_Corrects(string input, string expectedResult)
|
public void RemoveDiacritics_ValidInput_Corrects(string input, string expectedResult)
|
||||||
{
|
{
|
||||||
string result = input.RemoveDiacritics();
|
string result = input.RemoveDiacritics();
|
||||||
|
@ -25,12 +28,15 @@ namespace Jellyfin.Extensions.Tests
|
||||||
[InlineData("", false)] // Identity edge-case (no diactritics)
|
[InlineData("", false)] // Identity edge-case (no diactritics)
|
||||||
[InlineData("Indiana Jones", false)] // Identity (no diactritics)
|
[InlineData("Indiana Jones", false)] // Identity (no diactritics)
|
||||||
[InlineData("a\ud800b", true)] // Invalid UTF-16 char stripping
|
[InlineData("a\ud800b", true)] // Invalid UTF-16 char stripping
|
||||||
|
[InlineData("åäö", true)] // Issue #7484
|
||||||
[InlineData("Jön", true)] // Issue #7484
|
[InlineData("Jön", true)] // Issue #7484
|
||||||
[InlineData("Jönssonligan", true)] // Issue #7484
|
[InlineData("Jönssonligan", true)] // Issue #7484
|
||||||
[InlineData("Kieślowski", true)] // Issue #7450
|
[InlineData("Kieślowski", true)] // Issue #7450
|
||||||
[InlineData("Cidadão Kane", true)] // Issue #7560
|
[InlineData("Cidadão Kane", true)] // Issue #7560
|
||||||
[InlineData("운명처럼 널 사랑해", false)] // Issue #6393 (Korean language support)
|
[InlineData("운명처럼 널 사랑해", false)] // Issue #6393 (Korean language support)
|
||||||
[InlineData("애타는 로맨스", false)] // Issue #6393
|
[InlineData("애타는 로맨스", false)] // Issue #6393
|
||||||
|
[InlineData("Le cœur a ses raisons", true)] // Issue #8893
|
||||||
|
[InlineData("Béla Tarr", true)] // Issue #8893
|
||||||
public void HasDiacritics_ValidInput_Corrects(string input, bool expectedResult)
|
public void HasDiacritics_ValidInput_Corrects(string input, bool expectedResult)
|
||||||
{
|
{
|
||||||
bool result = input.HasDiacritics();
|
bool result = input.HasDiacritics();
|
||||||
|
|
Loading…
Reference in New Issue