diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-10-06 19:58:46 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-10-06 19:58:46 -0400 |
| commit | f02f3222085311b2a2cacab6642ad987a4176e65 (patch) | |
| tree | 9f317e5a3f087d4b4c5e523a8d8552d7d248567e /MediaBrowser.ServerApplication | |
| parent | a9eed234ba2a366fe014f0cc6f462c3764528948 (diff) | |
remove mono compiler directives
Diffstat (limited to 'MediaBrowser.ServerApplication')
9 files changed, 63 insertions, 74 deletions
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 7f975d4d8..f08a7771b 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -222,6 +222,8 @@ namespace MediaBrowser.ServerApplication private readonly StartupOptions _startupOptions; private readonly string _remotePackageName; + private readonly bool _supportsNativeWebSocket; + /// <summary> /// Initializes a new instance of the <see cref="ApplicationHost" /> class. /// </summary> @@ -230,16 +232,21 @@ namespace MediaBrowser.ServerApplication /// <param name="supportsRunningAsService">if set to <c>true</c> [supports running as service].</param> /// <param name="isRunningAsService">if set to <c>true</c> [is running as service].</param> /// <param name="options">The options.</param> + /// <param name="fileSystem">The file system.</param> /// <param name="remotePackageName">Name of the remote package.</param> public ApplicationHost(ServerApplicationPaths applicationPaths, ILogManager logManager, bool supportsRunningAsService, bool isRunningAsService, - StartupOptions options, string remotePackageName) - : base(applicationPaths, logManager) + StartupOptions options, + IFileSystem fileSystem, + string remotePackageName, + bool supportsNativeWebSocket) + : base(applicationPaths, logManager, fileSystem) { _startupOptions = options; _remotePackageName = remotePackageName; + _supportsNativeWebSocket = supportsNativeWebSocket; _isRunningAsService = isRunningAsService; SupportsRunningAsService = supportsRunningAsService; } @@ -433,7 +440,7 @@ namespace MediaBrowser.ServerApplication RegisterSingleInstance<ISearchEngine>(() => new SearchEngine(LogManager, LibraryManager, UserManager)); - HttpServer = ServerFactory.CreateServer(this, LogManager, "Media Browser", WebApplicationName, "dashboard/index.html"); + HttpServer = ServerFactory.CreateServer(this, LogManager, "Media Browser", WebApplicationName, "dashboard/index.html", _supportsNativeWebSocket); RegisterSingleInstance(HttpServer, false); progress.Report(10); @@ -548,11 +555,6 @@ namespace MediaBrowser.ServerApplication return new NetworkManager(logger); } - protected override IFileSystem CreateFileSystemManager() - { - return FileSystemFactory.CreateFileSystemManager(LogManager); - } - /// <summary> /// Registers the media encoder. /// </summary> diff --git a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs index 907067148..01eef25d9 100644 --- a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs +++ b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs @@ -1,9 +1,5 @@ -using System; -#if __MonoCS__ -using Mono.Unix.Native; -using System.Text.RegularExpressions; -using System.IO; -#endif +using Mono.Unix.Native; +using System; using System.IO; using System.Text.RegularExpressions; @@ -33,7 +29,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg switch (arg) { case "Version": - return "20140827"; + return "20141005"; case "FFMpegFilename": return "ffmpeg.exe"; case "FFProbeFilename": @@ -82,7 +78,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg switch (arg) { case "Version": - return "20140506"; + return "20140716"; case "FFMpegFilename": return "ffmpeg"; case "FFProbeFilename": @@ -98,7 +94,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg switch (arg) { case "Version": - return "20140505"; + return "20140716"; case "FFMpegFilename": return "ffmpeg"; case "FFProbeFilename": @@ -138,15 +134,15 @@ namespace MediaBrowser.ServerApplication.FFMpeg { return new[] { - "http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20140827-git-9e8ab36-win64-static.7z", - "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/windows/ffmpeg-20140827-git-9e8ab36-win64-static.7z" + "http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20141005-git-e079d43-win64-static.7z", + "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/windows/ffmpeg-20141005-git-e079d43-win64-static.7z" }; } return new[] { - "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20140827-git-9e8ab36-win32-static.7z", - "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/windows/ffmpeg-20140827-git-9e8ab36-win32-static.7z" + "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20141005-git-e079d43-win32-static.7z", + "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/windows/ffmpeg-20141005-git-e079d43-win32-static.7z" }; case PlatformID.Unix: @@ -173,7 +169,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg return new[] { "http://ffmpeg.gusari.org/static/32bit/ffmpeg.static.32bit.latest.tar.gz", - "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/linux/ffmpeg.static.32bit.2014-05-06.tar.gz" + "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/linux/ffmpeg.static.32bit.2014-07-16.tar.gz" }; } @@ -182,7 +178,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg return new[] { "http://ffmpeg.gusari.org/static/64bit/ffmpeg.static.64bit.latest.tar.gz", - "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/linux/ffmpeg.static.64bit.2014-05-05.tar.gz" + "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/linux/ffmpeg.static.64bit.2014-07-16.tar.gz" }; } @@ -237,16 +233,13 @@ namespace MediaBrowser.ServerApplication.FFMpeg private static Uname GetUnixName() { var uname = new Uname(); - -#if __MonoCS__ - Utsname utsname; - var callResult = Syscall.uname(out utsname); - if (callResult == 0) - { - uname.sysname= utsname.sysname; - uname.machine= utsname.machine; - } -#endif + Utsname utsname; + var callResult = Syscall.uname(out utsname); + if (callResult == 0) + { + uname.sysname = utsname.sysname; + uname.machine = utsname.machine; + } return uname; } } diff --git a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs index 59c2940e6..cc289faf2 100644 --- a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs +++ b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs @@ -1,20 +1,18 @@ -using System.Collections.Generic; -using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Configuration; using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Net; +using MediaBrowser.ServerApplication.IO; +using Mono.Unix.Native; using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; -#if __MonoCS__ -using Mono.Unix.Native; -#endif -using MediaBrowser.ServerApplication.IO; namespace MediaBrowser.ServerApplication.FFMpeg { @@ -228,13 +226,8 @@ namespace MediaBrowser.ServerApplication.FFMpeg })) { File.Copy(file, Path.Combine(targetFolder, Path.GetFileName(file)), true); - #if __MonoCS__ - //Linux: File permission to 666, and user's execute bit - if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX) - { - Syscall.chmod(Path.Combine(targetFolder, Path.GetFileName(file)), FilePermissions.DEFFILEMODE | FilePermissions.S_IXUSR); - } - #endif + + SetFilePermissions(targetFolder, file); } } finally @@ -243,6 +236,15 @@ namespace MediaBrowser.ServerApplication.FFMpeg } } + private void SetFilePermissions(string targetFolder, string file) + { + // Linux: File permission to 666, and user's execute bit + if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX) + { + Syscall.chmod(Path.Combine(targetFolder, Path.GetFileName(file)), FilePermissions.DEFFILEMODE | FilePermissions.S_IXUSR); + } + } + private void ExtractArchive(string archivePath, string targetPath) { _logger.Info("Extracting {0} to {1}", archivePath, targetPath); diff --git a/MediaBrowser.ServerApplication/IO/FileSystemFactory.cs b/MediaBrowser.ServerApplication/IO/FileSystemFactory.cs deleted file mode 100644 index 698c4b616..000000000 --- a/MediaBrowser.ServerApplication/IO/FileSystemFactory.cs +++ /dev/null @@ -1,21 +0,0 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.IO; -using MediaBrowser.Model.Logging; - -namespace MediaBrowser.ServerApplication.IO -{ - /// <summary> - /// Class FileSystemFactory - /// </summary> - public static class FileSystemFactory - { - /// <summary> - /// Creates the file system manager. - /// </summary> - /// <returns>IFileSystem.</returns> - public static IFileSystem CreateFileSystemManager(ILogManager logManager) - { - return new NativeFileSystem(logManager.GetLogger("FileSystem")); - } - } -} diff --git a/MediaBrowser.ServerApplication/IO/NativeFileSystem.cs b/MediaBrowser.ServerApplication/IO/NativeFileSystem.cs index e6a976233..6bdd77ad1 100644 --- a/MediaBrowser.ServerApplication/IO/NativeFileSystem.cs +++ b/MediaBrowser.ServerApplication/IO/NativeFileSystem.cs @@ -10,8 +10,8 @@ namespace MediaBrowser.ServerApplication.IO { public class NativeFileSystem : CommonFileSystem { - public NativeFileSystem(ILogger logger) - : base(logger, true) + public NativeFileSystem(ILogger logger, bool usePresetInvalidFileNameChars) + : base(logger, true, usePresetInvalidFileNameChars) { } diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 15fd7af74..df6fd4746 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -209,7 +209,16 @@ namespace MediaBrowser.ServerApplication /// <param name="options">The options.</param> private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, bool runService, StartupOptions options) { - _appHost = new ApplicationHost(appPaths, logManager, true, runService, options, "MBServer"); + var fileSystem = new NativeFileSystem(logManager.GetLogger("FileSystem"), false); + + _appHost = new ApplicationHost(appPaths, + logManager, + true, + runService, + options, + fileSystem, + "MBServer", + true); var initProgress = new Progress<double>(); diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 33bdea0f6..49eacf46f 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -63,6 +63,10 @@ <Reference Include="MediaBrowser.IsoMounter"> <HintPath>..\packages\MediaBrowser.IsoMounting.3.0.69\lib\net45\MediaBrowser.IsoMounter.dll</HintPath> </Reference> + <Reference Include="Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\packages\Mono.Posix.4.0.0.0\lib\net40\Mono.Posix.dll</HintPath> + </Reference> <Reference Include="NLog, Version=3.1.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\packages\NLog.3.1.0.0\lib\net45\NLog.dll</HintPath> @@ -103,7 +107,6 @@ <Compile Include="FFMpeg\FFMpegDownloader.cs" /> <Compile Include="FFMpeg\FFMpegDownloadInfo.cs" /> <Compile Include="FFMpeg\FFMpegInfo.cs" /> - <Compile Include="IO\FileSystemFactory.cs" /> <Compile Include="IO\NativeFileSystem.cs" /> <Compile Include="IO\StartupOptions.cs" /> <Compile Include="Logging\LogForm.cs"> diff --git a/MediaBrowser.ServerApplication/Native/BrowserLauncher.cs b/MediaBrowser.ServerApplication/Native/BrowserLauncher.cs index c2c64ea4d..310592882 100644 --- a/MediaBrowser.ServerApplication/Native/BrowserLauncher.cs +++ b/MediaBrowser.ServerApplication/Native/BrowserLauncher.cs @@ -116,9 +116,9 @@ namespace MediaBrowser.ServerApplication.Native Console.WriteLine("Error launching browser"); Console.WriteLine(ex.Message); -#if !__MonoCS__ - System.Windows.Forms.MessageBox.Show("There was an error launching your web browser. Please check your default browser settings."); -#endif +//#if !__MonoCS__ +// System.Windows.Forms.MessageBox.Show("There was an error launching your web browser. Please check your default browser settings."); +//#endif } } diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index 8de487fb5..bfff11677 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="MediaBrowser.IsoMounting" version="3.0.69" targetFramework="net45" /> + <package id="Mono.Posix" version="4.0.0.0" targetFramework="net45" /> <package id="NLog" version="3.1.0.0" targetFramework="net45" /> </packages>
\ No newline at end of file |
