Selaa lähdekoodia

Merge branch 'dev' into imagesize

Andrew Rabert 6 vuotta sitten
vanhempi
sitoutus
c7f648f86a
100 muutettua tiedostoa jossa 330 lisäystä ja 1611 poistoa
  1. 3 5
      BDInfo/BDROM.cs
  2. 7 13
      BDInfo/TSPlaylistFile.cs
  3. 7 13
      BDInfo/TSStreamClipFile.cs
  4. 1 0
      CONTRIBUTORS.md
  5. 4 3
      Emby.Dlna/DlnaManager.cs
  6. 6 2
      Emby.Dlna/Ssdp/DeviceDiscovery.cs
  7. 2 2
      Emby.Drawing/ImageProcessor.cs
  8. 6 2
      Emby.Drawing/SkiaEncoder.cs
  9. 3 3
      Emby.Naming/TV/EpisodeResolver.cs
  10. 4 12
      Emby.Naming/Video/StubResolver.cs
  11. 1 13
      Emby.Naming/Video/StubResult.cs
  12. 7 8
      Emby.Naming/Video/VideoResolver.cs
  13. 5 2
      Emby.Server.Implementations/Activity/ActivityManager.cs
  14. 2 2
      Emby.Server.Implementations/Activity/ActivityRepository.cs
  15. 38 46
      Emby.Server.Implementations/ApplicationHost.cs
  16. 13 2
      Emby.Server.Implementations/Channels/ChannelManager.cs
  17. 9 2
      Emby.Server.Implementations/Collections/CollectionManager.cs
  18. 2 2
      Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs
  19. 10 2
      Emby.Server.Implementations/Data/SqliteItemRepository.cs
  20. 4 5
      Emby.Server.Implementations/Data/SqliteUserDataRepository.cs
  21. 5 2
      Emby.Server.Implementations/Data/SqliteUserRepository.cs
  22. 5 2
      Emby.Server.Implementations/Devices/DeviceId.cs
  23. 12 2
      Emby.Server.Implementations/Devices/DeviceManager.cs
  24. 15 2
      Emby.Server.Implementations/Dto/DtoService.cs
  25. 1 2
      Emby.Server.Implementations/Emby.Server.Implementations.csproj
  26. 22 32
      Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
  27. 3 10
      Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
  28. 7 10
      Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
  29. 10 24
      Emby.Server.Implementations/IO/ManagedFileSystem.cs
  30. 13 3
      Emby.Server.Implementations/Library/LibraryManager.cs
  31. 13 2
      Emby.Server.Implementations/Library/MediaSourceManager.cs
  32. 5 4
      Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
  33. 13 2
      Emby.Server.Implementations/Library/UserManager.cs
  34. 7 2
      Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
  35. 3 9
      Emby.Server.Implementations/LiveTv/LiveTvManager.cs
  36. 8 2
      Emby.Server.Implementations/Localization/LocalizationManager.cs
  37. 4 3
      Emby.Server.Implementations/MediaEncoder/EncodingManager.cs
  38. 0 12
      Emby.Server.Implementations/Net/SocketFactory.cs
  39. 4 2
      Emby.Server.Implementations/Networking/NetworkManager.cs
  40. 8 2
      Emby.Server.Implementations/Playlists/PlaylistManager.cs
  41. 5 2
      Emby.Server.Implementations/ResourceFileManager.cs
  42. 9 4
      Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
  43. 2 2
      Emby.Server.Implementations/Security/AuthenticationRepository.cs
  44. 2 4
      Emby.Server.Implementations/Serialization/JsonSerializer.cs
  45. 4 2
      Emby.Server.Implementations/Serialization/XmlSerializer.cs
  46. 16 2
      Emby.Server.Implementations/Session/SessionManager.cs
  47. 0 8
      Emby.Server.Implementations/SystemEvents.cs
  48. 0 371
      Emby.Server.Implementations/TextEncoding/NLangDetect/Detector.cs
  49. 0 125
      Emby.Server.Implementations/TextEncoding/NLangDetect/DetectorFactory.cs
  50. 0 15
      Emby.Server.Implementations/TextEncoding/NLangDetect/ErrorCode.cs
  51. 0 374
      Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/CharExtensions.cs
  52. 0 51
      Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/RandomExtensions.cs
  53. 0 25
      Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/StringExtensions.cs
  54. 0 131
      Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/UnicodeBlock.cs
  55. 0 67
      Emby.Server.Implementations/TextEncoding/NLangDetect/GenProfile.cs
  56. 0 22
      Emby.Server.Implementations/TextEncoding/NLangDetect/InternalException.cs
  57. 0 45
      Emby.Server.Implementations/TextEncoding/NLangDetect/Language.cs
  58. 0 37
      Emby.Server.Implementations/TextEncoding/NLangDetect/LanguageDetector.cs
  59. 0 23
      Emby.Server.Implementations/TextEncoding/NLangDetect/NLangDetectException.cs
  60. 0 33
      Emby.Server.Implementations/TextEncoding/NLangDetect/ProbVector.cs
  61. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/afr
  62. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ara
  63. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ben
  64. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/bul
  65. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ces
  66. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/dan
  67. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/deu
  68. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ell
  69. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/eng
  70. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/est
  71. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/fas
  72. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/fin
  73. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/fra
  74. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/guj
  75. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/heb
  76. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/hin
  77. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/hrv
  78. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/hun
  79. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ind
  80. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ita
  81. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/jpn
  82. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/kan
  83. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/kor
  84. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/lav
  85. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/lit
  86. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/mal
  87. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/mar
  88. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/mkd
  89. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/nep
  90. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/nld
  91. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/nor
  92. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/pan
  93. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/pol
  94. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/por
  95. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ron
  96. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/rus
  97. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/slk
  98. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/slv
  99. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/som
  100. 0 0
      Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/spa

+ 3 - 5
BDInfo/BDROM.cs

@@ -22,7 +22,6 @@ using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Text;
 
 namespace BDInfo
 {
@@ -72,8 +71,7 @@ namespace BDInfo
 
         public event OnPlaylistFileScanError PlaylistFileScanError;
 
-        public BDROM(
-            string path, IFileSystem fileSystem, ITextEncoding textEncoding)
+        public BDROM(string path, IFileSystem fileSystem)
         {
             if (string.IsNullOrEmpty(path))
             {
@@ -167,7 +165,7 @@ namespace BDInfo
                 foreach (var file in files)
                 {
                     PlaylistFiles.Add(
-                        file.Name.ToUpper(), new TSPlaylistFile(this, file, _fileSystem, textEncoding));
+                        file.Name.ToUpper(), new TSPlaylistFile(this, file, _fileSystem));
                 }
             }
 
@@ -187,7 +185,7 @@ namespace BDInfo
                 foreach (var file in files)
                 {
                     StreamClipFiles.Add(
-                        file.Name.ToUpper(), new TSStreamClipFile(file, _fileSystem, textEncoding));
+                        file.Name.ToUpper(), new TSStreamClipFile(file, _fileSystem));
                 }
             }
 

+ 7 - 13
BDInfo/TSPlaylistFile.cs

@@ -1,4 +1,4 @@
-//============================================================================
+//============================================================================
 // BDInfo - Blu-ray Video and Audio Analysis Tool
 // Copyright © 2010 Cinema Squid
 //
