aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-13 23:08:26 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-13 23:08:26 -0500
commitdb5008644b7ddd09166b91635040a2c82908b0dc (patch)
tree7b07630f745f78bc6df9bc10eac89bb82232c4f7
parent1ccabf572111232801d47983d4125519bfbb1f30 (diff)
update mac project
-rw-r--r--MediaBrowser.Server.Mac/MacAppHost.cs153
1 files changed, 149 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Mac/MacAppHost.cs b/MediaBrowser.Server.Mac/MacAppHost.cs
index 352cd34bb..c909b3e0f 100644
--- a/MediaBrowser.Server.Mac/MacAppHost.cs
+++ b/MediaBrowser.Server.Mac/MacAppHost.cs
@@ -1,10 +1,155 @@
using System;
+using System.Collections.Generic;
+using System.Reflection;
+using Emby.Server.Core;
+using Emby.Server.Core.Data;
+using Emby.Server.Core.FFMpeg;
+using MediaBrowser.IsoMounter;
+using MediaBrowser.Model.IO;
+using MediaBrowser.Model.Logging;
+using MediaBrowser.Model.System;
+using MediaBrowser.Server.Mono.Native;
+using System.Diagnostics;
+
namespace MediaBrowser.Server.Mac
{
public class MacAppHost
{
- public MacAppHost()
- {
- }
- }
+ public MacAppHost(ServerApplicationPaths applicationPaths, ILogManager logManager, StartupOptions options, IFileSystem fileSystem, IPowerManagement powerManagement, string releaseAssetFilename, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, ISystemEvents systemEvents, IMemoryStreamFactory memoryStreamFactory, MediaBrowser.Common.Net.INetworkManager networkManager, Action<string, string> certificateGenerator, Func<string> defaultUsernameFactory) : base(applicationPaths, logManager, options, fileSystem, powerManagement, releaseAssetFilename, environmentInfo, imageEncoder, systemEvents, memoryStreamFactory, networkManager, certificateGenerator, defaultUsernameFactory)
+ {
+ }
+
+ public override bool CanSelfRestart
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public override bool CanSelfUpdate
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ protected override FFMpegInstallInfo GetFfmpegInstallInfo()
+ {
+ var info = new FFMpegInstallInfo();
+
+ info.ArchiveType = "7z";
+
+ switch (EnvironmentInfo.SystemArchitecture)
+ {
+ case Architecture.X64:
+ info.Version = "20160124";
+ break;
+ case Architecture.X86:
+ info.Version = "20150110";
+ break;
+ }
+
+ info.DownloadUrls = GetDownloadUrls(environment);
+
+ return info;
+ }
+
+ private static string[] GetDownloadUrls(NativeEnvironment environment)
+ {
+ switch (EnvironmentInfo.SystemArchitecture)
+ {
+ case Architecture.X64:
+ return new[]
+ {
+ "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.5.7z"
+ };
+ }
+
+ // No version available
+ return new string[] { };
+ }
+
+ protected override void RestartInternal()
+ {
+ MainClass.Restart(StartupOptions);
+ }
+
+ protected override List<Assembly> GetAssembliesWithPartsInternal()
+ {
+ var list = new List<Assembly>();
+
+ list.Add(GetType().Assembly);
+
+ return list;
+ }
+
+ protected override void ShutdownInternal()
+ {
+ MainClass.Shutdown();
+ }
+
+ protected override void AuthorizeServer()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected override IDbConnector GetDbConnector()
+ {
+ return new DbConnector(Logger);
+ }
+
+ protected override void ConfigureAutoRunInternal(bool autorun)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void LaunchUrl(string url)
+ {
+ var process = new Process
+ {
+ StartInfo = new ProcessStartInfo
+ {
+ FileName = url
+ },
+
+ EnableRaisingEvents = true,
+ };
+
+ process.Exited += ProcessExited;
+
+ process.Start();
+ }
+
+ private static void ProcessExited(object sender, EventArgs e)
+ {
+ ((Process)sender).Dispose();
+ }
+
+ protected override void EnableLoopbackInternal(string appName)
+ {
+ }
+
+ public override bool SupportsRunningAsService
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public override bool SupportsAutoRunAtStartup
+ {
+ get { return false; }
+ }
+
+ public override bool IsRunningAsService
+ {
+ get
+ {
+ return false;
+ }
+ }
+ }
}