2016-11-13 23:01:03 -05:00
|
|
|
|
using System;
|
2016-11-13 23:08:26 -05:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using Emby.Server.Core;
|
2016-11-19 13:20:26 -05:00
|
|
|
|
using Emby.Server.Implementations;
|
|
|
|
|
using Emby.Server.Implementations.FFMpeg;
|
2016-11-13 23:08:26 -05:00
|
|
|
|
using MediaBrowser.Model.IO;
|
|
|
|
|
using MediaBrowser.Model.Logging;
|
|
|
|
|
using MediaBrowser.Model.System;
|
2016-11-14 00:41:57 -05:00
|
|
|
|
using Emby.Server.Mac.Native;
|
2016-11-13 23:08:26 -05:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
2016-11-13 23:01:03 -05:00
|
|
|
|
namespace MediaBrowser.Server.Mac
|
|
|
|
|
{
|
2016-11-13 23:50:23 -05:00
|
|
|
|
public class MacAppHost : ApplicationHost
|
2016-11-13 23:01:03 -05:00
|
|
|
|
{
|
2016-11-13 23:08:26 -05:00
|
|
|
|
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
|
|
|
|
|
{
|
2016-11-28 14:42:13 -05:00
|
|
|
|
return true;
|
2016-11-13 23:08:26 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool CanSelfUpdate
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-20 15:46:18 -05:00
|
|
|
|
protected override bool SupportsDualModeSockets
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-13 23:08:26 -05:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-14 01:00:53 -05:00
|
|
|
|
info.DownloadUrls = GetDownloadUrls();
|
2016-11-13 23:08:26 -05:00
|
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-13 23:50:23 -05:00
|
|
|
|
private string[] GetDownloadUrls()
|
2016-11-13 23:08:26 -05:00
|
|
|
|
{
|
|
|
|
|
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()
|
|
|
|
|
{
|
2016-11-14 01:00:53 -05:00
|
|
|
|
MainClass.Restart();
|
2016-11-13 23:08:26 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 void ConfigureAutoRunInternal(bool autorun)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-11-13 23:01:03 -05:00
|
|
|
|
}
|