@@ -21,15 +21,14 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.Text;
 using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Text;
 
 namespace BDInfo
 {
     public class TSPlaylistFile
     {
         private readonly IFileSystem _fileSystem;
-        private readonly ITextEncoding _textEncoding;
         private FileSystemMetadata FileInfo = null;
         public string FileType = null;
         public bool IsInitialized = false;
@@ -64,26 +63,22 @@ namespace BDInfo
         public List<TSGraphicsStream> GraphicsStreams =
             new List<TSGraphicsStream>();
 
-        public TSPlaylistFile(
-            BDROM bdrom,
-            FileSystemMetadata fileInfo, IFileSystem fileSystem, ITextEncoding textEncoding)
+        public TSPlaylistFile(BDROM bdrom,
+            FileSystemMetadata fileInfo, IFileSystem fileSystem)
         {
             BDROM = bdrom;
             FileInfo = fileInfo;
             _fileSystem = fileSystem;
-            _textEncoding = textEncoding;
             Name = fileInfo.Name.ToUpper();
         }
 
-        public TSPlaylistFile(
-            BDROM bdrom,
+        public TSPlaylistFile(BDROM bdrom,
             string name,
-            List<TSStreamClip> clips, IFileSystem fileSystem, ITextEncoding textEncoding)
+            List<TSStreamClip> clips, IFileSystem fileSystem)
         {
             BDROM = bdrom;
             Name = name;
             _fileSystem = fileSystem;
-            _textEncoding = textEncoding;
             IsCustom = true;
             foreach (var clip in clips)
             {
@@ -1245,8 +1240,7 @@ namespace BDInfo
             int count,
             ref int pos)
         {
-            string val =
-                _textEncoding.GetASCIIEncoding().GetString(data, pos, count);
+            string val = Encoding.ASCII.GetString(data, pos, count);
 
             pos += count;
 

+ 7 - 13
BDInfo/TSStreamClipFile.cs

@@ -1,4 +1,4 @@
-//============================================================================
+//============================================================================
 // BDInfo - Blu-ray Video and Audio Analysis Tool
 // Copyright © 2010 Cinema Squid
 //
@@ -21,15 +21,14 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.Text;
 using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Text;
 
 namespace BDInfo
 {
     public class TSStreamClipFile
     {
         private readonly IFileSystem _fileSystem;
-        private readonly ITextEncoding _textEncoding;
         public FileSystemMetadata FileInfo = null;
         public string FileType = null;
         public bool IsValid = false;
@@ -38,12 +37,10 @@ namespace BDInfo
         public Dictionary<ushort, TSStream> Streams =
             new Dictionary<ushort, TSStream>();
 
-        public TSStreamClipFile(
-            FileSystemMetadata fileInfo, IFileSystem fileSystem, ITextEncoding textEncoding)
+        public TSStreamClipFile(FileSystemMetadata fileInfo, IFileSystem fileSystem)
         {
             FileInfo = fileInfo;
             _fileSystem = fileSystem;
-            _textEncoding = textEncoding;
             Name = fileInfo.Name.ToUpper();
         }
 
@@ -69,7 +66,7 @@ namespace BDInfo
                 byte[] fileType = new byte[8];
                 Array.Copy(data, 0, fileType, 0, fileType.Length);
 
-                FileType = _textEncoding.GetASCIIEncoding().GetString(fileType, 0, fileType.Length);
+                FileType = Encoding.ASCII.GetString(fileType, 0, fileType.Length);
                 if (FileType != "HDMV0100" &&
                     FileType != "HDMV0200")
                 {
@@ -165,8 +162,7 @@ namespace BDInfo
                                 byte[] languageBytes = new byte[3];
                                 Array.Copy(clipData, streamOffset + 3,
                                     languageBytes, 0, languageBytes.Length);
-                                string languageCode =
-                                    _textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
+                                string languageCode = Encoding.ASCII.GetString(languageBytes, 0, languageBytes.Length);
 
                                 var channelLayout = (TSChannelLayout)
                                     (clipData[streamOffset + 2] >> 4);
@@ -196,8 +192,7 @@ namespace BDInfo
                                 byte[] languageBytes = new byte[3];
                                 Array.Copy(clipData, streamOffset + 2,
                                     languageBytes, 0, languageBytes.Length);
-                                string languageCode =
-                                    _textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
+                                string languageCode = Encoding.ASCII.GetString(languageBytes, 0, languageBytes.Length);
 
                                 stream = new TSGraphicsStream();
                                 stream.LanguageCode = languageCode;
@@ -216,8 +211,7 @@ namespace BDInfo
                                 byte[] languageBytes = new byte[3];
                                 Array.Copy(clipData, streamOffset + 3,
                                     languageBytes, 0, languageBytes.Length);
-                                string languageCode =
-                                    _textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
+                                string languageCode = Encoding.ASCII.GetString(languageBytes, 0, languageBytes.Length);
 #if DEBUG
                             Debug.WriteLine(string.Format(
                                 "\t{0} {1} {2}",

+ 1 - 0
CONTRIBUTORS.md

@@ -13,6 +13,7 @@
  - [LeoVerto](https://github.com/LeoVerto)
  - [grafixeyehero](https://github.com/grafixeyehero)
  - [cvium](https://github.com/cvium)
+ - [wtayl0r](https://github.com/wtayl0r)
  
 # Emby Contributors
 

+ 4 - 3
Emby.Dlna/DlnaManager.cs

@@ -32,16 +32,17 @@ namespace Emby.Dlna
 
         private readonly Dictionary<string, Tuple<InternalProfileInfo, DeviceProfile>> _profiles = new Dictionary<string, Tuple<InternalProfileInfo, DeviceProfile>>(StringComparer.Ordinal);
 
-        public DlnaManager(IXmlSerializer xmlSerializer,
+        public DlnaManager(
+            IXmlSerializer xmlSerializer,
             IFileSystem fileSystem,
             IApplicationPaths appPaths,
-            ILogger logger,
+            ILoggerFactory loggerFactory,
             IJsonSerializer jsonSerializer, IServerApplicationHost appHost, IAssemblyInfo assemblyInfo)
         {
             _xmlSerializer = xmlSerializer;
             _fileSystem = fileSystem;
             _appPaths = appPaths;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger("Dlna");
             _jsonSerializer = jsonSerializer;
             _appHost = appHost;
             _assemblyInfo = assemblyInfo;

+ 6 - 2
Emby.Dlna/Ssdp/DeviceDiscovery.cs

@@ -52,9 +52,13 @@ namespace Emby.Dlna.Ssdp
         private readonly ISocketFactory _socketFactory;
         private ISsdpCommunicationsServer _commsServer;
 
-        public DeviceDiscovery(ILogger logger, IServerConfigurationManager config, ISocketFactory socketFactory, ITimerFactory timerFactory)
+        public DeviceDiscovery(
+            ILoggerFactory loggerFactory,
+            IServerConfigurationManager config,
+            ISocketFactory socketFactory,
+            ITimerFactory timerFactory)
         {
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(DeviceDiscovery));
             _config = config;
             _socketFactory = socketFactory;
             _timerFactory = timerFactory;

+ 2 - 2
Emby.Drawing/ImageProcessor.cs

@@ -51,15 +51,15 @@ namespace Emby.Drawing
         private readonly Func<IMediaEncoder> _mediaEncoder;
 
         public ImageProcessor(
-            ILogger logger,
+            ILoggerFactory loggerFactory,
             IServerApplicationPaths appPaths,
             IFileSystem fileSystem,
             IImageEncoder imageEncoder,
             Func<ILibraryManager> libraryManager,
             Func<IMediaEncoder> mediaEncoder)
         {
-            _logger = logger;
             _appPaths = appPaths;
+            _logger = loggerFactory.CreateLogger(nameof(ImageProcessor));
             _fileSystem = fileSystem;
             _imageEncoder = imageEncoder;
             _libraryManager = libraryManager;

+ 6 - 2
Emby.Drawing/SkiaEncoder.cs

@@ -21,9 +21,13 @@ namespace Emby.Drawing
         private readonly IFileSystem _fileSystem;
         private static ILocalizationManager _localizationManager;
 
-        public SkiaEncoder(ILogger logger, IApplicationPaths appPaths, IFileSystem fileSystem, ILocalizationManager localizationManager)
+        public SkiaEncoder(
+            ILoggerFactory loggerFactory,
+            IApplicationPaths appPaths,
+            IFileSystem fileSystem,
+            ILocalizationManager localizationManager)
         {
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger("ImageEncoder");
             _appPaths = appPaths;
             _fileSystem = fileSystem;
             _localizationManager = localizationManager;

+ 3 - 3
Emby.Naming/TV/EpisodeResolver.cs

@@ -22,17 +22,17 @@ namespace Emby.Naming.TV
                 throw new ArgumentNullException(nameof(path));
             }
 
-            var isStub = false;
+            bool isStub = false;
             string container = null;
             string stubType = null;
 
             if (!IsDirectory)
             {
-                var extension = Path.GetExtension(path) ?? string.Empty;
+                var extension = Path.GetExtension(path);
                 // Check supported extensions
                 if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
                 {
-                    var stubResult = new StubResolver(_options).ResolveFile(path);
+                    var stubResult = StubResolver.ResolveFile(path, _options);
 
                     isStub = stubResult.IsStub;
 

+ 4 - 12
Emby.Naming/Video/StubResolver.cs

@@ -5,21 +5,14 @@ using Emby.Naming.Common;
 
 namespace Emby.Naming.Video
 {
-    public class StubResolver
+    public static class StubResolver
     {
-        private readonly NamingOptions _options;
-
-        public StubResolver(NamingOptions options)
-        {
-            _options = options;
-        }
-
-        public StubResult ResolveFile(string path)
+        public static StubResult ResolveFile(string path, NamingOptions options)
         {
             var result = new StubResult();
             var extension = Path.GetExtension(path) ?? string.Empty;
 
-            if (_options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
+            if (options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
             {
                 result.IsStub = true;
 
@@ -27,12 +20,11 @@ namespace Emby.Naming.Video
 
                 var token = (Path.GetExtension(path) ?? string.Empty).TrimStart('.');
 
-                foreach (var rule in _options.StubTypes)
+                foreach (var rule in options.StubTypes)
                 {
                     if (string.Equals(rule.Token, token, StringComparison.OrdinalIgnoreCase))
                     {
                         result.StubType = rule.StubType;
-                        result.Tokens.Add(token);
                         break;
                     }
                 }

+ 1 - 13
Emby.Naming/Video/StubResult.cs

@@ -1,8 +1,6 @@
-using System.Collections.Generic;
-
 namespace Emby.Naming.Video
 {
-    public class StubResult
+    public struct StubResult
     {
         /// <summary>
         /// Gets or sets a value indicating whether this instance is stub.
@@ -14,15 +12,5 @@ namespace Emby.Naming.Video
         /// </summary>
         /// <value>The type of the stub.</value>
         public string StubType { get; set; }
-        /// <summary>
-        /// Gets or sets the tokens.
-        /// </summary>
-        /// <value>The tokens.</value>
-        public List<string> Tokens { get; set; }
-
-        public StubResult()
-        {
-            Tokens = new List<string>();
-        }
     }
 }

+ 7 - 8
Emby.Naming/Video/VideoResolver.cs

@@ -48,17 +48,17 @@ namespace Emby.Naming.Video
                 throw new ArgumentNullException(nameof(path));
             }
 
-            var isStub = false;
+            bool isStub = false;
             string container = null;
             string stubType = null;
 
             if (!IsDirectory)
             {
-                var extension = Path.GetExtension(path) ?? string.Empty;
+                var extension = Path.GetExtension(path);
                 // Check supported extensions
                 if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
                 {
-                    var stubResult = new StubResolver(_options).ResolveFile(path);
+                    var stubResult = StubResolver.ResolveFile(path, _options);
 
                     isStub = stubResult.IsStub;
 
@@ -79,9 +79,9 @@ namespace Emby.Naming.Video
 
             var extraResult = new ExtraResolver(_options).GetExtraInfo(path);
 
-            var name = !IsDirectory
-                ? Path.GetFileNameWithoutExtension(path)
-                : Path.GetFileName(path);
+            var name = IsDirectory
+                ? Path.GetFileName(path)
+                : Path.GetFileNameWithoutExtension(path);
 
             int? year = null;
 
@@ -91,8 +91,7 @@ namespace Emby.Naming.Video
 
                 if (string.IsNullOrEmpty(extraResult.ExtraType))
                 {
-                    name = cleanDateTimeResult.Name;
-                    name = CleanString(name).Name;
+                    name = CleanString(cleanDateTimeResult.Name).Name;
                 }
 
                 year = cleanDateTimeResult.Year;

+ 5 - 2
Emby.Server.Implementations/Activity/ActivityManager.cs

@@ -16,9 +16,12 @@ namespace Emby.Server.Implementations.Activity
         private readonly ILogger _logger;
         private readonly IUserManager _userManager;
 
-        public ActivityManager(ILogger logger, IActivityRepository repo, IUserManager userManager)
+        public ActivityManager(
+            ILoggerFactory loggerFactory,
+            IActivityRepository repo,
+            IUserManager userManager)
         {
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(ActivityManager));
             _repo = repo;
             _userManager = userManager;
         }

+ 2 - 2
Emby.Server.Implementations/Activity/ActivityRepository.cs

@@ -18,8 +18,8 @@ namespace Emby.Server.Implementations.Activity
         private readonly CultureInfo _usCulture = new CultureInfo("en-US");
         protected IFileSystem FileSystem { get; private set; }
 
-        public ActivityRepository(ILogger logger, IServerApplicationPaths appPaths, IFileSystem fileSystem)
-            : base(logger)
+        public ActivityRepository(ILoggerFactory loggerFactory, IServerApplicationPaths appPaths, IFileSystem fileSystem)
+            : base(loggerFactory.CreateLogger(nameof(ActivityRepository)))
         {
             DbFilePath = Path.Combine(appPaths.DataPath, "activitylog.db");
             FileSystem = fileSystem;

+ 38 - 46
Emby.Server.Implementations/ApplicationHost.cs

@@ -99,7 +99,6 @@ using MediaBrowser.Model.Serialization;
 using MediaBrowser.Model.Services;
 using MediaBrowser.Model.System;
 using MediaBrowser.Model.Tasks;
-using MediaBrowser.Model.Text;
 using MediaBrowser.Model.Threading;
 using MediaBrowser.Model.Updates;
 using MediaBrowser.Model.Xml;
@@ -113,6 +112,7 @@ using ServiceStack;
 using ServiceStack.Text.Jsv;
 using StringExtensions = MediaBrowser.Controller.Extensions.StringExtensions;
 using X509Certificate = System.Security.Cryptography.X509Certificates.X509Certificate;
+using UtfUnknown;
 
 namespace Emby.Server.Implementations
 {
@@ -263,7 +263,7 @@ namespace Emby.Server.Implementations
 
         protected virtual IResourceFileManager CreateResourceFileManager()
         {
-            return new ResourceFileManager(HttpResultFactory, LoggerFactory.CreateLogger("ResourceManager"), FileSystemManager);
+            return new ResourceFileManager(HttpResultFactory, LoggerFactory, FileSystemManager);
         }
 
         /// <summary>
@@ -309,7 +309,6 @@ namespace Emby.Server.Implementations
 
         private IEncodingManager EncodingManager { get; set; }
         private IChannelManager ChannelManager { get; set; }
-        protected ITextEncoding TextEncoding { get; private set; }
 
         /// <summary>
         /// Gets or sets the user data repository.
@@ -379,7 +378,7 @@ namespace Emby.Server.Implementations
             // hack alert, until common can target .net core
             BaseExtensions.CryptographyProvider = CryptographyProvider;
 
-            XmlSerializer = new MyXmlSerializer(fileSystem, loggerFactory.CreateLogger("XmlSerializer"));
+            XmlSerializer = new MyXmlSerializer(fileSystem, loggerFactory);
 
             NetworkManager = networkManager;
             networkManager.LocalSubnetsFn = GetConfiguredLocalSubnets;
@@ -451,7 +450,7 @@ namespace Emby.Server.Implementations
             {
                 if (_deviceId == null)
                 {
-                    _deviceId = new DeviceId(ApplicationPaths, LoggerFactory.CreateLogger("SystemId"), FileSystemManager);
+                    _deviceId = new DeviceId(ApplicationPaths, LoggerFactory, FileSystemManager);
                 }
 
                 return _deviceId.Value;
@@ -710,11 +709,6 @@ namespace Emby.Server.Implementations
             }
         }
 
-        private IJsonSerializer CreateJsonSerializer()
-        {
-            return new JsonSerializer(FileSystemManager, LoggerFactory.CreateLogger("JsonSerializer"));
-        }
-
         public void Init()
         {
             HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
@@ -727,7 +721,7 @@ namespace Emby.Server.Implementations
                 HttpsPort = ServerConfiguration.DefaultHttpsPort;
             }
 
-            JsonSerializer = CreateJsonSerializer();
+            JsonSerializer = new JsonSerializer(FileSystemManager);
 
             if (Plugins != null)
             {
@@ -752,7 +746,7 @@ namespace Emby.Server.Implementations
 
         protected virtual IHttpClient CreateHttpClient()
         {
-            return new HttpClientManager.HttpClientManager(ApplicationPaths, LoggerFactory.CreateLogger("HttpClient"), FileSystemManager, () => ApplicationUserAgent);
+            return new HttpClientManager.HttpClientManager(ApplicationPaths, LoggerFactory, FileSystemManager, () => ApplicationUserAgent);
         }
 
         public static IStreamHelper StreamHelper { get; set; }
@@ -785,7 +779,7 @@ namespace Emby.Server.Implementations
             IsoManager = new IsoManager();
             RegisterSingleInstance(IsoManager);
 
-            TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LoggerFactory.CreateLogger("TaskManager"), FileSystemManager, SystemEvents);
+            TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LoggerFactory, FileSystemManager, SystemEvents);
             RegisterSingleInstance(TaskManager);
 
             RegisterSingleInstance(XmlSerializer);
@@ -802,10 +796,10 @@ namespace Emby.Server.Implementations
 
             RegisterSingleInstance(CryptographyProvider);
 
-            SocketFactory = new SocketFactory(LoggerFactory.CreateLogger("SocketFactory"));
+            SocketFactory = new SocketFactory();
             RegisterSingleInstance(SocketFactory);
 
-            InstallationManager = new InstallationManager(LoggerFactory.CreateLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, ServerConfigurationManager, FileSystemManager, CryptographyProvider, PackageRuntime);
+            InstallationManager = new InstallationManager(LoggerFactory, this, ApplicationPaths, HttpClient, JsonSerializer, ServerConfigurationManager, FileSystemManager, CryptographyProvider, PackageRuntime);
             RegisterSingleInstance(InstallationManager);
 
             ZipClient = new ZipClient(FileSystemManager);
@@ -822,13 +816,11 @@ namespace Emby.Server.Implementations
             IAssemblyInfo assemblyInfo = new AssemblyInfo();
             RegisterSingleInstance(assemblyInfo);
 
-            LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LoggerFactory.CreateLogger("LocalizationManager"), assemblyInfo, new TextLocalizer());
+            LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LoggerFactory, assemblyInfo, new TextLocalizer());
             StringExtensions.LocalizationManager = LocalizationManager;
             RegisterSingleInstance(LocalizationManager);
 
-            TextEncoding = new TextEncoding.TextEncoding(FileSystemManager, LoggerFactory.CreateLogger("TextEncoding"), JsonSerializer);
-            RegisterSingleInstance(TextEncoding);
-            BlurayExaminer = new BdInfoExaminer(FileSystemManager, TextEncoding);
+            BlurayExaminer = new BdInfoExaminer(FileSystemManager);
             RegisterSingleInstance(BlurayExaminer);
 
             RegisterSingleInstance<IXmlReaderSettingsFactory>(new XmlReaderSettingsFactory());
@@ -840,23 +832,24 @@ namespace Emby.Server.Implementations
             // This is only needed for disposal purposes. If removing this, make sure to have the manager handle disposing it
             RegisterSingleInstance(UserRepository);
 
-            var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LoggerFactory.CreateLogger("SqliteDisplayPreferencesRepository"), JsonSerializer, ApplicationPaths, FileSystemManager);
+            var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LoggerFactory, JsonSerializer, ApplicationPaths, FileSystemManager);
             DisplayPreferencesRepository = displayPreferencesRepo;
             RegisterSingleInstance(DisplayPreferencesRepository);
 
-            var itemRepo = new SqliteItemRepository(ServerConfigurationManager, this, JsonSerializer, LoggerFactory.CreateLogger("SqliteItemRepository"), assemblyInfo, FileSystemManager, EnvironmentInfo, TimerFactory);
+            var itemRepo = new SqliteItemRepository(ServerConfigurationManager, this, JsonSerializer, LoggerFactory, assemblyInfo, FileSystemManager, EnvironmentInfo, TimerFactory);
             ItemRepository = itemRepo;
             RegisterSingleInstance(ItemRepository);
 
             AuthenticationRepository = GetAuthenticationRepository();
             RegisterSingleInstance(AuthenticationRepository);
 
-            UserManager = new UserManager(LoggerFactory.CreateLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, this, JsonSerializer, FileSystemManager, CryptographyProvider);
+            UserManager = new UserManager(LoggerFactory, ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, this, JsonSerializer, FileSystemManager, CryptographyProvider);
             RegisterSingleInstance(UserManager);
 
-            LibraryManager = new LibraryManager(this, Logger, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager, () => UserViewManager);
+            LibraryManager = new LibraryManager(this, LoggerFactory, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager, () => UserViewManager);
             RegisterSingleInstance(LibraryManager);
 
+            // TODO wtaylor: investigate use of second music manager
             var musicManager = new MusicManager(LibraryManager);
             RegisterSingleInstance<IMusicManager>(new MusicManager(LibraryManager));
 
@@ -869,11 +862,10 @@ namespace Emby.Server.Implementations
             Certificate = GetCertificate(CertificateInfo);
 
             HttpServer = new HttpListenerHost(this,
-                LoggerFactory.CreateLogger("HttpServer"),
+                LoggerFactory,
                 ServerConfigurationManager,
                 "web/index.html",
                 NetworkManager,
-                TextEncoding,
                 JsonSerializer,
                 XmlSerializer,
                 GetParseFn);
@@ -890,37 +882,37 @@ namespace Emby.Server.Implementations
             var encryptionManager = new EncryptionManager();
             RegisterSingleInstance<IEncryptionManager>(encryptionManager);
 
-            DeviceManager = new DeviceManager(AuthenticationRepository, JsonSerializer, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LoggerFactory.CreateLogger("DeviceManager"), NetworkManager);
+            DeviceManager = new DeviceManager(AuthenticationRepository, JsonSerializer, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LoggerFactory, NetworkManager);
             RegisterSingleInstance(DeviceManager);
 
-            MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory.CreateLogger("MediaSourceManager"), JsonSerializer, FileSystemManager, UserDataManager, TimerFactory, () => MediaEncoder);
+            MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory, JsonSerializer, FileSystemManager, UserDataManager, TimerFactory, () => MediaEncoder);
             RegisterSingleInstance(MediaSourceManager);
 
-            SubtitleManager = new SubtitleManager(LoggerFactory.CreateLogger("SubtitleManager"), FileSystemManager, LibraryMonitor, MediaSourceManager, ServerConfigurationManager, LocalizationManager);
+            SubtitleManager = new SubtitleManager(LoggerFactory, FileSystemManager, LibraryMonitor, MediaSourceManager, ServerConfigurationManager, LocalizationManager);
             RegisterSingleInstance(SubtitleManager);
 
             ProviderManager = new ProviderManager(HttpClient, SubtitleManager, ServerConfigurationManager, LibraryMonitor, LoggerFactory, FileSystemManager, ApplicationPaths, () => LibraryManager, JsonSerializer);
             RegisterSingleInstance(ProviderManager);
 
-            DtoService = new DtoService(LoggerFactory.CreateLogger("DtoService"), LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, this, () => DeviceManager, () => MediaSourceManager, () => LiveTvManager);
+            DtoService = new DtoService(LoggerFactory, LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, this, () => DeviceManager, () => MediaSourceManager, () => LiveTvManager);
             RegisterSingleInstance(DtoService);
 
-            ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LoggerFactory.CreateLogger("ChannelManager"), ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient, ProviderManager);
+            ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LoggerFactory, ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient, ProviderManager);
             RegisterSingleInstance(ChannelManager);
 
-            SessionManager = new SessionManager(UserDataManager, LoggerFactory.CreateLogger("SessionManager"), LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager, TimerFactory);
+            SessionManager = new SessionManager(UserDataManager, LoggerFactory, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager, TimerFactory);
             RegisterSingleInstance(SessionManager);
 
-            var dlnaManager = new DlnaManager(XmlSerializer, FileSystemManager, ApplicationPaths, LoggerFactory.CreateLogger("Dlna"), JsonSerializer, this, assemblyInfo);
+            var dlnaManager = new DlnaManager(XmlSerializer, FileSystemManager, ApplicationPaths, LoggerFactory, JsonSerializer, this, assemblyInfo);
             RegisterSingleInstance<IDlnaManager>(dlnaManager);
 
-            CollectionManager = new CollectionManager(LibraryManager, ApplicationPaths, LocalizationManager, FileSystemManager, LibraryMonitor, LoggerFactory.CreateLogger("CollectionManager"), ProviderManager);
+            CollectionManager = new CollectionManager(LibraryManager, ApplicationPaths, LocalizationManager, FileSystemManager, LibraryMonitor, LoggerFactory, ProviderManager);
             RegisterSingleInstance(CollectionManager);
 
-            PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LoggerFactory.CreateLogger("PlaylistManager"), UserManager, ProviderManager);
+            PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LoggerFactory, UserManager, ProviderManager);
             RegisterSingleInstance(PlaylistManager);
 
-            LiveTvManager = new LiveTvManager(this, HttpClient, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, () => ChannelManager);
+            LiveTvManager = new LiveTvManager(this, ServerConfigurationManager, LoggerFactory, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, () => ChannelManager);
             RegisterSingleInstance(LiveTvManager);
 
             UserViewManager = new UserViewManager(LibraryManager, LocalizationManager, UserManager, ChannelManager, LiveTvManager, ServerConfigurationManager);
@@ -929,19 +921,19 @@ namespace Emby.Server.Implementations
             NotificationManager = new NotificationManager(LoggerFactory, UserManager, ServerConfigurationManager);
             RegisterSingleInstance(NotificationManager);
 
-            RegisterSingleInstance<IDeviceDiscovery>(new DeviceDiscovery(LoggerFactory.CreateLogger("IDeviceDiscovery"), ServerConfigurationManager, SocketFactory, TimerFactory));
+            RegisterSingleInstance<IDeviceDiscovery>(new DeviceDiscovery(LoggerFactory, ServerConfigurationManager, SocketFactory, TimerFactory));
 
-            ChapterManager = new ChapterManager(LibraryManager, LoggerFactory.CreateLogger("ChapterManager"), ServerConfigurationManager, ItemRepository);
+            ChapterManager = new ChapterManager(LibraryManager, LoggerFactory, ServerConfigurationManager, ItemRepository);
             RegisterSingleInstance(ChapterManager);
 
             RegisterMediaEncoder(assemblyInfo);
 
-            EncodingManager = new MediaEncoder.EncodingManager(FileSystemManager, Logger, MediaEncoder, ChapterManager, LibraryManager);
+            EncodingManager = new MediaEncoder.EncodingManager(FileSystemManager, LoggerFactory, MediaEncoder, ChapterManager, LibraryManager);
             RegisterSingleInstance(EncodingManager);
 
             var activityLogRepo = GetActivityLogRepository();
             RegisterSingleInstance(activityLogRepo);
-            RegisterSingleInstance<IActivityManager>(new ActivityManager(LoggerFactory.CreateLogger("ActivityManager"), activityLogRepo, UserManager));
+            RegisterSingleInstance<IActivityManager>(new ActivityManager(LoggerFactory, activityLogRepo, UserManager));
 
             var authContext = new AuthorizationContext(AuthenticationRepository, UserManager);
             RegisterSingleInstance<IAuthorizationContext>(authContext);
@@ -950,14 +942,14 @@ namespace Emby.Server.Implementations
             AuthService = new AuthService(UserManager, authContext, ServerConfigurationManager, SessionManager, NetworkManager);
             RegisterSingleInstance(AuthService);
 
-            SubtitleEncoder = new MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder(LibraryManager, LoggerFactory.CreateLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, ProcessFactory, TextEncoding);
+            SubtitleEncoder = new MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder(LibraryManager, LoggerFactory, ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, ProcessFactory);
             RegisterSingleInstance(SubtitleEncoder);
 
             RegisterSingleInstance(CreateResourceFileManager());
 
             displayPreferencesRepo.Initialize();
 
-            var userDataRepo = new SqliteUserDataRepository(LoggerFactory.CreateLogger("SqliteUserDataRepository"), ApplicationPaths, FileSystemManager);
+            var userDataRepo = new SqliteUserDataRepository(LoggerFactory, ApplicationPaths);
 
             SetStaticProperties();
 
@@ -1050,7 +1042,7 @@ namespace Emby.Server.Implementations
 
         private IImageProcessor GetImageProcessor()
         {
-            return new ImageProcessor(LoggerFactory.CreateLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, ImageEncoder, () => LibraryManager, () => MediaEncoder);
+            return new ImageProcessor(LoggerFactory, ServerConfigurationManager.ApplicationPaths, FileSystemManager, ImageEncoder, () => LibraryManager, () => MediaEncoder);
         }
 
         protected virtual FFMpegInstallInfo GetFfmpegInstallInfo()
@@ -1109,7 +1101,7 @@ namespace Emby.Server.Implementations
             var hasExternalEncoder = string.Equals(info.Version, "external", StringComparison.OrdinalIgnoreCase);
 
             var mediaEncoder = new MediaBrowser.MediaEncoding.Encoder.MediaEncoder(
-                LoggerFactory.CreateLogger("MediaEncoder"),
+                LoggerFactory,
                 JsonSerializer,
                 encoderPath,
                 probePath,
@@ -1138,7 +1130,7 @@ namespace Emby.Server.Implementations
         /// <returns>Task{IUserRepository}.</returns>
         private IUserRepository GetUserRepository()
         {
-            var repo = new SqliteUserRepository(LoggerFactory.CreateLogger("SqliteUserRepository"), ApplicationPaths, JsonSerializer);
+            var repo = new SqliteUserRepository(LoggerFactory, ApplicationPaths, JsonSerializer);
 
             repo.Initialize();
 
@@ -1147,7 +1139,7 @@ namespace Emby.Server.Implementations
 
         private IAuthenticationRepository GetAuthenticationRepository()
         {
-            var repo = new AuthenticationRepository(LoggerFactory.CreateLogger("AuthenticationRepository"), ServerConfigurationManager);
+            var repo = new AuthenticationRepository(LoggerFactory, ServerConfigurationManager);
 
             repo.Initialize();
 
@@ -1156,7 +1148,7 @@ namespace Emby.Server.Implementations
 
         private IActivityRepository GetActivityLogRepository()
         {
-            var repo = new ActivityRepository(LoggerFactory.CreateLogger("ActivityRepository"), ServerConfigurationManager.ApplicationPaths, FileSystemManager);
+            var repo = new ActivityRepository(LoggerFactory, ServerConfigurationManager.ApplicationPaths, FileSystemManager);
 
             repo.Initialize();
 

+ 13 - 2
Emby.Server.Implementations/Channels/ChannelManager.cs

@@ -45,12 +45,23 @@ namespace Emby.Server.Implementations.Channels
 
         private readonly ILocalizationManager _localization;
 
-        public ChannelManager(IUserManager userManager, IDtoService dtoService, ILibraryManager libraryManager, ILogger logger, IServerConfigurationManager config, IFileSystem fileSystem, IUserDataManager userDataManager, IJsonSerializer jsonSerializer, ILocalizationManager localization, IHttpClient httpClient, IProviderManager providerManager)
+        public ChannelManager(
+            IUserManager userManager,
+            IDtoService dtoService,
+            ILibraryManager libraryManager,
+            ILoggerFactory loggerFactory,
+            IServerConfigurationManager config,
+            IFileSystem fileSystem,
+            IUserDataManager userDataManager,
+            IJsonSerializer jsonSerializer,
+            ILocalizationManager localization,
+            IHttpClient httpClient,
+            IProviderManager providerManager)
         {
             _userManager = userManager;
             _dtoService = dtoService;
             _libraryManager = libraryManager;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(ChannelManager));
             _config = config;
             _fileSystem = fileSystem;
             _userDataManager = userDataManager;

+ 9 - 2
Emby.Server.Implementations/Collections/CollectionManager.cs

@@ -34,12 +34,19 @@ namespace Emby.Server.Implementations.Collections
         public event EventHandler<CollectionModifiedEventArgs> ItemsAddedToCollection;
         public event EventHandler<CollectionModifiedEventArgs> ItemsRemovedFromCollection;
 
-        public CollectionManager(ILibraryManager libraryManager, IApplicationPaths appPaths, ILocalizationManager localizationManager, IFileSystem fileSystem, ILibraryMonitor iLibraryMonitor, ILogger logger, IProviderManager providerManager)
+        public CollectionManager(
+            ILibraryManager libraryManager,
+            IApplicationPaths appPaths,
+            ILocalizationManager localizationManager,
+            IFileSystem fileSystem,
+            ILibraryMonitor iLibraryMonitor,
+            ILoggerFactory loggerFactory,
+            IProviderManager providerManager)
         {
             _libraryManager = libraryManager;
             _fileSystem = fileSystem;
             _iLibraryMonitor = iLibraryMonitor;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(CollectionManager));
             _providerManager = providerManager;
             _localizationManager = localizationManager;
             _appPaths = appPaths;

+ 2 - 2
Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs

@@ -20,8 +20,8 @@ namespace Emby.Server.Implementations.Data
     {
         protected IFileSystem FileSystem { get; private set; }
 
-        public SqliteDisplayPreferencesRepository(ILogger logger, IJsonSerializer jsonSerializer, IApplicationPaths appPaths, IFileSystem fileSystem)
-            : base(logger)
+        public SqliteDisplayPreferencesRepository(ILoggerFactory loggerFactory, IJsonSerializer jsonSerializer, IApplicationPaths appPaths, IFileSystem fileSystem)
+            : base(loggerFactory.CreateLogger(nameof(SqliteDisplayPreferencesRepository)))
         {
             _jsonSerializer = jsonSerializer;
             FileSystem = fileSystem;

+ 10 - 2
Emby.Server.Implementations/Data/SqliteItemRepository.cs

@@ -67,8 +67,16 @@ namespace Emby.Server.Implementations.Data
         /// <summary>
         /// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
         /// </summary>
-        public SqliteItemRepository(IServerConfigurationManager config, IServerApplicationHost appHost, IJsonSerializer jsonSerializer, ILogger logger, IAssemblyInfo assemblyInfo, IFileSystem fileSystem, IEnvironmentInfo environmentInfo, ITimerFactory timerFactory)
-            : base(logger)
+        public SqliteItemRepository(
+            IServerConfigurationManager config,
+            IServerApplicationHost appHost,
+            IJsonSerializer jsonSerializer,
+            ILoggerFactory loggerFactory,
+            IAssemblyInfo assemblyInfo,
+            IFileSystem fileSystem,
+            IEnvironmentInfo environmentInfo,
+            ITimerFactory timerFactory)
+            : base(loggerFactory.CreateLogger(nameof(SqliteItemRepository)))
         {
             if (config == null)
             {

+ 4 - 5
Emby.Server.Implementations/Data/SqliteUserDataRepository.cs

@@ -15,12 +15,11 @@ namespace Emby.Server.Implementations.Data
 {
     public class SqliteUserDataRepository : BaseSqliteRepository, IUserDataRepository
     {
-        private readonly IFileSystem _fileSystem;
-
-        public SqliteUserDataRepository(ILogger logger, IApplicationPaths appPaths, IFileSystem fileSystem)
-            : base(logger)
+        public SqliteUserDataRepository(
+            ILoggerFactory loggerFactory,
+            IApplicationPaths appPaths)
+            : base(loggerFactory.CreateLogger(nameof(SqliteUserDataRepository)))
         {
-            _fileSystem = fileSystem;
             DbFilePath = Path.Combine(appPaths.DataPath, "library.db");
         }
 

+ 5 - 2
Emby.Server.Implementations/Data/SqliteUserRepository.cs

@@ -17,8 +17,11 @@ namespace Emby.Server.Implementations.Data
     {
         private readonly IJsonSerializer _jsonSerializer;
 
-        public SqliteUserRepository(ILogger logger, IServerApplicationPaths appPaths, IJsonSerializer jsonSerializer)
-            : base(logger)
+        public SqliteUserRepository(
+            ILoggerFactory loggerFactory,
+            IServerApplicationPaths appPaths,
+            IJsonSerializer jsonSerializer)
+            : base(loggerFactory.CreateLogger(nameof(SqliteUserRepository)))
         {
             _jsonSerializer = jsonSerializer;
 

+ 5 - 2
Emby.Server.Implementations/Devices/DeviceId.cs

@@ -86,7 +86,10 @@ namespace Emby.Server.Implementations.Devices
 
         private string _id;
 
-        public DeviceId(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem)
+        public DeviceId(
+            IApplicationPaths appPaths,
+            ILoggerFactory loggerFactory,
+            IFileSystem fileSystem)
         {
             if (fileSystem == null)
             {
@@ -94,7 +97,7 @@ namespace Emby.Server.Implementations.Devices
             }
 
             _appPaths = appPaths;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger("SystemId");
             _fileSystem = fileSystem;
         }
 

+ 12 - 2
Emby.Server.Implementations/Devices/DeviceManager.cs

@@ -47,14 +47,24 @@ namespace Emby.Server.Implementations.Devices
         private readonly object _cameraUploadSyncLock = new object();
         private readonly object _capabilitiesSyncLock = new object();
 
-        public DeviceManager(IAuthenticationRepository authRepo, IJsonSerializer json, ILibraryManager libraryManager, ILocalizationManager localizationManager, IUserManager userManager, IFileSystem fileSystem, ILibraryMonitor libraryMonitor, IServerConfigurationManager config, ILogger logger, INetworkManager network)
+        public DeviceManager(
+            IAuthenticationRepository authRepo,
+            IJsonSerializer json,
+            ILibraryManager libraryManager,
+            ILocalizationManager localizationManager,
+            IUserManager userManager,
+            IFileSystem fileSystem,
+            ILibraryMonitor libraryMonitor,
+            IServerConfigurationManager config,
+            ILoggerFactory loggerFactory,
+            INetworkManager network)
         {
             _json = json;
             _userManager = userManager;
             _fileSystem = fileSystem;
             _libraryMonitor = libraryMonitor;
             _config = config;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(DeviceManager));
             _network = network;
             _libraryManager = libraryManager;
             _localizationManager = localizationManager;

+ 15 - 2
Emby.Server.Implementations/Dto/DtoService.cs

@@ -46,9 +46,22 @@ namespace Emby.Server.Implementations.Dto
         private readonly Func<IMediaSourceManager> _mediaSourceManager;
         private readonly Func<ILiveTvManager> _livetvManager;
 
-        public DtoService(ILogger logger, ILibraryManager libraryManager, IUserDataManager userDataRepository, IItemRepository itemRepo, IImageProcessor imageProcessor, IServerConfigurationManager config, IFileSystem fileSystem, IProviderManager providerManager, Func<IChannelManager> channelManagerFactory, IApplicationHost appHost, Func<IDeviceManager> deviceManager, Func<IMediaSourceManager> mediaSourceManager, Func<ILiveTvManager> livetvManager)
+        public DtoService(
+            ILoggerFactory loggerFactory,
+            ILibraryManager libraryManager,
+            IUserDataManager userDataRepository,
+            IItemRepository itemRepo,
+            IImageProcessor imageProcessor,
+            IServerConfigurationManager config,
+            IFileSystem fileSystem,
+            IProviderManager providerManager,
+            Func<IChannelManager> channelManagerFactory,
+            IApplicationHost appHost,
+            Func<IDeviceManager> deviceManager,
+            Func<IMediaSourceManager> mediaSourceManager,
+            Func<ILiveTvManager> livetvManager)
         {
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(DtoService));
             _libraryManager = libraryManager;
             _userDataRepository = userDataRepository;
             _itemRepo = itemRepo;

+ 1 - 2
Emby.Server.Implementations/Emby.Server.Implementations.csproj

@@ -27,6 +27,7 @@
     <PackageReference Include="SimpleInjector" Version="4.4.2" />
     <PackageReference Include="SQLitePCL.pretty.core" Version="1.1.8" />
     <PackageReference Include="SQLitePCLRaw.core" Version="1.1.11" />
+    <PackageReference Include="UTF.Unknown" Version="1.0.0-beta1" />
   </ItemGroup>
 
   <ItemGroup>
@@ -42,8 +43,6 @@
     <EmbeddedResource Include="Localization\iso6392.txt" />
     <EmbeddedResource Include="Localization\countries.json" />
     <EmbeddedResource Include="Localization\Core\*.json" />
-    <EmbeddedResource Include="TextEncoding\NLangDetect\Profiles\*" />
-    <EmbeddedResource Include="TextEncoding\NLangDetect\Utils\messages.properties" />
     <EmbeddedResource Include="Localization\Ratings\*.txt" />
   </ItemGroup>
 

+ 22 - 32
Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs

@@ -44,18 +44,22 @@ namespace Emby.Server.Implementations.HttpClientManager
         /// <summary>
         /// Initializes a new instance of the <see cref="HttpClientManager" /> class.
         /// </summary>
-        public HttpClientManager(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem, Func<string> defaultUserAgentFn)
+        public HttpClientManager(
+            IApplicationPaths appPaths,
+            ILoggerFactory loggerFactory,
+            IFileSystem fileSystem,
+            Func<string> defaultUserAgentFn)
         {
             if (appPaths == null)
             {
                 throw new ArgumentNullException(nameof(appPaths));
             }
-            if (logger == null)
+            if (loggerFactory == null)
             {
-                throw new ArgumentNullException(nameof(logger));
+                throw new ArgumentNullException(nameof(loggerFactory));
             }
 
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger("HttpClient");
             _fileSystem = fileSystem;
             _appPaths = appPaths;
             _defaultUserAgentFn = defaultUserAgentFn;
@@ -264,7 +268,7 @@ namespace Emby.Server.Implementations.HttpClientManager
 
             var responseCachePath = Path.Combine(_appPaths.CachePath, "httpclient", urlHash);
 
-            var response = await GetCachedResponse(responseCachePath, options.CacheLength, url).ConfigureAwait(false);
+            var response = GetCachedResponse(responseCachePath, options.CacheLength, url);
             if (response != null)
             {
                 return response;
@@ -280,30 +284,24 @@ namespace Emby.Server.Implementations.HttpClientManager
             return response;
         }
 
-        private async Task<HttpResponseInfo> GetCachedResponse(string responseCachePath, TimeSpan cacheLength, string url)
+        private HttpResponseInfo GetCachedResponse(string responseCachePath, TimeSpan cacheLength, string url)
         {
             try
             {
                 if (_fileSystem.GetLastWriteTimeUtc(responseCachePath).Add(cacheLength) > DateTime.UtcNow)
                 {
-                    using (var stream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read, true))
-                    {
-                        var memoryStream = new MemoryStream();
-
-                        await stream.CopyToAsync(memoryStream).ConfigureAwait(false);
-                        memoryStream.Position = 0;
+                    var stream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read, true);
 
-                        return new HttpResponseInfo
-                        {
-                            ResponseUrl = url,
-                            Content = memoryStream,
-                            StatusCode = HttpStatusCode.OK,
-                            ContentLength = memoryStream.Length
-                        };
-                    }
+                    return new HttpResponseInfo
+                    {
+                        ResponseUrl = url,
+                        Content = stream,
+                        StatusCode = HttpStatusCode.OK,
+                        ContentLength = stream.Length
+                    };
                 }
             }
-            catch (FileNotFoundException)
+            catch (FileNotFoundException) // REVIEW: @bond Is this really faster?
             {
 
             }
@@ -319,19 +317,11 @@ namespace Emby.Server.Implementations.HttpClientManager
         {
             _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(responseCachePath));
 
-            using (var responseStream = response.Content)
+            using (var fileStream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true))
             {
-                var memoryStream = new MemoryStream();
-                await responseStream.CopyToAsync(memoryStream).ConfigureAwait(false);
-                memoryStream.Position = 0;
+                await response.Content.CopyToAsync(fileStream).ConfigureAwait(false);
 
-                using (var fileStream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true))
-                {
-                    await memoryStream.CopyToAsync(fileStream).ConfigureAwait(false);
-
-                    memoryStream.Position = 0;
-                    response.Content = memoryStream;
-                }
+                response.Content.Position = 0;
             }
         }
 

+ 3 - 10
Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

@@ -19,7 +19,6 @@ using MediaBrowser.Model.Events;
 using MediaBrowser.Model.Extensions;
 using MediaBrowser.Model.Serialization;
 using MediaBrowser.Model.Services;
-using MediaBrowser.Model.Text;
 using Microsoft.Extensions.Logging;
 
 namespace Emby.Server.Implementations.HttpServer
@@ -37,11 +36,7 @@ namespace Emby.Server.Implementations.HttpServer
 
         private readonly IServerConfigurationManager _config;
         private readonly INetworkManager _networkManager;
-
         private readonly IServerApplicationHost _appHost;
-
-        private readonly ITextEncoding _textEncoding;
-
         private readonly IJsonSerializer _jsonSerializer;
         private readonly IXmlSerializer _xmlSerializer;
         private readonly Func<Type, Func<string, object>> _funcParseFn;
@@ -56,21 +51,19 @@ namespace Emby.Server.Implementations.HttpServer
 
         public HttpListenerHost(
             IServerApplicationHost applicationHost,
-            ILogger logger,
+            ILoggerFactory loggerFactory,
             IServerConfigurationManager config,
             string defaultRedirectPath,
             INetworkManager networkManager,
-            ITextEncoding textEncoding,
             IJsonSerializer jsonSerializer,
             IXmlSerializer xmlSerializer,
             Func<Type, Func<string, object>> funcParseFn)
         {
             _appHost = applicationHost;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger("HttpServer");
             _config = config;
             DefaultRedirectPath = defaultRedirectPath;
             _networkManager = networkManager;
-            _textEncoding = textEncoding;
             _jsonSerializer = jsonSerializer;
             _xmlSerializer = xmlSerializer;
             _funcParseFn = funcParseFn;
@@ -147,7 +140,7 @@ namespace Emby.Server.Implementations.HttpServer
                 return;
             }
 
-            var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, _jsonSerializer, _logger, _textEncoding)
+            var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, _jsonSerializer, _logger)
             {
                 OnReceive = ProcessWebSocketMessageReceived,
                 Url = e.Url,

+ 7 - 10
Emby.Server.Implementations/HttpServer/WebSocketConnection.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Net.WebSockets;
 using System.Text;
 using System.Threading;
@@ -8,8 +8,8 @@ using MediaBrowser.Controller.Net;
 using MediaBrowser.Model.Net;
 using MediaBrowser.Model.Serialization;
 using MediaBrowser.Model.Services;
-using MediaBrowser.Model.Text;
 using Microsoft.Extensions.Logging;
+using UtfUnknown;
 
 namespace Emby.Server.Implementations.HttpServer
 {
@@ -68,7 +68,6 @@ namespace Emby.Server.Implementations.HttpServer
         /// </summary>
         /// <value>The query string.</value>
         public QueryParamCollection QueryString { get; set; }
-        private readonly ITextEncoding _textEncoding;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="WebSocketConnection" /> class.
@@ -78,7 +77,7 @@ namespace Emby.Server.Implementations.HttpServer
         /// <param name="jsonSerializer">The json serializer.</param>
         /// <param name="logger">The logger.</param>
         /// <exception cref="ArgumentNullException">socket</exception>
-        public WebSocketConnection(IWebSocket socket, string remoteEndPoint, IJsonSerializer jsonSerializer, ILogger logger, ITextEncoding textEncoding)
+        public WebSocketConnection(IWebSocket socket, string remoteEndPoint, IJsonSerializer jsonSerializer, ILogger logger)
         {
             if (socket == null)
             {
@@ -110,7 +109,6 @@ namespace Emby.Server.Implementations.HttpServer
 
             RemoteEndPoint = remoteEndPoint;
             _logger = logger;
-            _textEncoding = textEncoding;
 
             socket.Closed += socket_Closed;
         }
@@ -132,8 +130,7 @@ namespace Emby.Server.Implementations.HttpServer
             {
                 return;
             }
-
-            var charset = _textEncoding.GetDetectedEncodingName(bytes, bytes.Length, null, false);
+            var charset = CharsetDetector.DetectFromBytes(bytes).Detected?.EncodingName;
 
             if (string.Equals(charset, "utf-8", StringComparison.OrdinalIgnoreCase))
             {
@@ -141,7 +138,7 @@ namespace Emby.Server.Implementations.HttpServer
             }
             else
             {
-                OnReceiveInternal(_textEncoding.GetASCIIEncoding().GetString(bytes, 0, bytes.Length));
+                OnReceiveInternal(Encoding.ASCII.GetString(bytes, 0, bytes.Length));
             }
         }
 
@@ -161,7 +158,7 @@ namespace Emby.Server.Implementations.HttpServer
 
             var bytes = memory.Slice(0, length).ToArray();
 
-            var charset = _textEncoding.GetDetectedEncodingName(bytes, bytes.Length, null, false);
+            var charset = CharsetDetector.DetectFromBytes(bytes).Detected?.EncodingName;
 
             if (string.Equals(charset, "utf-8", StringComparison.OrdinalIgnoreCase))
             {
@@ -169,7 +166,7 @@ namespace Emby.Server.Implementations.HttpServer
             }
             else
             {
-                OnReceiveInternal(_textEncoding.GetASCIIEncoding().GetString(bytes, 0, bytes.Length));
+                OnReceiveInternal(Encoding.ASCII.GetString(bytes, 0, bytes.Length));
             }
         }
 

+ 10 - 24
Emby.Server.Implementations/IO/ManagedFileSystem.cs

@@ -29,9 +29,14 @@ namespace Emby.Server.Implementations.IO
 
         private string _defaultDirectory;
 
-        public ManagedFileSystem(ILogger logger, IEnvironmentInfo environmentInfo, string defaultDirectory, string tempPath, bool enableSeparateFileAndDirectoryQueries)
-        {
-            Logger = logger;
+        public ManagedFileSystem(
+            ILoggerFactory loggerFactory,
+            IEnvironmentInfo environmentInfo,
+            string defaultDirectory,
+            string tempPath,
+            bool enableSeparateFileAndDirectoryQueries)
+        {
+            Logger = loggerFactory.CreateLogger("FileSystem");
             _supportsAsyncFileStreams = true;
             _tempPath = tempPath;
             _environmentInfo = environmentInfo;
@@ -445,10 +450,7 @@ namespace Emby.Server.Implementations.IO
         }
 
         public Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, FileOpenOptions fileOpenOptions)
-        {
-            var defaultBufferSize = 4096;
-            return new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), defaultBufferSize, GetFileOptions(fileOpenOptions));
-        }
+            => new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), 4096, GetFileOptions(fileOpenOptions));
 
         private static FileOptions GetFileOptions(FileOpenOptions mode)
         {
@@ -759,18 +761,13 @@ namespace Emby.Server.Implementations.IO
             // Only include drives in the ready state or this method could end up being very slow, waiting for drives to timeout
             return DriveInfo.GetDrives().Where(d => d.IsReady).Select(d => new FileSystemMetadata
             {
-                Name = GetName(d),
+                Name = d.Name,
                 FullName = d.RootDirectory.FullName,
                 IsDirectory = true
 
             }).ToList();
         }
 
-        private static string GetName(DriveInfo drive)
-        {
-            return drive.Name;
-        }
-
         public IEnumerable<FileSystemMetadata> GetDirectories(string path, bool recursive = false)
         {
             var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
@@ -846,17 +843,6 @@ namespace Emby.Server.Implementations.IO
             return File.OpenRead(path);
         }
 
-        private void CopyFileUsingStreams(string source, string target, bool overwrite)
-        {
-            using (var sourceStream = OpenRead(source))
-            {
-                using (var targetStream = GetFileStream(target, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
-                {
-                    sourceStream.CopyTo(targetStream);
-                }
-            }
-        }
-
         public void CopyFile(string source, string target, bool overwrite)
         {
             File.Copy(source, target, overwrite);

+ 13 - 3
Emby.Server.Implementations/Library/LibraryManager.cs

@@ -155,9 +155,19 @@ namespace Emby.Server.Implementations.Library
         /// <param name="userManager">The user manager.</param>
         /// <param name="configurationManager">The configuration manager.</param>
         /// <param name="userDataRepository">The user data repository.</param>
-        public LibraryManager(IServerApplicationHost appHost, ILogger logger, ITaskManager taskManager, IUserManager userManager, IServerConfigurationManager configurationManager, IUserDataManager userDataRepository, Func<ILibraryMonitor> libraryMonitorFactory, IFileSystem fileSystem, Func<IProviderManager> providerManagerFactory, Func<IUserViewManager> userviewManager)
-        {
-            _logger = logger;
+        public LibraryManager(
+            IServerApplicationHost appHost,
+            ILoggerFactory loggerFactory,
+            ITaskManager taskManager,
+            IUserManager userManager,
+            IServerConfigurationManager configurationManager,
+            IUserDataManager userDataRepository,
+            Func<ILibraryMonitor> libraryMonitorFactory,
+            IFileSystem fileSystem,
+            Func<IProviderManager> providerManagerFactory,
+            Func<IUserViewManager> userviewManager)
+        {
+            _logger = loggerFactory.CreateLogger(nameof(LibraryManager));
             _taskManager = taskManager;
             _userManager = userManager;
             ConfigurationManager = configurationManager;

+ 13 - 2
Emby.Server.Implementations/Library/MediaSourceManager.cs

@@ -41,12 +41,23 @@ namespace Emby.Server.Implementations.Library
         private ILocalizationManager _localizationManager;
         private IApplicationPaths _appPaths;
 
-        public MediaSourceManager(IItemRepository itemRepo, IApplicationPaths applicationPaths, ILocalizationManager localizationManager, IUserManager userManager, ILibraryManager libraryManager, ILogger logger, IJsonSerializer jsonSerializer, IFileSystem fileSystem, IUserDataManager userDataManager, ITimerFactory timerFactory, Func<IMediaEncoder> mediaEncoder)
+        public MediaSourceManager(
+            IItemRepository itemRepo,
+            IApplicationPaths applicationPaths,
+            ILocalizationManager localizationManager,
+            IUserManager userManager,
+            ILibraryManager libraryManager,
+            ILoggerFactory loggerFactory,
+            IJsonSerializer jsonSerializer,
+            IFileSystem fileSystem,
+            IUserDataManager userDataManager,
+            ITimerFactory timerFactory,
+            Func<IMediaEncoder> mediaEncoder)
         {
             _itemRepo = itemRepo;
             _userManager = userManager;
             _libraryManager = libraryManager;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(MediaSourceManager));
             _jsonSerializer = jsonSerializer;
             _fileSystem = fileSystem;
             _userDataManager = userDataManager;

+ 5 - 4
Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs

@@ -107,7 +107,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
             return null;
         }
 
-        public static bool IsSeriesFolder(string path,
+        public static bool IsSeriesFolder(
+            string path,
             IEnumerable<FileSystemMetadata> fileSystemChildren,
             IDirectoryService directoryService,
             IFileSystem fileSystem,
@@ -135,7 +136,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
                 {
                     if (IsSeasonFolder(child.FullName, isTvContentType, libraryManager))
                     {
-                        //logger.LogDebug("{0} is a series because of season folder {1}.", path, child.FullName);
+                        logger.LogDebug("{Path} is a series because of season folder {Dir}.", path, child.FullName);
                         return true;
                     }
                 }
@@ -161,7 +162,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
                             isOptimistic = false;
                         }
 
-                        var episodeInfo = episodeResolver.Resolve(fullName, false, isNamed, isOptimistic, null, false);
+                        var episodeInfo = episodeResolver.Resolve(fullName, false, isNamed, isOptimistic, fillExtendedInfo: false);
                         if (episodeInfo != null && episodeInfo.EpisodeNumber.HasValue)
                         {
                             return true;
@@ -170,7 +171,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
                 }
             }
 
-            //logger.LogDebug("{0} is not a series folder.", path);
+            logger.LogDebug("{Path} is not a series folder.", path);
             return false;
         }
 

+ 13 - 2
Emby.Server.Implementations/Library/UserManager.cs

@@ -80,9 +80,20 @@ namespace Emby.Server.Implementations.Library
         private IAuthenticationProvider[] _authenticationProviders;
         private DefaultAuthenticationProvider _defaultAuthenticationProvider;
 
-        public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func<IImageProcessor> imageProcessorFactory, Func<IDtoService> dtoServiceFactory, IServerApplicationHost appHost, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ICryptoProvider cryptographyProvider)
+        public UserManager(
+            ILoggerFactory loggerFactory,
+            IServerConfigurationManager configurationManager,
+            IUserRepository userRepository,
+            IXmlSerializer xmlSerializer,
+            INetworkManager networkManager,
+            Func<IImageProcessor> imageProcessorFactory,
+            Func<IDtoService> dtoServiceFactory,
+            IServerApplicationHost appHost,
+            IJsonSerializer jsonSerializer,
+            IFileSystem fileSystem,
+            ICryptoProvider cryptographyProvider)
         {
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(UserManager));
             UserRepository = userRepository;
             _xmlSerializer = xmlSerializer;
             _networkManager = networkManager;

+ 7 - 2
Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs

@@ -26,11 +26,16 @@ namespace Emby.Server.Implementations.LiveTv
         private readonly IApplicationHost _appHost;
         private readonly ILibraryManager _libraryManager;
 
-        public LiveTvDtoService(IDtoService dtoService, IImageProcessor imageProcessor, ILogger logger, IApplicationHost appHost, ILibraryManager libraryManager)
+        public LiveTvDtoService(
+            IDtoService dtoService,
+            IImageProcessor imageProcessor,
+            ILoggerFactory loggerFactory,
+            IApplicationHost appHost,
+            ILibraryManager libraryManager)
         {
             _dtoService = dtoService;
             _imageProcessor = imageProcessor;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(LiveTvDtoService));
             _appHost = appHost;
             _libraryManager = libraryManager;
         }

+ 3 - 9
Emby.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -72,14 +72,10 @@ namespace Emby.Server.Implementations.LiveTv
             return EmbyTV.EmbyTV.Current.GetActiveRecordingPath(id);
         }
 
-        private IServerApplicationHost _appHost;
-        private IHttpClient _httpClient;
-
         public LiveTvManager(
             IServerApplicationHost appHost,
-            IHttpClient httpClient,
             IServerConfigurationManager config,
-            ILogger logger,
+            ILoggerFactory loggerFactory,
             IItemRepository itemRepo,
             IImageProcessor imageProcessor,
             IUserDataManager userDataManager,
@@ -93,9 +89,8 @@ namespace Emby.Server.Implementations.LiveTv
             IFileSystem fileSystem,
             Func<IChannelManager> channelManager)
         {
-            _appHost = appHost;
             _config = config;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(LiveTvManager));
             _itemRepo = itemRepo;
             _userManager = userManager;
             _libraryManager = libraryManager;
@@ -107,9 +102,8 @@ namespace Emby.Server.Implementations.LiveTv
             _dtoService = dtoService;
             _userDataManager = userDataManager;
             _channelManager = channelManager;
-            _httpClient = httpClient;
 
-            _tvDtoService = new LiveTvDtoService(dtoService, imageProcessor, logger, appHost, _libraryManager);
+            _tvDtoService = new LiveTvDtoService(dtoService, imageProcessor, loggerFactory, appHost, _libraryManager);
         }
 
         /// <summary>

+ 8 - 2
Emby.Server.Implementations/Localization/LocalizationManager.cs

@@ -45,12 +45,18 @@ namespace Emby.Server.Implementations.Localization
         /// <param name="configurationManager">The configuration manager.</param>
         /// <param name="fileSystem">The file system.</param>
         /// <param name="jsonSerializer">The json serializer.</param>
-        public LocalizationManager(IServerConfigurationManager configurationManager, IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, IAssemblyInfo assemblyInfo, ITextLocalizer textLocalizer)
+        public LocalizationManager(
+            IServerConfigurationManager configurationManager,
+            IFileSystem fileSystem,
+            IJsonSerializer jsonSerializer,
+            ILoggerFactory loggerFactory,
+            IAssemblyInfo assemblyInfo,
+            ITextLocalizer textLocalizer)
         {
             _configurationManager = configurationManager;
             _fileSystem = fileSystem;
             _jsonSerializer = jsonSerializer;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(LocalizationManager));
             _assemblyInfo = assemblyInfo;
             _textLocalizer = textLocalizer;
 

+ 4 - 3
Emby.Server.Implementations/MediaEncoder/EncodingManager.cs

@@ -26,13 +26,14 @@ namespace Emby.Server.Implementations.MediaEncoder
         private readonly IChapterManager _chapterManager;
         private readonly ILibraryManager _libraryManager;
 
-        public EncodingManager(IFileSystem fileSystem,
-            ILogger logger,
+        public EncodingManager(
+            IFileSystem fileSystem,
+            ILoggerFactory loggerFactory,
             IMediaEncoder encoder,
             IChapterManager chapterManager, ILibraryManager libraryManager)
         {
             _fileSystem = fileSystem;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(EncodingManager));
             _encoder = encoder;
             _chapterManager = chapterManager;
             _libraryManager = libraryManager;

+ 0 - 12
Emby.Server.Implementations/Net/SocketFactory.cs

@@ -17,18 +17,6 @@ namespace Emby.Server.Implementations.Net
         // but that wasn't really the point so kept to YAGNI principal for now, even if the
         // interfaces are a bit ugly, specific and make assumptions.
 
-        private readonly ILogger _logger;
-
-        public SocketFactory(ILogger logger)
-        {
-            if (logger == null)
-            {
-                throw new ArgumentNullException(nameof(logger));
-            }
-
-            _logger = logger;
-        }
-
         public ISocket CreateTcpSocket(IpAddressInfo remoteAddress, int remotePort)
         {
             if (remotePort < 0) throw new ArgumentException("remotePort cannot be less than zero.", nameof(remotePort));

+ 4 - 2
Emby.Server.Implementations/Networking/NetworkManager.cs

@@ -22,9 +22,11 @@ namespace Emby.Server.Implementations.Networking
         public event EventHandler NetworkChanged;
         public Func<string[]> LocalSubnetsFn { get; set; }
 
-        public NetworkManager(ILogger logger, IEnvironmentInfo environment)
+        public NetworkManager(
+            ILoggerFactory loggerFactory,
+            IEnvironmentInfo environment)
         {
-            Logger = logger;
+            Logger = loggerFactory.CreateLogger(nameof(NetworkManager));
 
             // In FreeBSD these events cause a crash
             if (environment.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.BSD)

+ 8 - 2
Emby.Server.Implementations/Playlists/PlaylistManager.cs

@@ -28,12 +28,18 @@ namespace Emby.Server.Implementations.Playlists
         private readonly IUserManager _userManager;
         private readonly IProviderManager _providerManager;
 
-        public PlaylistManager(ILibraryManager libraryManager, IFileSystem fileSystem, ILibraryMonitor iLibraryMonitor, ILogger logger, IUserManager userManager, IProviderManager providerManager)
+        public PlaylistManager(
+            ILibraryManager libraryManager,
+            IFileSystem fileSystem,
+            ILibraryMonitor iLibraryMonitor,
+            ILoggerFactory loggerFactory,
+            IUserManager userManager,
+            IProviderManager providerManager)
         {
             _libraryManager = libraryManager;
             _fileSystem = fileSystem;
             _iLibraryMonitor = iLibraryMonitor;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(PlaylistManager));
             _userManager = userManager;
             _providerManager = providerManager;
         }

+ 5 - 2
Emby.Server.Implementations/ResourceFileManager.cs

@@ -15,10 +15,13 @@ namespace Emby.Server.Implementations
         private readonly ILogger _logger;
         private readonly IHttpResultFactory _resultFactory;
 
-        public ResourceFileManager(IHttpResultFactory resultFactory, ILogger logger, IFileSystem fileSystem)
+        public ResourceFileManager(
+            IHttpResultFactory resultFactory,
+            ILoggerFactory loggerFactory,
+            IFileSystem fileSystem)
         {
             _resultFactory = resultFactory;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger("ResourceManager");
             _fileSystem = fileSystem;
         }
 

+ 9 - 4
Emby.Server.Implementations/ScheduledTasks/TaskManager.cs

@@ -60,13 +60,18 @@ namespace Emby.Server.Implementations.ScheduledTasks
         /// </summary>
         /// <param name="applicationPaths">The application paths.</param>
         /// <param name="jsonSerializer">The json serializer.</param>
-        /// <param name="logger">The logger.</param>
-        /// <exception cref="ArgumentException">kernel</exception>
-        public TaskManager(IApplicationPaths applicationPaths, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem, ISystemEvents systemEvents)
+        /// <param name="loggerFactory">The logger factory.</param>
+        /// <exception cref="System.ArgumentException">kernel</exception>
+        public TaskManager(
+            IApplicationPaths applicationPaths,
+            IJsonSerializer jsonSerializer,
+            ILoggerFactory loggerFactory,
+            IFileSystem fileSystem,
+            ISystemEvents systemEvents)
         {
             ApplicationPaths = applicationPaths;
             JsonSerializer = jsonSerializer;
-            Logger = logger;
+            Logger = loggerFactory.CreateLogger(nameof(TaskManager));
             _fileSystem = fileSystem;
             _systemEvents = systemEvents;
 

+ 2 - 2
Emby.Server.Implementations/Security/AuthenticationRepository.cs

@@ -18,8 +18,8 @@ namespace Emby.Server.Implementations.Security
         private readonly IServerConfigurationManager _config;
         private readonly CultureInfo _usCulture = new CultureInfo("en-US");
 
-        public AuthenticationRepository(ILogger logger, IServerConfigurationManager config)
-            : base(logger)
+        public AuthenticationRepository(ILoggerFactory loggerFactory, IServerConfigurationManager config)
+            : base(loggerFactory.CreateLogger(nameof(AuthenticationRepository)))
         {
             _config = config;
             DbFilePath = Path.Combine(config.ApplicationPaths.DataPath, "authentication.db");

+ 2 - 4
Emby.Server.Implementations/Serialization/JsonSerializer.cs

@@ -13,12 +13,11 @@ namespace Emby.Common.Implementations.Serialization
     public class JsonSerializer : IJsonSerializer
     {
         private readonly IFileSystem _fileSystem;
-        private readonly ILogger _logger;
 
-        public JsonSerializer(IFileSystem fileSystem, ILogger logger)
+        public JsonSerializer(
+            IFileSystem fileSystem)
         {
             _fileSystem = fileSystem;
-            _logger = logger;
             Configure();
         }
 
@@ -69,7 +68,6 @@ namespace Emby.Common.Implementations.Serialization
 
         private static Stream OpenFile(string path)
         {
-            //_logger.LogDebug("Deserializing file {0}", path);
             return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 131072);
         }
 

+ 4 - 2
Emby.Server.Implementations/Serialization/XmlSerializer.cs

@@ -17,10 +17,12 @@ namespace Emby.Server.Implementations.Serialization
         private readonly IFileSystem _fileSystem;
         private readonly ILogger _logger;
 
-        public MyXmlSerializer(IFileSystem fileSystem, ILogger logger)
+        public MyXmlSerializer(
+            IFileSystem fileSystem,
+            ILoggerFactory loggerFactory)
         {
             _fileSystem = fileSystem;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger("XmlSerializer");
         }
 
         // Need to cache these

+ 16 - 2
Emby.Server.Implementations/Session/SessionManager.cs

@@ -90,10 +90,24 @@ namespace Emby.Server.Implementations.Session
         public event EventHandler<SessionEventArgs> SessionEnded;
         public event EventHandler<SessionEventArgs> SessionActivity;
 
-        public SessionManager(IUserDataManager userDataManager, ILogger logger, ILibraryManager libraryManager, IUserManager userManager, IMusicManager musicManager, IDtoService dtoService, IImageProcessor imageProcessor, IJsonSerializer jsonSerializer, IServerApplicationHost appHost, IHttpClient httpClient, IAuthenticationRepository authRepo, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, ITimerFactory timerFactory)
+        public SessionManager(
+            IUserDataManager userDataManager,
+            ILoggerFactory loggerFactory,
+            ILibraryManager libraryManager,
+            IUserManager userManager,
+            IMusicManager musicManager,
+            IDtoService dtoService,
+            IImageProcessor imageProcessor,
+            IJsonSerializer jsonSerializer,
+            IServerApplicationHost appHost,
+            IHttpClient httpClient,
+            IAuthenticationRepository authRepo,
+            IDeviceManager deviceManager,
+            IMediaSourceManager mediaSourceManager,
+            ITimerFactory timerFactory)
         {
             _userDataManager = userDataManager;
-            _logger = logger;
+            _logger = loggerFactory.CreateLogger(nameof(SessionManager));
             _libraryManager = libraryManager;
             _userManager = userManager;
             _musicManager = musicManager;

+ 0 - 8
Emby.Server.Implementations/SystemEvents.cs

@@ -1,6 +1,5 @@
 using System;
 using MediaBrowser.Model.System;
-using Microsoft.Extensions.Logging;
 
 namespace Emby.Server.Implementations
 {
@@ -10,12 +9,5 @@ namespace Emby.Server.Implementations
         public event EventHandler Suspend;
         public event EventHandler SessionLogoff;
         public event EventHandler SystemShutdown;
-
-        private readonly ILogger _logger;
-
-        public SystemEvents(ILogger logger)
-        {
-            _logger = logger;
-        }
     }
 }

+ 0 - 371
Emby.Server.Implementations/TextEncoding/NLangDetect/Detector.cs

@@ -1,371 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using NLangDetect.Core.Extensions;
-using NLangDetect.Core.Utils;
-
-namespace NLangDetect.Core
-{
-    public class Detector
-    {
-        private const double _AlphaDefault = 0.5;
-        private const double _AlphaWidth = 0.05;
-
-        private const int _IterationLimit = 1000;
-        private const double _ProbThreshold = 0.1;
-        private const double _ConvThreshold = 0.99999;
-        private const int _BaseFreq = 10000;
-
-        private static readonly Regex _UrlRegex = new Regex("https?://[-_.?&~;+=/#0-9A-Za-z]+", RegexOptions.Compiled);
-        private static readonly Regex _MailRegex = new Regex("[-_.0-9A-Za-z]+@[-_0-9A-Za-z]+[-_.0-9A-Za-z]+", RegexOptions.Compiled);
-
-        private readonly Dictionary<string, ProbVector> _wordLangProbMap;
-        private readonly List<string> _langlist;
-
-        private StringBuilder _text;
-        private double[] _langprob;
-
-        private double _alpha = _AlphaDefault;
-        private const int _trialsCount = 7;
-        private int _maxTextLength = 10000;
-        private double[] _priorMap;
-        private int? _seed;
-
-        #region Constructor(s)
-
-        public Detector(DetectorFactory factory)
-        {
-            _wordLangProbMap = factory.WordLangProbMap;
-            _langlist = factory.Langlist;
-            _text = new StringBuilder();
-            _seed = factory.Seed;
-        }
-
-        #endregion
-
-        #region Public methods
-
-        public void SetAlpha(double alpha)
-        {
-            _alpha = alpha;
-        }
-
-        public void SetPriorMap(Dictionary<string, double> priorMap)
-        {
-            _priorMap = new double[_langlist.Count];
-
-            double sump = 0;
-
-            for (int i = 0; i < _priorMap.Length; i++)
-            {
-                string lang = _langlist[i];
-
-                if (priorMap.ContainsKey(lang))
-                {
-                    double p = priorMap[lang];
-
-                    if (p < 0)
-                    {
-                        throw new NLangDetectException("Prior probability must be non-negative.", ErrorCode.InitParamError);
-                    }
-
-                    _priorMap[i] = p;
-                    sump += p;
-                }
-            }
-
-            if (sump <= 0)
-            {
-                throw new NLangDetectException("More one of prior probability must be non-zero.", ErrorCode.InitParamError);
-            }
-
-            for (int i = 0; i < _priorMap.Length; i++)
-            {
-                _priorMap[i] /= sump;
-            }
-        }
-
-        public void SetMaxTextLength(int max_text_length)
-        {
-            _maxTextLength = max_text_length;
-        }
-
-        // TODO IMM HI: TextReader?
-        public void Append(StreamReader streamReader)
-        {
-            var buf = new char[_maxTextLength / 2];
-
-            while (_text.Length < _maxTextLength && !streamReader.EndOfStream)
-            {
-                int length = streamReader.Read(buf, 0, buf.Length);
-
-                Append(new string(buf, 0, length));
-            }
-        }
-
-        public void Append(string text)
-        {
-            text = _UrlRegex.Replace(text, " ");
-            text = _MailRegex.Replace(text, " ");
-
-            char pre = '\0';
-
-            for (int i = 0; i < text.Length && i < _maxTextLength; i++)
-            {
-                char c = NGram.Normalize(text[i]);
-
-                if (c != ' ' || pre != ' ')
-                {
-                    _text.Append(c);
-                }
-
-                pre = c;
-            }
-        }
-
-        private void CleanText()
-        {
-            int latinCount = 0, nonLatinCount = 0;
-
-            for (int i = 0; i < _text.Length; i++)
-            {
-                char c = _text[i];
-
-                if (c <= 'z' && c >= 'A')
-                {
-                    latinCount++;
-                }
-                else if (c >= '\u0300' && c.GetUnicodeBlock() != UnicodeBlock.LatinExtendedAdditional)
-                {
-                    nonLatinCount++;
-                }
-            }
-
-            if (latinCount * 2 < nonLatinCount)
-            {
-                var textWithoutLatin = new StringBuilder();
-
-                for (int i = 0; i < _text.Length; i++)
-                {
-                    char c = _text[i];
-
-                    if (c > 'z' || c < 'A')
-                    {
-                        textWithoutLatin.Append(c);
-                    }
-                }
-
-                _text = textWithoutLatin;
-            }
-        }
-
-        public string Detect()
-        {
-            List<Language> probabilities = GetProbabilities();
-
-            return
-              probabilities.Count > 0
-                ? probabilities[0].Name
-                : null;
-        }
-
-        public List<Language> GetProbabilities()
-        {
-            if (_langprob == null)
-            {
-                DetectBlock();
-            }
-
-            var list = SortProbability(_langprob);
-
-            return list;
-        }
-
-        #endregion
-
-        #region Private helper methods
-
-        private static double NormalizeProb(double[] probs)
-        {
-            double maxp = 0, sump = 0;
-
-            sump += probs.Sum();
-
-            for (int i = 0; i < probs.Length; i++)
-            {
-                double p = probs[i] / sump;
-
-                if (maxp < p)
-                {
-                    maxp = p;
-                }
-
-                probs[i] = p;
-            }
-
-            return maxp;
-        }
-
-        private static string UnicodeEncode(string word)
-        {
-            var resultSb = new StringBuilder();
-
-            foreach (char ch in word)
-            {
-                if (ch >= '\u0080')
-                {
-                    string st = string.Format("{0:x}", 0x10000 + ch);
-
-                    while (st.Length < 4)
-                    {
-                        st = "0" + st;
-                    }
-
-                    resultSb
-                      .Append("\\u")
-                      .Append(st.SubSequence(1, 5));
-                }
-                else
-                {
-                    resultSb.Append(ch);
-                }
-            }
-
-            return resultSb.ToString();
-        }
-
-        private void DetectBlock()
-        {
-            CleanText();
-
-            List<string> ngrams = ExtractNGrams();
-
-            if (ngrams.Count == 0)
-            {
-                throw new NLangDetectException("no features in text", ErrorCode.CantDetectError);
-            }
-
-            _langprob = new double[_langlist.Count];
-
-            var rand = (_seed.HasValue ? new Random(_seed.Value) : new Random());
-
-            for (int t = 0; t < _trialsCount; t++)
-            {
-                double[] prob = InitProbability();
-
-                // TODO IMM HI: verify it works
-                double alpha = _alpha + rand.NextGaussian() * _AlphaWidth;
-
-                for (int i = 0; ; i++)
-                {
-                    int r = rand.Next(ngrams.Count);
-
-                    UpdateLangProb(prob, ngrams[r], alpha);
-
-                    if (i % 5 == 0)
-                    {
-                        if (NormalizeProb(prob) > _ConvThreshold || i >= _IterationLimit)
-                        {
-                            break;
-                        }
-                    }
-                }
-
-                for (int j = 0; j < _langprob.Length; j++)
-                {
-                    _langprob[j] += prob[j] / _trialsCount;
-                }
-            }
-        }
-
-        private double[] InitProbability()
-        {
-            var prob = new double[_langlist.Count];
-
-            if (_priorMap != null)
-            {
-                for (int i = 0; i < prob.Length; i++)
-                {
-                    prob[i] = _priorMap[i];
-                }
-            }
-            else
-            {
-                for (int i = 0; i < prob.Length; i++)
-                {
-                    prob[i] = 1.0 / _langlist.Count;
-                }
-            }
-            return prob;
-        }
-
-        private List<string> ExtractNGrams()
-        {
-            var list = new List<string>();
-            var ngram = new NGram();
-
-            for (int i = 0; i < _text.Length; i++)
-            {
-                ngram.AddChar(_text[i]);
-
-                for (int n = 1; n <= NGram.GramsCount; n++)
-                {
-                    string w = ngram.Get(n);
-
-                    if (w != null && _wordLangProbMap.ContainsKey(w))
-                    {
-                        list.Add(w);
-                    }
-                }
-            }
-
-            return list;
-        }
-
-        private void UpdateLangProb(double[] prob, string word, double alpha)
-        {
-            if (word == null || !_wordLangProbMap.ContainsKey(word))
-            {
-                return;
-            }
-
-            ProbVector langProbMap = _wordLangProbMap[word];
-            double weight = alpha / _BaseFreq;
-
-            for (int i = 0; i < prob.Length; i++)
-            {
-                prob[i] *= weight + langProbMap[i];
-            }
-        }
-
-        private List<Language> SortProbability(double[] prob)
-        {
-            var list = new List<Language>();
-
-            for (int j = 0; j < prob.Length; j++)
-            {
-                double p = prob[j];
-
-                if (p > _ProbThreshold)
-                {
-                    for (int i = 0; i <= list.Count; i++)
-                    {
-                        if (i == list.Count || list[i].Probability < p)
-                        {
-                            list.Insert(i, new Language(_langlist[j], p));
-
-                            break;
-                        }
-                    }
-                }
-            }
-
-            return list;
-        }
-
-        #endregion
-    }
-}

+ 0 - 125
Emby.Server.Implementations/TextEncoding/NLangDetect/DetectorFactory.cs

@@ -1,125 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using MediaBrowser.Model.Serialization;
-using NLangDetect.Core.Utils;
-
-namespace NLangDetect.Core
-{
-    public class DetectorFactory
-    {
-        public Dictionary<string, ProbVector> WordLangProbMap;
-        public List<string> Langlist;
-
-        private static readonly DetectorFactory _instance = new DetectorFactory();
-
-        #region Constructor(s)
-
-        private DetectorFactory()
-        {
-            WordLangProbMap = new Dictionary<string, ProbVector>();
-            Langlist = new List<string>();
-        }
-
-        #endregion
-
-        #region Public methods
-
-        public static void LoadProfiles(IJsonSerializer json)
-        {
-            var assembly = typeof(DetectorFactory).Assembly;
-            var names = assembly.GetManifestResourceNames()
-                      .Where(i => i.IndexOf("NLangDetect.Profiles", StringComparison.Ordinal) != -1)
-                      .ToList();
-
-            var index = 0;
-
-            foreach (var name in names)
-            {
-                using (var stream = assembly.GetManifestResourceStream(name))
-                {
-                    var langProfile = (LangProfile)json.DeserializeFromStream(stream, typeof(LangProfile));
-
-                    AddProfile(langProfile, index);
-                }
-
-                index++;
-            }
-        }
-
-        public static Detector Create()
-        {
-            return CreateDetector();
-        }
-
-        public static Detector Create(double alpha)
-        {
-            var detector = CreateDetector();
-
-            detector.SetAlpha(alpha);
-
-            return detector;
-        }
-
-        public static void SetSeed(int? seed)
-        {
-            _instance.Seed = seed;
-        }
-
-        #endregion
-
-        #region Internal methods
-
-        internal static void AddProfile(LangProfile profile, int index)
-        {
-            var lang = profile.name;
-
-            if (_instance.Langlist.Contains(lang))
-            {
-                throw new NLangDetectException("duplicate the same language profile", ErrorCode.DuplicateLangError);
-            }
-
-            _instance.Langlist.Add(lang);
-
-            foreach (string word in profile.freq.Keys)
-            {
-                if (!_instance.WordLangProbMap.ContainsKey(word))
-                {
-                    _instance.WordLangProbMap.Add(word, new ProbVector());
-                }
-
-                double prob = (double)profile.freq[word] / profile.n_words[word.Length - 1];
-
-                _instance.WordLangProbMap[word][index] = prob;
-            }
-        }
-
-        internal static void Clear()
-        {
-            _instance.Langlist.Clear();
-            _instance.WordLangProbMap.Clear();
-        }
-
-        #endregion
-
-        #region Private helper methods
-
-        private static Detector CreateDetector()
-        {
-            if (_instance.Langlist.Count == 0)
-            {
-                throw new NLangDetectException("need to load profiles", ErrorCode.NeedLoadProfileError);
-            }
-
-            return new Detector(_instance);
-        }
-
-        #endregion
-
-        #region Properties
-
-        public int? Seed { get; private set; }
-
-        #endregion
-    }
-}

+ 0 - 15
Emby.Server.Implementations/TextEncoding/NLangDetect/ErrorCode.cs

@@ -1,15 +0,0 @@
-namespace NLangDetect.Core
-{
-    public enum ErrorCode
-    {
-        NoTextError,
-        FormatError,
-        FileLoadError,
-        DuplicateLangError,
-        NeedLoadProfileError,
-        CantDetectError,
-        CantOpenTrainData,
-        TrainDataFormatError,
-        InitParamError,
-    }
-}

+ 0 - 374
Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/CharExtensions.cs

@@ -1,374 +0,0 @@
-using System;
-
-namespace NLangDetect.Core.Extensions
-{
-    public static class CharExtensions
-    {
-        private const int MIN_CODE_POINT = 0x000000;
-        private const int MAX_CODE_POINT = 0x10ffff;
-
-        private static readonly int[] _unicodeBlockStarts =
-          {
-        #region Unicode block starts
-
-        0x0000, // Basic Latin
-        0x0080, // Latin-1 Supplement
-        0x0100, // Latin Extended-A
-        0x0180, // Latin Extended-B
-        0x0250, // IPA Extensions
-        0x02B0, // Spacing Modifier Letters
-        0x0300, // Combining Diacritical Marks
-        0x0370, // Greek and Coptic
-        0x0400, // Cyrillic
-        0x0500, // Cyrillic Supplementary
-        0x0530, // Armenian
-        0x0590, // Hebrew
-        0x0600, // Arabic
-        0x0700, // Syriac
-        0x0750, // unassigned
-        0x0780, // Thaana
-        0x07C0, // unassigned
-        0x0900, // Devanagari
-        0x0980, // Bengali
-        0x0A00, // Gurmukhi
-        0x0A80, // Gujarati
-        0x0B00, // Oriya
-        0x0B80, // Tamil
-        0x0C00, // Telugu
-        0x0C80, // Kannada
-        0x0D00, // Malayalam
-        0x0D80, // Sinhala
-        0x0E00, // Thai
-        0x0E80, // Lao
-        0x0F00, // Tibetan
-        0x1000, // Myanmar
-        0x10A0, // Georgian
-        0x1100, // Hangul Jamo
-        0x1200, // Ethiopic
-        0x1380, // unassigned
-        0x13A0, // Cherokee
-        0x1400, // Unified Canadian Aboriginal Syllabics
-        0x1680, // Ogham
-        0x16A0, // Runic
-        0x1700, // Tagalog
-        0x1720, // Hanunoo
-        0x1740, // Buhid
-        0x1760, // Tagbanwa
-        0x1780, // Khmer
-        0x1800, // Mongolian
-        0x18B0, // unassigned
-        0x1900, // Limbu
-        0x1950, // Tai Le
-        0x1980, // unassigned
-        0x19E0, // Khmer Symbols
-        0x1A00, // unassigned
-        0x1D00, // Phonetic Extensions
-        0x1D80, // unassigned
-        0x1E00, // Latin Extended Additional
-        0x1F00, // Greek Extended
-        0x2000, // General Punctuation
-        0x2070, // Superscripts and Subscripts
-        0x20A0, // Currency Symbols
-        0x20D0, // Combining Diacritical Marks for Symbols
-        0x2100, // Letterlike Symbols
-        0x2150, // Number Forms
-        0x2190, // Arrows
-        0x2200, // Mathematical Operators
-        0x2300, // Miscellaneous Technical
-        0x2400, // Control Pictures
-        0x2440, // Optical Character Recognition
-        0x2460, // Enclosed Alphanumerics
-        0x2500, // Box Drawing
-        0x2580, // Block Elements
-        0x25A0, // Geometric Shapes
-        0x2600, // Miscellaneous Symbols
-        0x2700, // Dingbats
-        0x27C0, // Miscellaneous Mathematical Symbols-A
-        0x27F0, // Supplemental Arrows-A
-        0x2800, // Braille Patterns
-        0x2900, // Supplemental Arrows-B
-        0x2980, // Miscellaneous Mathematical Symbols-B
-        0x2A00, // Supplemental Mathematical Operators
-        0x2B00, // Miscellaneous Symbols and Arrows
-        0x2C00, // unassigned
-        0x2E80, // CJK Radicals Supplement
-        0x2F00, // Kangxi Radicals
-        0x2FE0, // unassigned
-        0x2FF0, // Ideographic Description Characters
-        0x3000, // CJK Symbols and Punctuation
-        0x3040, // Hiragana
-        0x30A0, // Katakana
-        0x3100, // Bopomofo
-        0x3130, // Hangul Compatibility Jamo
-        0x3190, // Kanbun
-        0x31A0, // Bopomofo Extended
-        0x31C0, // unassigned
-        0x31F0, // Katakana Phonetic Extensions
-        0x3200, // Enclosed CJK Letters and Months
-        0x3300, // CJK Compatibility
-        0x3400, // CJK Unified Ideographs Extension A
-        0x4DC0, // Yijing Hexagram Symbols
-        0x4E00, // CJK Unified Ideographs
-        0xA000, // Yi Syllables
-        0xA490, // Yi Radicals
-        0xA4D0, // unassigned
-        0xAC00, // Hangul Syllables
-        0xD7B0, // unassigned
-        0xD800, // High Surrogates
-        0xDB80, // High Private Use Surrogates
-        0xDC00, // Low Surrogates
-        0xE000, // Private Use
-        0xF900, // CJK Compatibility Ideographs
-        0xFB00, // Alphabetic Presentation Forms
-        0xFB50, // Arabic Presentation Forms-A
-        0xFE00, // Variation Selectors
-        0xFE10, // unassigned
-        0xFE20, // Combining Half Marks
-        0xFE30, // CJK Compatibility Forms
-        0xFE50, // Small Form Variants
-        0xFE70, // Arabic Presentation Forms-B
-        0xFF00, // Halfwidth and Fullwidth Forms
-        0xFFF0, // Specials
-        0x10000, // Linear B Syllabary
-        0x10080, // Linear B Ideograms
-        0x10100, // Aegean Numbers
-        0x10140, // unassigned
-        0x10300, // Old Italic
-        0x10330, // Gothic
-        0x10350, // unassigned
-        0x10380, // Ugaritic
-        0x103A0, // unassigned
-        0x10400, // Deseret
-        0x10450, // Shavian
-        0x10480, // Osmanya
-        0x104B0, // unassigned
-        0x10800, // Cypriot Syllabary
-        0x10840, // unassigned
-        0x1D000, // Byzantine Musical Symbols
-        0x1D100, // Musical Symbols
-        0x1D200, // unassigned
-        0x1D300, // Tai Xuan Jing Symbols
-        0x1D360, // unassigned
-        0x1D400, // Mathematical Alphanumeric Symbols
-        0x1D800, // unassigned
-        0x20000, // CJK Unified Ideographs Extension B
-        0x2A6E0, // unassigned
-        0x2F800, // CJK Compatibility Ideographs Supplement
-        0x2FA20, // unassigned
-        0xE0000, // Tags
-        0xE0080, // unassigned
-        0xE0100, // Variation Selectors Supplement
-        0xE01F0, // unassigned
-        0xF0000, // Supplementary Private Use Area-A
-        0x100000, // Supplementary Private Use Area-B
-
-        #endregion
-      };
-
-        private static readonly UnicodeBlock?[] _unicodeBlocks =
-          {
-        #region Unicode blocks
-        UnicodeBlock.BasicLatin,
-        UnicodeBlock.Latin1Supplement,
-        UnicodeBlock.LatinExtendedA,
-        UnicodeBlock.LatinExtendedB,
-        UnicodeBlock.IpaExtensions,
-        UnicodeBlock.SpacingModifierLetters,
-        UnicodeBlock.CombiningDiacriticalMarks,
-        UnicodeBlock.Greek,
-        UnicodeBlock.Cyrillic,
-        UnicodeBlock.CyrillicSupplementary,
-        UnicodeBlock.Armenian,
-        UnicodeBlock.Hebrew,
-        UnicodeBlock.Arabic,
-        UnicodeBlock.Syriac,
-        null,
-        UnicodeBlock.Thaana,
-        null,
-        UnicodeBlock.Devanagari,
-        UnicodeBlock.Bengali,
-        UnicodeBlock.Gurmukhi,
-        UnicodeBlock.Gujarati,
-        UnicodeBlock.Oriya,
-        UnicodeBlock.Tamil,
-        UnicodeBlock.Telugu,
-        UnicodeBlock.Kannada,
-        UnicodeBlock.Malayalam,
-        UnicodeBlock.Sinhala,
-        UnicodeBlock.Thai,
-        UnicodeBlock.Lao,
-        UnicodeBlock.Tibetan,
-        UnicodeBlock.Myanmar,
-        UnicodeBlock.Georgian,
-        UnicodeBlock.HangulJamo,
-        UnicodeBlock.Ethiopic,
-        null,
-        UnicodeBlock.Cherokee,
-        UnicodeBlock.UnifiedCanadianAboriginalSyllabics,
-        UnicodeBlock.Ogham,
-        UnicodeBlock.Runic,
-        UnicodeBlock.Tagalog,
-        UnicodeBlock.Hanunoo,
-        UnicodeBlock.Buhid,
-        UnicodeBlock.Tagbanwa,
-        UnicodeBlock.Khmer,
-        UnicodeBlock.Mongolian,
-        null,
-        UnicodeBlock.Limbu,
-        UnicodeBlock.TaiLe,
-        null,
-        UnicodeBlock.KhmerSymbols,
-        null,
-        UnicodeBlock.PhoneticExtensions,
-        null,
-        UnicodeBlock.LatinExtendedAdditional,
-        UnicodeBlock.GreekExtended,
-        UnicodeBlock.GeneralPunctuation,
-        UnicodeBlock.SuperscriptsAndSubscripts,
-        UnicodeBlock.CurrencySymbols,
-        UnicodeBlock.CombiningMarksForSymbols,
-        UnicodeBlock.LetterlikeSymbols,
-        UnicodeBlock.NumberForms,
-        UnicodeBlock.Arrows,
-        UnicodeBlock.MathematicalOperators,
-        UnicodeBlock.MiscellaneousTechnical,
-        UnicodeBlock.ControlPictures,
-        UnicodeBlock.OpticalCharacterRecognition,
-        UnicodeBlock.EnclosedAlphanumerics,
-        UnicodeBlock.BoxDrawing,
-        UnicodeBlock.BlockElements,
-        UnicodeBlock.GeometricShapes,
-        UnicodeBlock.MiscellaneousSymbols,
-        UnicodeBlock.Dingbats,
-        UnicodeBlock.MiscellaneousMathematicalSymbolsA,
-        UnicodeBlock.SupplementalArrowsA,
-        UnicodeBlock.BraillePatterns,
-        UnicodeBlock.SupplementalArrowsB,
-        UnicodeBlock.MiscellaneousMathematicalSymbolsB,
-        UnicodeBlock.SupplementalMathematicalOperators,
-        UnicodeBlock.MiscellaneousSymbolsAndArrows,
-        null,
-        UnicodeBlock.CjkRadicalsSupplement,
-        UnicodeBlock.KangxiRadicals,
-        null,
-        UnicodeBlock.IdeographicDescriptionCharacters,
-        UnicodeBlock.CjkSymbolsAndPunctuation,
-        UnicodeBlock.Hiragana,
-        UnicodeBlock.Katakana,
-        UnicodeBlock.Bopomofo,
-        UnicodeBlock.HangulCompatibilityJamo,
-        UnicodeBlock.Kanbun,
-        UnicodeBlock.BopomofoExtended,
-        null,
-        UnicodeBlock.KatakanaPhoneticExtensions,
-        UnicodeBlock.EnclosedCjkLettersAndMonths,
-        UnicodeBlock.CjkCompatibility,
-        UnicodeBlock.CjkUnifiedIdeographsExtensionA,
-        UnicodeBlock.YijingHexagramSymbols,
-        UnicodeBlock.CjkUnifiedIdeographs,
-        UnicodeBlock.YiSyllables,
-        UnicodeBlock.YiRadicals,
-        null,
-        UnicodeBlock.HangulSyllables,
-        null,
-        UnicodeBlock.HighSurrogates,
-        UnicodeBlock.HighPrivateUseSurrogates,
-        UnicodeBlock.LowSurrogates,
-        UnicodeBlock.PrivateUseArea,
-        UnicodeBlock.CjkCompatibilityIdeographs,
-        UnicodeBlock.AlphabeticPresentationForms,
-        UnicodeBlock.ArabicPresentationFormsA,
-        UnicodeBlock.VariationSelectors,
-        null,
-        UnicodeBlock.CombiningHalfMarks,
-        UnicodeBlock.CjkCompatibilityForms,
-        UnicodeBlock.SmallFormVariants,
-        UnicodeBlock.ArabicPresentationFormsB,
-        UnicodeBlock.HalfwidthAndFullwidthForms,
-        UnicodeBlock.Specials,
-        UnicodeBlock.LinearBSyllabary,
-        UnicodeBlock.LinearBIdeograms,
-        UnicodeBlock.AegeanNumbers,
-        null,
-        UnicodeBlock.OldItalic,
-        UnicodeBlock.Gothic,
-        null,
-        UnicodeBlock.Ugaritic,
-        null,
-        UnicodeBlock.Deseret,
-        UnicodeBlock.Shavian,
-        UnicodeBlock.Osmanya,
-        null,
-        UnicodeBlock.CypriotSyllabary,
-        null,
-        UnicodeBlock.ByzantineMusicalSymbols,
-        UnicodeBlock.MusicalSymbols,
-        null,
-        UnicodeBlock.TaiXuanJingSymbols,
-        null,
-        UnicodeBlock.MathematicalAlphanumericSymbols,
-        null,
-        UnicodeBlock.CjkUnifiedIdeographsExtensionB,
-        null,
-        UnicodeBlock.CjkCompatibilityIdeographsSupplement,
-        null,
-        UnicodeBlock.Tags,
-        null,
-        UnicodeBlock.VariationSelectorsSupplement,
-        null,
-        UnicodeBlock.SupplementaryPrivateUseAreaA,
-        UnicodeBlock.SupplementaryPrivateUseAreaB,
-
-        #endregion
-      };
-
-        #region Public methods
-
-        /// <remarks>
-        /// Taken from JDK source: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/Character.java#Character.UnicodeBlock.0LATIN_EXTENDED_ADDITIONAL
-        /// </remarks>
-        public static UnicodeBlock? GetUnicodeBlock(this char ch)
-        {
-            int codePoint = ch;
-
-            if (!IsValidCodePoint(codePoint))
-            {
-                throw new ArgumentException("Argument is not a valid code point.", nameof(ch));
-            }
-
-            int top, bottom, current;
-
-            bottom = 0;
-            top = _unicodeBlockStarts.Length;
-            current = top / 2;
-
-            // invariant: top > current >= bottom && codePoint >= unicodeBlockStarts[bottom]
-            while (top - bottom > 1)
-            {
-                if (codePoint >= _unicodeBlockStarts[current])
-                {
-                    bottom = current;
-                }
-                else
-                {
-                    top = current;
-                }
-
-                current = (top + bottom) / 2;
-            }
-
-            return _unicodeBlocks[current];
-        }
-
-        #endregion
-
-        #region Private helper methods
-
-        private static bool IsValidCodePoint(int codePoint)
-        {
-            return codePoint >= MIN_CODE_POINT && codePoint <= MAX_CODE_POINT;
-        }
-
-        #endregion
-    }
-}

+ 0 - 51
Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/RandomExtensions.cs

@@ -1,51 +0,0 @@
-using System;
-
-namespace NLangDetect.Core.Extensions
-{
-    public static class RandomExtensions
-    {
-        private const double _Epsilon = 2.22044604925031E-15;
-
-        private static readonly object _mutex = new object();
-
-        private static double _nextNextGaussian;
-        private static bool _hasNextNextGaussian;
-
-        /// <summary>
-        /// Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.
-        /// The general contract of nextGaussian is that one double value, chosen from (approximately) the usual normal distribution with mean 0.0 and standard deviation 1.0, is pseudorandomly generated and returned.
-        /// </summary>
-        /// <remarks>
-        /// Taken from: http://download.oracle.com/javase/6/docs/api/java/util/Random.html (nextGaussian())
-        /// </remarks>
-        public static double NextGaussian(this Random random)
-        {
-            lock (_mutex)
-            {
-                if (_hasNextNextGaussian)
-                {
-                    _hasNextNextGaussian = false;
-
-                    return _nextNextGaussian;
-                }
-
-                double v1, v2, s;
-
-                do
-                {
-                    v1 = 2.0 * random.NextDouble() - 1.0; // between -1.0 and 1.0
-                    v2 = 2.0 * random.NextDouble() - 1.0; // between -1.0 and 1.0
-                    s = v1 * v1 + v2 * v2;
-                }
-                while (s >= 1.0 || Math.Abs(s - 0.0) < _Epsilon);
-
-                double multiplier = Math.Sqrt(-2.0 * Math.Log(s) / s);
-
-                _nextNextGaussian = v2 * multiplier;
-                _hasNextNextGaussian = true;
-
-                return v1 * multiplier;
-            }
-        }
-    }
-}

+ 0 - 25
Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/StringExtensions.cs

@@ -1,25 +0,0 @@
-using System;
-
-namespace NLangDetect.Core.Extensions
-{
-    public static class StringExtensions
-    {
-        /// <summary>
-        /// Returns a new character sequence that is a subsequence of this sequence. The subsequence starts with the character at the specified index and ends with the character at index end - 1. The length of the returned sequence is end - start, so if start == end then an empty sequence is returned.
-        /// </summary>
-        /// <param name="s"></param>
-        /// <param name="start">the start index, inclusive</param>
-        /// <param name="end">the end index, exclusive</param>
-        /// <returns>the specified subsequence</returns>
-        /// <exception cref="IndexOutOfRangeException"> if start or end are negative, if end is greater than length(), or if start is greater than end</exception>
-        public static string SubSequence(this string s, int start, int end)
-        {
-            if (start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Argument must not be negative.");
-            if (end < 0) throw new ArgumentOutOfRangeException(nameof(end), "Argument must not be negative.");
-            if (end > s.Length) throw new ArgumentOutOfRangeException(nameof(end), "Argument must not be greater than the input string's length.");
-            if (start > end) throw new ArgumentOutOfRangeException(nameof(start), "Argument must not be greater than the 'end' argument.");
-
-            return s.Substring(start, end - start);
-        }
-    }
-}

+ 0 - 131
Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/UnicodeBlock.cs

@@ -1,131 +0,0 @@
-namespace NLangDetect.Core.Extensions
-{
-    public enum UnicodeBlock
-    {
-        BasicLatin,
-        Latin1Supplement,
-        LatinExtendedA,
-        LatinExtendedB,
-        IpaExtensions,
-        SpacingModifierLetters,
-        CombiningDiacriticalMarks,
-        Greek,
-        Cyrillic,
-        CyrillicSupplementary,
-        Armenian,
-        Hebrew,
-        Arabic,
-        Syriac,
-        Thaana,
-        Devanagari,
-        Bengali,
-        Gurmukhi,
-        Gujarati,
-        Oriya,
-        Tamil,
-        Telugu,
-        Kannada,
-        Malayalam,
-        Sinhala,
-        Thai,
-        Lao,
-        Tibetan,
-        Myanmar,
-        Georgian,
-        HangulJamo,
-        Ethiopic,
-        Cherokee,
-        UnifiedCanadianAboriginalSyllabics,
-        Ogham,
-        Runic,
-        Tagalog,
-        Hanunoo,
-        Buhid,
-        Tagbanwa,
-        Khmer,
-        Mongolian,
-        Limbu,
-        TaiLe,
-        KhmerSymbols,
-        PhoneticExtensions,
-        LatinExtendedAdditional,
-        GreekExtended,
-        GeneralPunctuation,
-        SuperscriptsAndSubscripts,
-        CurrencySymbols,
-        CombiningMarksForSymbols,
-        LetterlikeSymbols,
-        NumberForms,
-        Arrows,
-        MathematicalOperators,
-        MiscellaneousTechnical,
-        ControlPictures,
-        OpticalCharacterRecognition,
-        EnclosedAlphanumerics,
-        BoxDrawing,
-        BlockElements,
-        GeometricShapes,
-        MiscellaneousSymbols,
-        Dingbats,
-        MiscellaneousMathematicalSymbolsA,
-        SupplementalArrowsA,
-        BraillePatterns,
-        SupplementalArrowsB,
-        MiscellaneousMathematicalSymbolsB,
-        SupplementalMathematicalOperators,
-        MiscellaneousSymbolsAndArrows,
-        CjkRadicalsSupplement,
-        KangxiRadicals,
-        IdeographicDescriptionCharacters,
-        CjkSymbolsAndPunctuation,
-        Hiragana,
-        Katakana,
-        Bopomofo,
-        HangulCompatibilityJamo,
-        Kanbun,
-        BopomofoExtended,
-        KatakanaPhoneticExtensions,
-        EnclosedCjkLettersAndMonths,
-        CjkCompatibility,
-        CjkUnifiedIdeographsExtensionA,
-        YijingHexagramSymbols,
-        CjkUnifiedIdeographs,
-        YiSyllables,
-        YiRadicals,
-        HangulSyllables,
-        HighSurrogates,
-        HighPrivateUseSurrogates,
-        LowSurrogates,
-        PrivateUseArea,
-        CjkCompatibilityIdeographs,
-        AlphabeticPresentationForms,
-        ArabicPresentationFormsA,
-        VariationSelectors,
-        CombiningHalfMarks,
-        CjkCompatibilityForms,
-        SmallFormVariants,
-        ArabicPresentationFormsB,
-        HalfwidthAndFullwidthForms,
-        Specials,
-        LinearBSyllabary,
-        LinearBIdeograms,
-        AegeanNumbers,
-        OldItalic,
-        Gothic,
-        Ugaritic,
-        Deseret,
-        Shavian,
-        Osmanya,
-        CypriotSyllabary,
-        ByzantineMusicalSymbols,
-        MusicalSymbols,
-        TaiXuanJingSymbols,
-        MathematicalAlphanumericSymbols,
-        CjkUnifiedIdeographsExtensionB,
-        CjkCompatibilityIdeographsSupplement,
-        Tags,
-        VariationSelectorsSupplement,
-        SupplementaryPrivateUseAreaA,
-        SupplementaryPrivateUseAreaB,
-    }
-}

+ 0 - 67
Emby.Server.Implementations/TextEncoding/NLangDetect/GenProfile.cs

@@ -1,67 +0,0 @@
-using System;
-using System.IO;
-using System.IO.Compression;
-using System.Xml;
-using NLangDetect.Core.Utils;
-
-namespace NLangDetect.Core
-{
-    // TODO IMM HI: xml reader not tested
-    public static class GenProfile
-    {
-        #region Public methods
-
-        public static LangProfile load(string lang, string file)
-        {
-            var profile = new LangProfile(lang);
-            var tagextractor = new TagExtractor("abstract", 100);
-            Stream inputStream = null;
-
-            try
-            {
-                inputStream = File.OpenRead(file);
-
-                string extension = Path.GetExtension(file) ?? "";
-
-                if (extension.ToUpper() == ".GZ")
-                {
-                    inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
-                }
-
-                using (var xmlReader = XmlReader.Create(inputStream))
-                {
-                    while (xmlReader.Read())
-                    {
-                        switch (xmlReader.NodeType)
-                        {
-                            case XmlNodeType.Element:
-                                tagextractor.SetTag(xmlReader.Name);
-                                break;
-
-                            case XmlNodeType.Text:
-                                tagextractor.Add(xmlReader.Value);
-                                break;
-
-                            case XmlNodeType.EndElement:
-                                tagextractor.CloseTag(profile);
-                                break;
-                        }
-                    }
-                }
-            }
-            finally
-            {
-                if (inputStream != null)
-                {
-                    inputStream.Close();
-                }
-            }
-
-            Console.WriteLine(lang + ": " + tagextractor.Count);
-
-            return profile;
-        }
-
-        #endregion
-    }
-}

+ 0 - 22
Emby.Server.Implementations/TextEncoding/NLangDetect/InternalException.cs

@@ -1,22 +0,0 @@
-using System;
-
-namespace NLangDetect.Core
-{
-    [Serializable]
-    public class InternalException : Exception
-    {
-        #region Constructor(s)
-
-        public InternalException(string message, Exception innerException)
-          : base(message, innerException)
-        {
-        }
-
-        public InternalException(string message)
-          : this(message, null)
-        {
-        }
-
-        #endregion
-    }
-}

+ 0 - 45
Emby.Server.Implementations/TextEncoding/NLangDetect/Language.cs

@@ -1,45 +0,0 @@
-using System.Globalization;
-
-namespace NLangDetect.Core
-{
-    // TODO IMM HI: name??
-    public class Language
-    {
-        #region Constructor(s)
-
-        public Language(string name, double probability)
-        {
-            Name = name;
-            Probability = probability;
-        }
-
-        #endregion
-
-        #region Object overrides
-
-        public override string ToString()
-        {
-            if (Name == null)
-            {
-                return "";
-            }
-
-            return
-              string.Format(
-                CultureInfo.InvariantCulture.NumberFormat,
-                "{0}:{1:0.000000}",
-                Name,
-                Probability);
-        }
-
-        #endregion
-
-        #region Properties
-
-        public string Name { get; set; }
-
-        public double Probability { get; set; }
-
-        #endregion
-    }
-}

+ 0 - 37
Emby.Server.Implementations/TextEncoding/NLangDetect/LanguageDetector.cs

@@ -1,37 +0,0 @@
-using System;
-using MediaBrowser.Model.Serialization;
-
-namespace NLangDetect.Core
-{
-    // TODO IMM HI: change to non-static class
-    // TODO IMM HI: hide other, unnecassary classes via internal?
-    public static class LanguageDetector
-    {
-        private const double _DefaultAlpha = 0.5;
-
-        #region Public methods
-
-        public static void Initialize(IJsonSerializer json)
-        {
-            DetectorFactory.LoadProfiles(json);
-        }
-
-        public static void Release()
-        {
-            DetectorFactory.Clear();
-        }
-
-        public static string DetectLanguage(string plainText)
-        {
-            if (string.IsNullOrEmpty(plainText)) { throw new ArgumentException("Argument can't be null nor empty.", nameof(plainText)); }
-
-            var detector = DetectorFactory.Create(_DefaultAlpha);
-
-            detector.Append(plainText);
-
-            return detector.Detect();
-        }
-
-        #endregion
-    }
-}

+ 0 - 23
Emby.Server.Implementations/TextEncoding/NLangDetect/NLangDetectException.cs

@@ -1,23 +0,0 @@
-using System;
-
-namespace NLangDetect.Core
-{
-    public class NLangDetectException : Exception
-    {
-        #region Constructor(s)
-
-        public NLangDetectException(string message, ErrorCode errorCode)
-          : base(message)
-        {
-            ErrorCode = errorCode;
-        }
-
-        #endregion
-
-        #region Properties
-
-        public ErrorCode ErrorCode { get; private set; }
-
-        #endregion
-    }
-}

+ 0 - 33
Emby.Server.Implementations/TextEncoding/NLangDetect/ProbVector.cs

@@ -1,33 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace NLangDetect.Core
-{
-    public class ProbVector
-    {
-        private readonly Dictionary<int, double> _dict = new Dictionary<int, double>();
-
-        public double this[int key]
-        {
-            get
-            {
-                return _dict.TryGetValue(key, out var value) ? value : 0.0;
-            }
-
-            set
-            {
-                if (Math.Abs(value) < double.Epsilon)
-                {
-                    if (_dict.ContainsKey(key))
-                    {
-                        _dict.Remove(key);
-                    }
-
-                    return;
-                }
-
-                _dict[key] = value;
-            }
-        }
-    }
-}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/afr


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ara


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ben


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/bul


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ces


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/dan


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/deu


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ell


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/eng


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/est


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/fas


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/fin


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/fra


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/guj


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/heb


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/hin


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/hrv


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/hun


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ind


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ita


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/jpn


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/kan


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/kor


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/lav


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/lit


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/mal


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/mar


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/mkd


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/nep


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/nld


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/nor


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/pan


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/pol


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/por


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/ron


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/rus


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/slk


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/slv


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/som


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Emby.Server.Implementations/TextEncoding/NLangDetect/Profiles/spa


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä