MacAppHost.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Reflection;
  4. using Emby.Server.Core;
  5. using Emby.Server.Implementations;
  6. using Emby.Server.Implementations.FFMpeg;
  7. using MediaBrowser.Model.IO;
  8. using MediaBrowser.Model.Logging;
  9. using MediaBrowser.Model.System;
  10. using Emby.Server.Mac.Native;
  11. using System.Diagnostics;
  12. using MediaBrowser.Controller.Connect;
  13. using Emby.Server.Connect;
  14. using Emby.Server.Sync;
  15. using MediaBrowser.Controller.Sync;
  16. namespace MediaBrowser.Server.Mac
  17. {
  18. public class MacAppHost : ApplicationHost
  19. {
  20. 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)
  21. {
  22. }
  23. public override bool CanSelfRestart
  24. {
  25. get
  26. {
  27. return true;
  28. }
  29. }
  30. public override bool CanSelfUpdate
  31. {
  32. get
  33. {
  34. return false;
  35. }
  36. }
  37. protected override bool SupportsDualModeSockets
  38. {
  39. get
  40. {
  41. return true;
  42. }
  43. }
  44. protected override IConnectManager CreateConnectManager()
  45. {
  46. return new ConnectManager();
  47. }
  48. protected override ISyncManager CreateSyncManager()
  49. {
  50. return new SyncManager();
  51. }
  52. protected override FFMpegInstallInfo GetFfmpegInstallInfo()
  53. {
  54. var info = new FFMpegInstallInfo();
  55. info.ArchiveType = "7z";
  56. switch (EnvironmentInfo.SystemArchitecture)
  57. {
  58. case Architecture.X64:
  59. info.Version = "20160124";
  60. break;
  61. case Architecture.X86:
  62. info.Version = "20150110";
  63. break;
  64. }
  65. info.DownloadUrls = GetDownloadUrls();
  66. return info;
  67. }
  68. private string[] GetDownloadUrls()
  69. {
  70. switch (EnvironmentInfo.SystemArchitecture)
  71. {
  72. case Architecture.X64:
  73. return new[]
  74. {
  75. "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.5.7z"
  76. };
  77. }
  78. // No version available
  79. return new string[] { };
  80. }
  81. protected override void RestartInternal()
  82. {
  83. MainClass.Restart();
  84. }
  85. protected override List<Assembly> GetAssembliesWithPartsInternal()
  86. {
  87. var list = new List<Assembly>();
  88. list.Add(GetType().Assembly);
  89. list.Add(typeof(ConnectManager).Assembly);
  90. list.Add(typeof(SyncManager).Assembly);
  91. return list;
  92. }
  93. protected override void ShutdownInternal()
  94. {
  95. MainClass.Shutdown();
  96. }
  97. protected override void AuthorizeServer()
  98. {
  99. throw new NotImplementedException();
  100. }
  101. protected override void ConfigureAutoRunInternal(bool autorun)
  102. {
  103. throw new NotImplementedException();
  104. }
  105. protected override void EnableLoopbackInternal(string appName)
  106. {
  107. }
  108. public override bool SupportsRunningAsService
  109. {
  110. get
  111. {
  112. return false;
  113. }
  114. }
  115. public override bool SupportsAutoRunAtStartup
  116. {
  117. get { return false; }
  118. }
  119. public override bool IsRunningAsService
  120. {
  121. get
  122. {
  123. return false;
  124. }
  125. }
  126. }
  127. }