aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Mac/Native/BaseMonoApp.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Mac/Native/BaseMonoApp.cs')
-rw-r--r--MediaBrowser.Server.Mac/Native/BaseMonoApp.cs101
1 files changed, 95 insertions, 6 deletions
diff --git a/MediaBrowser.Server.Mac/Native/BaseMonoApp.cs b/MediaBrowser.Server.Mac/Native/BaseMonoApp.cs
index 33df83b2f..7c9b43026 100644
--- a/MediaBrowser.Server.Mac/Native/BaseMonoApp.cs
+++ b/MediaBrowser.Server.Mac/Native/BaseMonoApp.cs
@@ -7,11 +7,22 @@ using System.Collections.Generic;
using System.Reflection;
using System.Text.RegularExpressions;
using MediaBrowser.Controller.Power;
+using MediaBrowser.Server.Implementations.Persistence;
+using MediaBrowser.Server.Startup.Common.FFMpeg;
+using System.Diagnostics;
+using MediaBrowser.Model.System;
namespace MediaBrowser.Server.Mac
{
public abstract class BaseMonoApp : INativeApp
{
+ protected ILogger Logger { get; private set; }
+
+ protected BaseMonoApp(ILogger logger)
+ {
+ Logger = logger;
+ }
+
/// <summary>
/// Shutdowns this instance.
/// </summary>
@@ -37,6 +48,21 @@ namespace MediaBrowser.Server.Mac
}
}
+ public void PreventSystemStandby()
+ {
+
+ }
+
+ public void AllowSystemStandby()
+ {
+
+ }
+
+ public IDbConnector GetDbConnector()
+ {
+ return new DbConnector(Logger);
+ }
+
public virtual bool SupportsLibraryMonitor
{
get
@@ -62,11 +88,6 @@ namespace MediaBrowser.Server.Mac
get { return false; }
}
- public void PreventSystemStandby()
- {
-
- }
-
public List<Assembly> GetAssembliesWithParts()
{
var list = new List<Assembly>();
@@ -106,6 +127,74 @@ namespace MediaBrowser.Server.Mac
{
}
+ public void LaunchUrl(string url)
+ {
+ var process = new Process
+ {
+ StartInfo = new ProcessStartInfo
+ {
+ FileName = url
+ },
+
+ EnableRaisingEvents = true,
+ };
+
+ process.Exited += ProcessExited;
+
+ process.Start();
+ }
+
+ /// <summary>
+ /// Processes the exited.
+ /// </summary>
+ /// <param name="sender">The sender.</param>
+ /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
+ private static void ProcessExited(object sender, EventArgs e)
+ {
+ ((Process)sender).Dispose();
+ }
+
+ public FFMpegInstallInfo GetFfmpegInstallInfo()
+ {
+ return GetInfo(Environment);
+ }
+
+ public static FFMpegInstallInfo GetInfo(NativeEnvironment environment)
+ {
+ var info = new FFMpegInstallInfo();
+
+ info.ArchiveType = "7z";
+
+ switch (environment.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 (environment.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[] { };
+ }
+
public INetworkManager CreateNetworkManager(ILogger logger)
{
return new NetworkManager(logger);
@@ -137,7 +226,7 @@ namespace MediaBrowser.Server.Mac
}
else if (string.Equals(uname.machine, "x86_64", StringComparison.OrdinalIgnoreCase))
{
- info.SystemArchitecture = Architecture.X86_X64;
+ info.SystemArchitecture = Architecture.X64;
}
else if (uname.machine.StartsWith("arm", StringComparison.OrdinalIgnoreCase))
{