mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Fix migration with special Rating (#11541)
This commit is contained in:
parent
7d271547c6
commit
efba619acb
@ -321,7 +321,11 @@ namespace Emby.Server.Implementations.Localization
|
|||||||
// Try splitting by : to handle "Germany: FSK-18"
|
// Try splitting by : to handle "Germany: FSK-18"
|
||||||
if (rating.Contains(':', StringComparison.OrdinalIgnoreCase))
|
if (rating.Contains(':', StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return GetRatingLevel(rating.AsSpan().RightPart(':').ToString());
|
var ratingLevelRightPart = rating.AsSpan().RightPart(':');
|
||||||
|
if (ratingLevelRightPart.Length != 0)
|
||||||
|
{
|
||||||
|
return GetRatingLevel(ratingLevelRightPart.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle prefix country code to handle "DE-18"
|
// Handle prefix country code to handle "DE-18"
|
||||||
@ -332,8 +336,12 @@ namespace Emby.Server.Implementations.Localization
|
|||||||
// Extract culture from country prefix
|
// Extract culture from country prefix
|
||||||
var culture = FindLanguageInfo(ratingSpan.LeftPart('-').ToString());
|
var culture = FindLanguageInfo(ratingSpan.LeftPart('-').ToString());
|
||||||
|
|
||||||
// Check rating system of culture
|
var ratingLevelRightPart = ratingSpan.RightPart('-');
|
||||||
return GetRatingLevel(ratingSpan.RightPart('-').ToString(), culture?.TwoLetterISOLanguageName);
|
if (ratingLevelRightPart.Length != 0)
|
||||||
|
{
|
||||||
|
// Check rating system of culture
|
||||||
|
return GetRatingLevel(ratingLevelRightPart.ToString(), culture?.TwoLetterISOLanguageName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Emby.Server.Implementations.Localization;
|
using Emby.Server.Implementations.Localization;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
@ -157,6 +158,20 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
|
|||||||
Assert.Null(localizationManager.GetRatingLevel("n/a"));
|
Assert.Null(localizationManager.GetRatingLevel("n/a"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("-NO RATING SHOWN-")]
|
||||||
|
[InlineData(":NO RATING SHOWN:")]
|
||||||
|
public async Task GetRatingLevel_Split_Success(string value)
|
||||||
|
{
|
||||||
|
var localizationManager = Setup(new ServerConfiguration()
|
||||||
|
{
|
||||||
|
UICulture = "en-US"
|
||||||
|
});
|
||||||
|
await localizationManager.LoadAll();
|
||||||
|
|
||||||
|
Assert.Null(localizationManager.GetRatingLevel(value));
|
||||||
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("Default", "Default")]
|
[InlineData("Default", "Default")]
|
||||||
[InlineData("HeaderLiveTV", "Live TV")]
|
[InlineData("HeaderLiveTV", "Live TV")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user