2014-11-23 23:10:41 +00:00
|
|
|
|
using MediaBrowser.Common.Net;
|
|
|
|
|
using MediaBrowser.IsoMounter;
|
|
|
|
|
using MediaBrowser.Model.Logging;
|
|
|
|
|
using MediaBrowser.Server.Startup.Common;
|
|
|
|
|
using Mono.Unix.Native;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text.RegularExpressions;
|
2016-11-11 07:24:36 +00:00
|
|
|
|
using Emby.Common.Implementations.Networking;
|
2016-11-11 05:23:15 +00:00
|
|
|
|
using Emby.Server.Core;
|
2016-11-11 06:43:42 +00:00
|
|
|
|
using Emby.Server.Core.Data;
|
|
|
|
|
using Emby.Server.Core.FFMpeg;
|
2016-06-23 17:04:18 +00:00
|
|
|
|
using MediaBrowser.Model.System;
|
2014-11-23 23:10:41 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Server.Mono.Native
|
|
|
|
|
{
|
2016-11-10 14:41:24 +00:00
|
|
|
|
public class MonoApp : INativeApp
|
2014-11-23 23:10:41 +00:00
|
|
|
|
{
|
2015-10-05 16:05:08 +00:00
|
|
|
|
protected StartupOptions StartupOptions { get; private set; }
|
2016-05-01 21:48:37 +00:00
|
|
|
|
protected ILogger Logger { get; private set; }
|
2016-11-11 08:13:11 +00:00
|
|
|
|
private readonly MonoEnvironmentInfo _environment;
|
2016-05-01 21:48:37 +00:00
|
|
|
|
|
2016-11-11 08:13:11 +00:00
|
|
|
|
public MonoApp(StartupOptions startupOptions, ILogger logger, MonoEnvironmentInfo environment)
|
2015-10-05 16:05:08 +00:00
|
|
|
|
{
|
|
|
|
|
StartupOptions = startupOptions;
|
2016-05-01 21:48:37 +00:00
|
|
|
|
Logger = logger;
|
2016-11-11 08:13:11 +00:00
|
|
|
|
_environment = environment;
|
2015-10-05 16:05:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-23 23:10:41 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Shutdowns this instance.
|
|
|
|
|
/// </summary>
|
2016-11-10 14:41:24 +00:00
|
|
|
|
public void Shutdown()
|
2014-11-23 23:10:41 +00:00
|
|
|
|
{
|
2016-11-10 14:41:24 +00:00
|
|
|
|
MainClass.Shutdown();
|
2014-11-23 23:10:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Determines whether this instance [can self restart].
|
|
|
|
|
/// </summary>
|
2016-11-10 14:41:24 +00:00
|
|
|
|
/// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>
|
|
|
|
|
public bool CanSelfRestart
|
2014-11-23 23:10:41 +00:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-11-10 14:41:24 +00:00
|
|
|
|
// A restart script must be provided
|
|
|
|
|
return StartupOptions.ContainsOption("-restartpath");
|
2014-11-23 23:10:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-10 14:41:24 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Restarts this instance.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Restart(StartupOptions startupOptions)
|
|
|
|
|
{
|
|
|
|
|
MainClass.Restart(startupOptions);
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-23 23:10:41 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a value indicating whether this instance can self update.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
|
|
|
|
public bool CanSelfUpdate
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool SupportsAutoRunAtStartup
|
|
|
|
|
{
|
|
|
|
|
get { return false; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Assembly> GetAssembliesWithParts()
|
|
|
|
|
{
|
|
|
|
|
var list = new List<Assembly>();
|
|
|
|
|
|
|
|
|
|
list.Add(GetType().Assembly);
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IEnumerable<Assembly> GetLinuxAssemblies()
|
|
|
|
|
{
|
|
|
|
|
var list = new List<Assembly>();
|
|
|
|
|
|
2016-11-11 08:13:11 +00:00
|
|
|
|
//list.Add(typeof(LinuxIsoManager).Assembly);
|
2014-11-23 23:10:41 +00:00
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-26 17:51:27 +00:00
|
|
|
|
public void AuthorizeServer(int udpPort, int httpServerPort, int httpsPort, string applicationPath, string tempDirectory)
|
2014-11-23 23:10:41 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool SupportsRunningAsService
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsRunningAsService
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ConfigureAutoRun(bool autorun)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public INetworkManager CreateNetworkManager(ILogger logger)
|
|
|
|
|
{
|
|
|
|
|
return new NetworkManager(logger);
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-11 08:13:11 +00:00
|
|
|
|
public FFMpegInstallInfo GetFfmpegInstallInfo()
|
2014-11-23 23:10:41 +00:00
|
|
|
|
{
|
2016-11-11 08:13:11 +00:00
|
|
|
|
var info = new FFMpegInstallInfo();
|
2014-11-23 23:10:41 +00:00
|
|
|
|
|
2016-11-11 08:13:11 +00:00
|
|
|
|
// Windows builds: http://ffmpeg.zeranoe.com/builds/
|
|
|
|
|
// Linux builds: http://johnvansickle.com/ffmpeg/
|
|
|
|
|
// OS X builds: http://ffmpegmac.net/
|
|
|
|
|
// OS X x64: http://www.evermeet.cx/ffmpeg/
|
2014-11-23 23:10:41 +00:00
|
|
|
|
|
2016-11-11 08:13:11 +00:00
|
|
|
|
if (_environment.IsBsd)
|
2016-07-05 04:16:03 +00:00
|
|
|
|
{
|
2016-11-11 08:13:11 +00:00
|
|
|
|
|
2016-07-05 04:16:03 +00:00
|
|
|
|
}
|
2016-11-11 08:13:11 +00:00
|
|
|
|
else if (_environment.OperatingSystem == Model.System.OperatingSystem.Linux)
|
2016-07-05 04:16:03 +00:00
|
|
|
|
{
|
2016-11-11 08:13:11 +00:00
|
|
|
|
info.ArchiveType = "7z";
|
|
|
|
|
info.Version = "20160215";
|
2016-07-05 04:16:03 +00:00
|
|
|
|
}
|
2014-11-23 23:10:41 +00:00
|
|
|
|
|
2016-11-11 08:13:11 +00:00
|
|
|
|
// No version available - user requirement
|
|
|
|
|
info.DownloadUrls = new string[] { };
|
2014-11-23 23:10:41 +00:00
|
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-24 03:03:49 +00:00
|
|
|
|
public void LaunchUrl(string url)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-01 21:48:37 +00:00
|
|
|
|
public IDbConnector GetDbConnector()
|
|
|
|
|
{
|
|
|
|
|
return new DbConnector(Logger);
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-03 17:16:36 +00:00
|
|
|
|
public void EnableLoopback(string appName)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2016-01-21 17:29:14 +00:00
|
|
|
|
}
|
2014-11-23 23:10:41 +00:00
|
|
|
|
}
|