mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-01 07:51:54 +01:00
update encoding detection
This commit is contained in:
@@ -1990,24 +1990,6 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
index++;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(item.Tagline))
|
||||
{
|
||||
var movie = item as Movie;
|
||||
if (movie != null && movie.Taglines.Count > 0)
|
||||
{
|
||||
movie.Tagline = movie.Taglines[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (type == typeof(Person) && item.ProductionLocations.Count == 0)
|
||||
{
|
||||
var person = (Person)item;
|
||||
if (!string.IsNullOrWhiteSpace(person.PlaceOfBirth))
|
||||
{
|
||||
item.ProductionLocations = new List<string> { person.PlaceOfBirth };
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
@@ -311,10 +311,6 @@
|
||||
<HintPath>..\packages\SQLitePCLRaw.core.1.1.2\lib\portable-net45+netcore45+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLitePCLRaw.core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="UniversalDetector, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\UniversalDetector.1.0.1\lib\portable-net45+sl4+wp71+win8+wpa81\UniversalDetector.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Localization\Core\ar.json" />
|
||||
|
||||
@@ -13,7 +13,6 @@ using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Services;
|
||||
using MediaBrowser.Model.Text;
|
||||
using UniversalDetector;
|
||||
|
||||
namespace Emby.Server.Implementations.ServerManager
|
||||
{
|
||||
@@ -137,7 +136,8 @@ namespace Emby.Server.Implementations.ServerManager
|
||||
{
|
||||
return;
|
||||
}
|
||||
var charset = DetectCharset(bytes);
|
||||
|
||||
var charset = _textEncoding.GetDetectedEncodingName(bytes, null);
|
||||
|
||||
if (string.Equals(charset, "utf-8", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -148,33 +148,6 @@ namespace Emby.Server.Implementations.ServerManager
|
||||
OnReceiveInternal(_textEncoding.GetASCIIEncoding().GetString(bytes, 0, bytes.Length));
|
||||
}
|
||||
}
|
||||
private string DetectCharset(byte[] bytes)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var ms = _memoryStreamProvider.CreateNew(bytes))
|
||||
{
|
||||
var detector = new CharsetDetector();
|
||||
detector.Feed(ms);
|
||||
detector.DataEnd();
|
||||
|
||||
var charset = detector.Charset;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(charset))
|
||||
{
|
||||
//_logger.Debug("UniversalDetector detected charset {0}", charset);
|
||||
}
|
||||
|
||||
return charset;
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
_logger.ErrorException("Error attempting to determine web socket message charset", ex);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void OnReceiveInternal(string message)
|
||||
{
|
||||
|
||||
@@ -4,5 +4,4 @@
|
||||
<package id="MediaBrowser.Naming" version="1.0.5" targetFramework="portable45-net45+win8" />
|
||||
<package id="SQLitePCL.pretty" version="1.1.0" targetFramework="portable45-net45+win8" />
|
||||
<package id="SQLitePCLRaw.core" version="1.1.2" targetFramework="portable45-net45+win8" />
|
||||
<package id="UniversalDetector" version="1.0.1" targetFramework="portable45-net45+win8" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user