diff options
Diffstat (limited to 'MediaBrowser.ServerApplication')
| -rw-r--r-- | MediaBrowser.ServerApplication/App.config | 2 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/MainStartup.cs | 18 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj | 20 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/WindowsAppHost.cs | 110 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/packages.config | 8 |
5 files changed, 41 insertions, 117 deletions
diff --git a/MediaBrowser.ServerApplication/App.config b/MediaBrowser.ServerApplication/App.config index 4bac6bb70..fae013d6e 100644 --- a/MediaBrowser.ServerApplication/App.config +++ b/MediaBrowser.ServerApplication/App.config @@ -49,7 +49,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="SimpleInjector" publicKeyToken="984cb50dea722e99" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-2.3.6.0" newVersion="2.3.6.0" /> + <bindingRedirect oldVersion="0.0.0.0-3.3.2.0" newVersion="3.3.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 70b86c4a6..b41e7607c 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -23,11 +23,14 @@ using Emby.Common.Implementations.Logging; using Emby.Common.Implementations.Networking; using Emby.Common.Implementations.Security; using Emby.Server.Core; +using Emby.Server.Core.Logging; using Emby.Server.Implementations; using Emby.Server.Implementations.Browser; using Emby.Server.Implementations.IO; +using Emby.Server.Implementations.Logging; using ImageMagickSharp; using MediaBrowser.Common.Net; +using MediaBrowser.Model.IO; using MediaBrowser.Server.Startup.Common.IO; namespace MediaBrowser.ServerApplication @@ -47,6 +50,8 @@ namespace MediaBrowser.ServerApplication public static string ApplicationPath; + private static IFileSystem FileSystem; + public static bool TryGetLocalFromUncDirectory(string local, out string unc) { if ((local == null) || (local == "")) @@ -259,16 +264,18 @@ namespace MediaBrowser.ServerApplication var resourcesPath = Path.GetDirectoryName(applicationPath); + Action<string> createDirectoryFn = s => Directory.CreateDirectory(s); + if (runAsService) { var systemPath = Path.GetDirectoryName(applicationPath); var programDataPath = Path.GetDirectoryName(systemPath); - return new ServerApplicationPaths(programDataPath, appFolderPath, resourcesPath); + return new ServerApplicationPaths(programDataPath, appFolderPath, resourcesPath, createDirectoryFn); } - return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), appFolderPath, resourcesPath); + return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), appFolderPath, resourcesPath, createDirectoryFn); } /// <summary> @@ -324,12 +331,14 @@ namespace MediaBrowser.ServerApplication /// <param name="options">The options.</param> private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, bool runService, StartupOptions options) { - var fileSystem = new ManagedFileSystem(logManager.GetLogger("FileSystem"), true, true, true, appPaths.TempDirectory); + var fileSystem = new ManagedFileSystem(logManager.GetLogger("FileSystem"), true, true, false, appPaths.TempDirectory); fileSystem.AddShortcutHandler(new LnkShortcutHandler()); fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem)); var imageEncoder = ImageEncoderHelper.GetImageEncoder(_logger, logManager, fileSystem, options, () => _appHost.HttpClient, appPaths); + FileSystem = fileSystem; + _appHost = new WindowsAppHost(appPaths, logManager, options, @@ -580,7 +589,7 @@ namespace MediaBrowser.ServerApplication { var exception = (Exception)e.ExceptionObject; - new UnhandledExceptionWriter(_appHost.ServerConfigurationManager.ApplicationPaths, _logger, _appHost.LogManager).Log(exception); + new UnhandledExceptionWriter(_appHost.ServerConfigurationManager.ApplicationPaths, _logger, _appHost.LogManager, FileSystem, new ConsoleLogger()).Log(exception); if (!IsRunningAsService) { @@ -676,6 +685,7 @@ namespace MediaBrowser.ServerApplication _appHostDisposed = true; _appHost.Dispose(); + _logger.Info("App host dispose complete"); } } diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 7badccef3..50b0aa21f 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -67,15 +67,21 @@ <Reference Include="Emby.Common.Implementations"> <HintPath>..\ThirdParty\emby\Emby.Common.Implementations.dll</HintPath> </Reference> + <Reference Include="Emby.Server.Connect"> + <HintPath>..\ThirdParty\emby\Emby.Server.Connect.dll</HintPath> + </Reference> <Reference Include="Emby.Server.Core"> <HintPath>..\ThirdParty\emby\Emby.Server.Core.dll</HintPath> </Reference> + <Reference Include="Emby.Server.Sync"> + <HintPath>..\ThirdParty\emby\Emby.Server.Sync.dll</HintPath> + </Reference> <Reference Include="ImageMagickSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\packages\ImageMagickSharp.1.0.0.18\lib\net45\ImageMagickSharp.dll</HintPath> </Reference> <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> - <HintPath>..\packages\NLog.4.4.0-betaV15\lib\net45\NLog.dll</HintPath> + <HintPath>..\packages\NLog.4.4.3\lib\net45\NLog.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="ServiceStack.Text, Version=4.5.4.0, Culture=neutral, processorArchitecture=MSIL"> @@ -86,16 +92,16 @@ <HintPath>..\packages\SharpCompress.0.14.0\lib\net45\SharpCompress.dll</HintPath> <Private>True</Private> </Reference> - <Reference Include="SimpleInjector, Version=3.2.4.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL"> - <HintPath>..\packages\SimpleInjector.3.2.4\lib\net45\SimpleInjector.dll</HintPath> + <Reference Include="SimpleInjector, Version=3.3.2.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL"> + <HintPath>..\packages\SimpleInjector.3.3.2\lib\net45\SimpleInjector.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL"> - <HintPath>..\packages\SQLitePCLRaw.core.1.1.1\lib\net45\SQLitePCLRaw.core.dll</HintPath> + <HintPath>..\packages\SQLitePCLRaw.core.1.1.2\lib\net45\SQLitePCLRaw.core.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="SQLitePCLRaw.provider.sqlite3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=62684c7b4f184e3f, processorArchitecture=MSIL"> - <HintPath>..\packages\SQLitePCLRaw.provider.sqlite3.net45.1.1.1\lib\net45\SQLitePCLRaw.provider.sqlite3.dll</HintPath> + <HintPath>..\packages\SQLitePCLRaw.provider.sqlite3.net45.1.1.2\lib\net45\SQLitePCLRaw.provider.sqlite3.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="System" /> @@ -1155,10 +1161,6 @@ <Project>{21002819-c39a-4d3e-be83-2a276a77fb1f}</Project> <Name>RSSDP</Name> </ProjectReference> - <ProjectReference Include="..\ServiceStack\ServiceStack.csproj"> - <Project>{680a1709-25eb-4d52-a87f-ee03ffd94baa}</Project> - <Name>ServiceStack</Name> - </ProjectReference> <ProjectReference Include="..\SocketHttpListener.Portable\SocketHttpListener.Portable.csproj"> <Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project> <Name>SocketHttpListener.Portable</Name> diff --git a/MediaBrowser.ServerApplication/WindowsAppHost.cs b/MediaBrowser.ServerApplication/WindowsAppHost.cs index ec66923aa..9f11dc322 100644 --- a/MediaBrowser.ServerApplication/WindowsAppHost.cs +++ b/MediaBrowser.ServerApplication/WindowsAppHost.cs @@ -4,10 +4,14 @@ using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.InteropServices.ComTypes; +using Emby.Server.Connect; using Emby.Server.Core; using Emby.Server.Implementations; using Emby.Server.Implementations.EntryPoints; using Emby.Server.Implementations.FFMpeg; +using Emby.Server.Sync; +using MediaBrowser.Controller.Connect; +using MediaBrowser.Controller.Sync; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.System; @@ -27,36 +31,14 @@ namespace MediaBrowser.ServerApplication get { return MainStartup.IsRunningAsService; } } - protected override FFMpegInstallInfo GetFfmpegInstallInfo() + protected override IConnectManager CreateConnectManager() { - var info = new FFMpegInstallInfo(); - - info.FFMpegFilename = "ffmpeg.exe"; - info.FFProbeFilename = "ffprobe.exe"; - info.Version = "20160410"; - info.ArchiveType = "7z"; - info.DownloadUrls = GetDownloadUrls(); - - return info; + return new ConnectManager(); } - private string[] GetDownloadUrls() + protected override ISyncManager CreateSyncManager() { - switch (EnvironmentInfo.SystemArchitecture) - { - case Architecture.X64: - return new[] - { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win64.7z" - }; - case Architecture.X86: - return new[] - { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win32.7z" - }; - } - - return new string[] { }; + return new SyncManager(); } protected override void RestartInternal() @@ -73,6 +55,8 @@ namespace MediaBrowser.ServerApplication //list.Add(typeof(PismoIsoManager).Assembly); } + list.Add(typeof(ConnectManager).Assembly); + list.Add(typeof(SyncManager).Assembly); list.Add(GetType().Assembly); return list; @@ -94,7 +78,7 @@ namespace MediaBrowser.ServerApplication protected override void ConfigureAutoRunInternal(bool autorun) { - var startupPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup); + var startupPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Startup); if (autorun && !MainStartup.IsRunningAsService) { @@ -121,14 +105,6 @@ namespace MediaBrowser.ServerApplication } } - protected override bool SupportsDualModeSockets - { - get - { - return true; - } - } - protected override void EnableLoopbackInternal(string appName) { LoopUtil.Run(appName); @@ -150,14 +126,6 @@ namespace MediaBrowser.ServerApplication } } - public override bool SupportsAutoRunAtStartup - { - get - { - return true; - } - } - public override bool CanSelfUpdate { get @@ -165,61 +133,5 @@ namespace MediaBrowser.ServerApplication return MainStartup.CanSelfUpdate; } } - - public bool PortsRequireAuthorization(string applicationPath) - { - var appNameSrch = Path.GetFileName(applicationPath); - - var startInfo = new ProcessStartInfo - { - FileName = "netsh", - - Arguments = "advfirewall firewall show rule \"" + appNameSrch + "\"", - - CreateNoWindow = true, - UseShellExecute = false, - WindowStyle = ProcessWindowStyle.Hidden, - ErrorDialog = false, - RedirectStandardOutput = true - }; - - using (var process = Process.Start(startInfo)) - { - process.Start(); - - try - { - var data = process.StandardOutput.ReadToEnd() ?? string.Empty; - - if (data.IndexOf("Block", StringComparison.OrdinalIgnoreCase) != -1) - { - Logger.Info("Found potential windows firewall rule blocking Emby Server: " + data); - } - - //var parts = data.Split('\n'); - - //return parts.Length > 4; - //return Confirm(); - return false; - } - catch (Exception ex) - { - Logger.ErrorException("Error querying windows firewall", ex); - - // Hate having to do this - try - { - process.Kill(); - } - catch (Exception ex1) - { - Logger.ErrorException("Error killing process", ex1); - } - - throw; - } - } - } - } } diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index 2cebb9aea..68d0a7fda 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="ImageMagickSharp" version="1.0.0.18" targetFramework="net45" /> - <package id="NLog" version="4.4.0-betaV15" targetFramework="net462" /> + <package id="NLog" version="4.4.3" targetFramework="net462" /> <package id="ServiceStack.Text" version="4.5.4" targetFramework="net462" /> <package id="SharpCompress" version="0.14.0" targetFramework="net462" /> - <package id="SimpleInjector" version="3.2.4" targetFramework="net462" /> - <package id="SQLitePCLRaw.core" version="1.1.1" targetFramework="net462" /> - <package id="SQLitePCLRaw.provider.sqlite3.net45" version="1.1.1" targetFramework="net462" /> + <package id="SimpleInjector" version="3.3.2" targetFramework="net462" /> + <package id="SQLitePCLRaw.core" version="1.1.2" targetFramework="net462" /> + <package id="SQLitePCLRaw.provider.sqlite3.net45" version="1.1.2" targetFramework="net462" /> </packages>
\ No newline at end of file |
