mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 05:57:20 -04:00
3.2.20.5
This commit is contained in:
parent
0e7cbb0465
commit
ce47f63389
6 changed files with 18 additions and 18 deletions
|
@ -68,7 +68,7 @@ namespace Emby.Common.Implementations.TextEncoding
|
|||
}
|
||||
|
||||
private bool _langDetectInitialized;
|
||||
public string GetDetectedEncodingName(byte[] bytes, string language)
|
||||
public string GetDetectedEncodingName(byte[] bytes, string language, bool enableLanguageDetection)
|
||||
{
|
||||
var encoding = GetInitialEncoding(bytes);
|
||||
|
||||
|
@ -77,14 +77,14 @@ namespace Emby.Common.Implementations.TextEncoding
|
|||
return "utf-8";
|
||||
}
|
||||
|
||||
if (!_langDetectInitialized)
|
||||
if (string.IsNullOrWhiteSpace(language) && enableLanguageDetection)
|
||||
{
|
||||
_langDetectInitialized = true;
|
||||
LanguageDetector.Initialize(_json);
|
||||
}
|
||||
if (!_langDetectInitialized)
|
||||
{
|
||||
_langDetectInitialized = true;
|
||||
LanguageDetector.Initialize(_json);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(language))
|
||||
{
|
||||
language = DetectLanguage(bytes);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(language))
|
||||
|
@ -167,9 +167,9 @@ namespace Emby.Common.Implementations.TextEncoding
|
|||
}
|
||||
}
|
||||
|
||||
public Encoding GetDetectedEncoding(byte[] bytes, string language)
|
||||
public Encoding GetDetectedEncoding(byte[] bytes, string language, bool enableLanguageDetection)
|
||||
{
|
||||
var charset = GetDetectedEncodingName(bytes, language);
|
||||
var charset = GetDetectedEncodingName(bytes, language, enableLanguageDetection);
|
||||
|
||||
return GetEncodingFromCharset(charset);
|
||||
}
|
||||
|
|
|
@ -778,16 +778,16 @@ namespace Emby.Server.Implementations.Dto
|
|||
.Select(i => new NameIdPair
|
||||
{
|
||||
Name = i,
|
||||
Id = GetStudioId(i, item)
|
||||
Id = GetGenreId(i, item)
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private string GetStudioId(string name, BaseItem owner)
|
||||
private string GetGenreId(string name, BaseItem owner)
|
||||
{
|
||||
if (owner is IHasMusicGenres)
|
||||
{
|
||||
return _libraryManager.GetGameGenreId(name).ToString("N");
|
||||
return _libraryManager.GetMusicGenreId(name).ToString("N");
|
||||
}
|
||||
|
||||
if (owner is Game || owner is GameSystem)
|
||||
|
|
|
@ -136,7 +136,7 @@ namespace Emby.Server.Implementations.ServerManager
|
|||
return;
|
||||
}
|
||||
|
||||
var charset = _textEncoding.GetDetectedEncodingName(bytes, null);
|
||||
var charset = _textEncoding.GetDetectedEncodingName(bytes, null, false);
|
||||
|
||||
if (string.Equals(charset, "utf-8", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
|
|
@ -198,7 +198,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
{
|
||||
var bytes = await GetBytes(path, protocol, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var charset = _textEncoding.GetDetectedEncodingName(bytes, language);
|
||||
var charset = _textEncoding.GetDetectedEncodingName(bytes, language, true);
|
||||
_logger.Debug("charset {0} detected for {1}", charset ?? "null", path);
|
||||
|
||||
if (!string.IsNullOrEmpty(charset))
|
||||
|
@ -705,7 +705,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
{
|
||||
var bytes = await GetBytes(path, protocol, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var charset = _textEncoding.GetDetectedEncodingName(bytes, language);
|
||||
var charset = _textEncoding.GetDetectedEncodingName(bytes, language, true);
|
||||
|
||||
_logger.Debug("charset {0} detected for {1}", charset ?? "null", path);
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace MediaBrowser.Model.Text
|
|||
{
|
||||
Encoding GetASCIIEncoding();
|
||||
|
||||
string GetDetectedEncodingName(byte[] bytes, string language);
|
||||
Encoding GetDetectedEncoding(byte[] bytes, string language);
|
||||
string GetDetectedEncodingName(byte[] bytes, string language, bool enableLanguageDetection);
|
||||
Encoding GetDetectedEncoding(byte[] bytes, string language, bool enableLanguageDetection);
|
||||
Encoding GetEncodingFromCharset(string charset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("3.2.20.4")]
|
||||
[assembly: AssemblyVersion("3.2.20.5")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue