From 0840bb9ba246d928161516e65a7b12e7ed08701b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 27 Dec 2014 13:06:32 -0500 Subject: [PATCH] move web socket classes to server project --- MediaBrowser.Common/MediaBrowser.Common.csproj | 4 ---- MediaBrowser.Common/Plugins/BasePlugin.cs | 1 - MediaBrowser.Controller/Entities/IHasMediaSources.cs | 4 ++-- .../MediaBrowser.Controller.csproj | 4 ++++ .../MediaEncoding/MediaStreamSelector.cs | 12 +++++------- .../Net/IWebSocket.cs | 2 +- .../Net/IWebSocketConnection.cs | 5 +++-- .../Net/WebSocketConnectEventArgs.cs | 2 +- .../Net/WebSocketMessageInfo.cs | 2 +- MediaBrowser.Dlna/Main/DlnaEntryPoint.cs | 1 + .../Connect/ConnectEntryPoint.cs | 1 + .../EntryPoints/UdpServerEntryPoint.cs | 1 + .../EntryPoints/UsageEntryPoint.cs | 1 + .../EntryPoints/UsageReporter.cs | 1 + .../HttpServer/IHttpListener.cs | 1 + .../HttpServer/NativeWebSocket.cs | 1 + .../HttpServer/NetListener/HttpListenerServer.cs | 1 + .../HttpServer/SocketSharp/SharpWebSocket.cs | 1 + .../HttpServer/SocketSharp/WebSocketSharpListener.cs | 1 + .../ServerManager/WebSocketConnection.cs | 1 + .../Session/WebSocketController.cs | 1 + MediaBrowser.Server.Implementations/Udp/UdpServer.cs | 1 + MediaBrowser.Server.Mono/Native/BaseMonoApp.cs | 1 + .../Networking/NetworkManager.cs | 1 + MediaBrowser.Server.Startup.Common/INativeApp.cs | 1 + MediaBrowser.ServerApplication/Native/WindowsApp.cs | 1 + .../Networking/NetworkManager.cs | 1 + 27 files changed, 35 insertions(+), 19 deletions(-) rename {MediaBrowser.Common => MediaBrowser.Controller}/Net/IWebSocket.cs (97%) rename {MediaBrowser.Common => MediaBrowser.Controller}/Net/IWebSocketConnection.cs (95%) rename {MediaBrowser.Common => MediaBrowser.Controller}/Net/WebSocketConnectEventArgs.cs (93%) rename {MediaBrowser.Common => MediaBrowser.Controller}/Net/WebSocketMessageInfo.cs (90%) diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index b4cc17f51..c46dd4a4f 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -69,10 +69,6 @@ - - - - diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs index ce068463e..9d0133c67 100644 --- a/MediaBrowser.Common/Plugins/BasePlugin.cs +++ b/MediaBrowser.Common/Plugins/BasePlugin.cs @@ -5,7 +5,6 @@ using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; -using System.Threading; namespace MediaBrowser.Common.Plugins { diff --git a/MediaBrowser.Controller/Entities/IHasMediaSources.cs b/MediaBrowser.Controller/Entities/IHasMediaSources.cs index d487362f5..98d268298 100644 --- a/MediaBrowser.Controller/Entities/IHasMediaSources.cs +++ b/MediaBrowser.Controller/Entities/IHasMediaSources.cs @@ -49,8 +49,8 @@ namespace MediaBrowser.Controller.Entities : new[] { user.Configuration.AudioLanguagePreference }; var preferredSubs = string.IsNullOrEmpty(user.Configuration.SubtitleLanguagePreference) - ? new string[] { } - : new[] { user.Configuration.SubtitleLanguagePreference }; + ? new List { } + : new List { user.Configuration.SubtitleLanguagePreference }; foreach (var source in sources) { diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 21ae6bf61..3ed87ced8 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -219,11 +219,15 @@ + + + + diff --git a/MediaBrowser.Controller/MediaEncoding/MediaStreamSelector.cs b/MediaBrowser.Controller/MediaEncoding/MediaStreamSelector.cs index 58a68c257..4a807df7a 100644 --- a/MediaBrowser.Controller/MediaEncoding/MediaStreamSelector.cs +++ b/MediaBrowser.Controller/MediaEncoding/MediaStreamSelector.cs @@ -34,15 +34,13 @@ namespace MediaBrowser.Controller.MediaEncoding } public static int? GetDefaultSubtitleStreamIndex(List streams, - IEnumerable preferredLanguages, + List preferredLanguages, SubtitlePlaybackMode mode, string audioTrackLanguage) { - var languages = preferredLanguages.ToList(); - streams = GetSortedStreams(streams, MediaStreamType.Subtitle, languages).ToList(); + streams = GetSortedStreams(streams, MediaStreamType.Subtitle, preferredLanguages).ToList(); var full = streams.Where(s => !s.IsForced); - var forced = streams.Where(s => s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase)); MediaStream stream = null; @@ -54,9 +52,9 @@ namespace MediaBrowser.Controller.MediaEncoding if (mode == SubtitlePlaybackMode.Default) { // if the audio language is not understood by the user, load their preferred subs, if there are any - if (!ContainsOrdinal(languages, audioTrackLanguage)) + if (!ContainsOrdinal(preferredLanguages, audioTrackLanguage)) { - stream = full.FirstOrDefault(s => ContainsOrdinal(languages, s.Language)); + stream = full.FirstOrDefault(s => ContainsOrdinal(preferredLanguages, s.Language)); } } else if (mode == SubtitlePlaybackMode.Always) @@ -66,7 +64,7 @@ namespace MediaBrowser.Controller.MediaEncoding } // load forced subs if we have found no suitable full subtitles - stream = stream ?? forced.FirstOrDefault(); + stream = stream ?? streams.FirstOrDefault(s => s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase)); if (stream != null) { diff --git a/MediaBrowser.Common/Net/IWebSocket.cs b/MediaBrowser.Controller/Net/IWebSocket.cs similarity index 97% rename from MediaBrowser.Common/Net/IWebSocket.cs rename to MediaBrowser.Controller/Net/IWebSocket.cs index b31a95319..b88f2c389 100644 --- a/MediaBrowser.Common/Net/IWebSocket.cs +++ b/MediaBrowser.Controller/Net/IWebSocket.cs @@ -3,7 +3,7 @@ using System; using System.Threading; using System.Threading.Tasks; -namespace MediaBrowser.Common.Net +namespace MediaBrowser.Controller.Net { /// /// Interface IWebSocket diff --git a/MediaBrowser.Common/Net/IWebSocketConnection.cs b/MediaBrowser.Controller/Net/IWebSocketConnection.cs similarity index 95% rename from MediaBrowser.Common/Net/IWebSocketConnection.cs rename to MediaBrowser.Controller/Net/IWebSocketConnection.cs index b7715e20b..83ead5a12 100644 --- a/MediaBrowser.Common/Net/IWebSocketConnection.cs +++ b/MediaBrowser.Controller/Net/IWebSocketConnection.cs @@ -1,9 +1,10 @@ -using MediaBrowser.Model.Net; +using MediaBrowser.Common.Net; +using MediaBrowser.Model.Net; using System; using System.Threading; using System.Threading.Tasks; -namespace MediaBrowser.Common.Net +namespace MediaBrowser.Controller.Net { public interface IWebSocketConnection : IDisposable { diff --git a/MediaBrowser.Common/Net/WebSocketConnectEventArgs.cs b/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs similarity index 93% rename from MediaBrowser.Common/Net/WebSocketConnectEventArgs.cs rename to MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs index ce22c9520..394fcd92f 100644 --- a/MediaBrowser.Common/Net/WebSocketConnectEventArgs.cs +++ b/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs @@ -1,6 +1,6 @@ using System; -namespace MediaBrowser.Common.Net +namespace MediaBrowser.Controller.Net { /// /// Class WebSocketConnectEventArgs diff --git a/MediaBrowser.Common/Net/WebSocketMessageInfo.cs b/MediaBrowser.Controller/Net/WebSocketMessageInfo.cs similarity index 90% rename from MediaBrowser.Common/Net/WebSocketMessageInfo.cs rename to MediaBrowser.Controller/Net/WebSocketMessageInfo.cs index c1f935a7b..332f16420 100644 --- a/MediaBrowser.Common/Net/WebSocketMessageInfo.cs +++ b/MediaBrowser.Controller/Net/WebSocketMessageInfo.cs @@ -1,6 +1,6 @@ using MediaBrowser.Model.Net; -namespace MediaBrowser.Common.Net +namespace MediaBrowser.Controller.Net { /// /// Class WebSocketMessageInfo diff --git a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs index 810b1e568..dc4aff190 100644 --- a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs +++ b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs @@ -7,6 +7,7 @@ using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; +using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Session; diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs index 52ec5c9b1..5acec2d6b 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Connect; +using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Plugins; using MediaBrowser.Model.Logging; using System; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs b/MediaBrowser.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs index 386c16513..d97ccb9bd 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs @@ -1,5 +1,6 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller; +using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Plugins; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs b/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs index de53201c9..098a1d2bd 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs @@ -2,6 +2,7 @@ using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Implementations.Security; using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Session; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs b/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs index 36ba55828..940be6d02 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Net; namespace MediaBrowser.Server.Implementations.EntryPoints { diff --git a/MediaBrowser.Server.Implementations/HttpServer/IHttpListener.cs b/MediaBrowser.Server.Implementations/HttpServer/IHttpListener.cs index 86e8856cf..dfde34e25 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/IHttpListener.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/IHttpListener.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using ServiceStack.Web; using System; using System.Collections.Generic; diff --git a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs b/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs index 8cc614fe5..f8e8bb9dd 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs @@ -1,6 +1,7 @@ using System.Text; using MediaBrowser.Common.Events; using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.Logging; using System; using System.Net.WebSockets; diff --git a/MediaBrowser.Server.Implementations/HttpServer/NetListener/HttpListenerServer.cs b/MediaBrowser.Server.Implementations/HttpServer/NetListener/HttpListenerServer.cs index 2d41cc26f..9635854d4 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/NetListener/HttpListenerServer.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/NetListener/HttpListenerServer.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.Logging; using ServiceStack; using ServiceStack.Host.HttpListener; diff --git a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs index 7ff3a1247..354b1e20f 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs @@ -1,6 +1,7 @@ using System.Text; using MediaBrowser.Common.Events; using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.Logging; using System; using System.Threading; diff --git a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs index 9deb34e91..ffaecc0d5 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.Logging; using ServiceStack; using ServiceStack.Web; diff --git a/MediaBrowser.Server.Implementations/ServerManager/WebSocketConnection.cs b/MediaBrowser.Server.Implementations/ServerManager/WebSocketConnection.cs index 3c3d7740a..a8950da89 100644 --- a/MediaBrowser.Server.Implementations/ServerManager/WebSocketConnection.cs +++ b/MediaBrowser.Server.Implementations/ServerManager/WebSocketConnection.cs @@ -1,5 +1,6 @@ using MediaBrowser.Common.Events; using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Net; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs index 0756aa1ec..0788ed2ce 100644 --- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs +++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Session; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.Server.Implementations/Udp/UdpServer.cs b/MediaBrowser.Server.Implementations/Udp/UdpServer.cs index 91a4940ae..d80e0b66e 100644 --- a/MediaBrowser.Server.Implementations/Udp/UdpServer.cs +++ b/MediaBrowser.Server.Implementations/Udp/UdpServer.cs @@ -1,5 +1,6 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.ApiClient; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs index 39d2d52d7..227c32242 100644 --- a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs +++ b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.IsoMounter; using MediaBrowser.Model.Logging; using MediaBrowser.Server.Mono.Networking; diff --git a/MediaBrowser.Server.Mono/Networking/NetworkManager.cs b/MediaBrowser.Server.Mono/Networking/NetworkManager.cs index 60c250115..d76a7c7ee 100644 --- a/MediaBrowser.Server.Mono/Networking/NetworkManager.cs +++ b/MediaBrowser.Server.Mono/Networking/NetworkManager.cs @@ -1,5 +1,6 @@ using MediaBrowser.Common.Implementations.Networking; using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Net; diff --git a/MediaBrowser.Server.Startup.Common/INativeApp.cs b/MediaBrowser.Server.Startup.Common/INativeApp.cs index 5042e1cea..cf0135fa8 100644 --- a/MediaBrowser.Server.Startup.Common/INativeApp.cs +++ b/MediaBrowser.Server.Startup.Common/INativeApp.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.Logging; using System.Collections.Generic; using System.Reflection; diff --git a/MediaBrowser.ServerApplication/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.cs index 9a37c268c..071216418 100644 --- a/MediaBrowser.ServerApplication/Native/WindowsApp.cs +++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.IsoMounter; using MediaBrowser.Model.Logging; using MediaBrowser.Server.Startup.Common; diff --git a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs index fc4d26363..4dbe0f347 100644 --- a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs +++ b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs @@ -1,5 +1,6 @@ using MediaBrowser.Common.Implementations.Networking; using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Net;