mirror of
https://github.com/Radarr/Radarr.git
synced 2024-10-03 22:57:18 +02:00
Use Diacritical.Net library for TitleFirstCharacter token
(cherry picked from commit 59ea524e0ce85333779f430b867e93aae366289f) Closes #9324
This commit is contained in:
parent
3e8cbc497e
commit
7bbdcc81bb
@ -42,6 +42,7 @@ public void Setup()
|
||||
[TestCase("¡Mucha Lucha!", "M", "¡Mucha Lucha!")]
|
||||
[TestCase(".hack", "H", "hack")]
|
||||
[TestCase("Ütopya", "U", "Ütopya")]
|
||||
[TestCase("Æon Flux", "A", "Æon Flux")]
|
||||
public void should_get_expected_folder_name_back(string title, string parent, string child)
|
||||
{
|
||||
_movie.Title = title;
|
||||
|
@ -5,6 +5,8 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Diacritical;
|
||||
using DryIoc.ImTools;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.Extensions;
|
||||
@ -224,13 +226,13 @@ public static string TitleFirstCharacter(string title)
|
||||
{
|
||||
if (char.IsLetterOrDigit(title[0]))
|
||||
{
|
||||
return title.Substring(0, 1).ToUpper().RemoveAccent();
|
||||
return title.Substring(0, 1).ToUpper().RemoveDiacritics()[0].ToString();
|
||||
}
|
||||
|
||||
// Try the second character if the first was non alphanumeric
|
||||
if (char.IsLetterOrDigit(title[1]))
|
||||
{
|
||||
return title.Substring(1, 1).ToUpper().RemoveAccent();
|
||||
return title.Substring(1, 1).ToUpper().RemoveDiacritics()[0].ToString();
|
||||
}
|
||||
|
||||
// Default to "_" if no alphanumeric character can be found in the first 2 positions
|
||||
|
@ -4,6 +4,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.0.143" />
|
||||
<PackageReference Include="Diacritical.Net" Version="1.0.4" />
|
||||
<PackageReference Include="Equ" Version="2.3.0" />
|
||||
<PackageReference Include="MailKit" Version="3.6.0" />
|
||||
<PackageReference Include="Npgsql" Version="7.0.4" />
|
||||
|
Loading…
Reference in New Issue
Block a user