Merge pull request #711 from Bond-009/sysevent
Remove remnants of system events
This commit is contained in:
commit
b673054c8d
|
@ -244,8 +244,6 @@ namespace Emby.Server.Implementations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly SimpleInjector.Container Container = new SimpleInjector.Container();
|
protected readonly SimpleInjector.Container Container = new SimpleInjector.Container();
|
||||||
|
|
||||||
protected ISystemEvents SystemEvents { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the server configuration manager.
|
/// Gets the server configuration manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -371,7 +369,6 @@ namespace Emby.Server.Implementations
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
IEnvironmentInfo environmentInfo,
|
IEnvironmentInfo environmentInfo,
|
||||||
IImageEncoder imageEncoder,
|
IImageEncoder imageEncoder,
|
||||||
ISystemEvents systemEvents,
|
|
||||||
INetworkManager networkManager)
|
INetworkManager networkManager)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -383,7 +380,6 @@ namespace Emby.Server.Implementations
|
||||||
NetworkManager = networkManager;
|
NetworkManager = networkManager;
|
||||||
networkManager.LocalSubnetsFn = GetConfiguredLocalSubnets;
|
networkManager.LocalSubnetsFn = GetConfiguredLocalSubnets;
|
||||||
EnvironmentInfo = environmentInfo;
|
EnvironmentInfo = environmentInfo;
|
||||||
SystemEvents = systemEvents;
|
|
||||||
|
|
||||||
ApplicationPaths = applicationPaths;
|
ApplicationPaths = applicationPaths;
|
||||||
LoggerFactory = loggerFactory;
|
LoggerFactory = loggerFactory;
|
||||||
|
@ -762,7 +758,6 @@ namespace Emby.Server.Implementations
|
||||||
RegisterSingleInstance<IApplicationPaths>(ApplicationPaths);
|
RegisterSingleInstance<IApplicationPaths>(ApplicationPaths);
|
||||||
|
|
||||||
RegisterSingleInstance(JsonSerializer);
|
RegisterSingleInstance(JsonSerializer);
|
||||||
RegisterSingleInstance(SystemEvents);
|
|
||||||
|
|
||||||
RegisterSingleInstance(LoggerFactory, false);
|
RegisterSingleInstance(LoggerFactory, false);
|
||||||
RegisterSingleInstance(Logger);
|
RegisterSingleInstance(Logger);
|
||||||
|
@ -779,7 +774,7 @@ namespace Emby.Server.Implementations
|
||||||
IsoManager = new IsoManager();
|
IsoManager = new IsoManager();
|
||||||
RegisterSingleInstance(IsoManager);
|
RegisterSingleInstance(IsoManager);
|
||||||
|
|
||||||
TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LoggerFactory, FileSystemManager, SystemEvents);
|
TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LoggerFactory, FileSystemManager);
|
||||||
RegisterSingleInstance(TaskManager);
|
RegisterSingleInstance(TaskManager);
|
||||||
|
|
||||||
RegisterSingleInstance(XmlSerializer);
|
RegisterSingleInstance(XmlSerializer);
|
||||||
|
@ -853,7 +848,7 @@ namespace Emby.Server.Implementations
|
||||||
var musicManager = new MusicManager(LibraryManager);
|
var musicManager = new MusicManager(LibraryManager);
|
||||||
RegisterSingleInstance<IMusicManager>(new MusicManager(LibraryManager));
|
RegisterSingleInstance<IMusicManager>(new MusicManager(LibraryManager));
|
||||||
|
|
||||||
LibraryMonitor = new LibraryMonitor(LoggerFactory, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager, TimerFactory, SystemEvents, EnvironmentInfo);
|
LibraryMonitor = new LibraryMonitor(LoggerFactory, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager, TimerFactory, EnvironmentInfo);
|
||||||
RegisterSingleInstance(LibraryMonitor);
|
RegisterSingleInstance(LibraryMonitor);
|
||||||
|
|
||||||
RegisterSingleInstance<ISearchEngine>(() => new SearchEngine(LoggerFactory, LibraryManager, UserManager));
|
RegisterSingleInstance<ISearchEngine>(() => new SearchEngine(LoggerFactory, LibraryManager, UserManager));
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
using System;
|
|
||||||
using MediaBrowser.Controller;
|
|
||||||
using MediaBrowser.Controller.Plugins;
|
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.EntryPoints
|
|
||||||
{
|
|
||||||
public class SystemEvents : IServerEntryPoint
|
|
||||||
{
|
|
||||||
private readonly ISystemEvents _systemEvents;
|
|
||||||
private readonly IServerApplicationHost _appHost;
|
|
||||||
|
|
||||||
public SystemEvents(ISystemEvents systemEvents, IServerApplicationHost appHost)
|
|
||||||
{
|
|
||||||
_systemEvents = systemEvents;
|
|
||||||
_appHost = appHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Run()
|
|
||||||
{
|
|
||||||
_systemEvents.SystemShutdown += _systemEvents_SystemShutdown;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _systemEvents_SystemShutdown(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
_appHost.Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
_systemEvents.SystemShutdown -= _systemEvents_SystemShutdown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -140,7 +140,14 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
|
/// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LibraryMonitor(ILoggerFactory loggerFactory, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ITimerFactory timerFactory, ISystemEvents systemEvents, IEnvironmentInfo environmentInfo)
|
public LibraryMonitor(
|
||||||
|
ILoggerFactory loggerFactory,
|
||||||
|
ITaskManager taskManager,
|
||||||
|
ILibraryManager libraryManager,
|
||||||
|
IServerConfigurationManager configurationManager,
|
||||||
|
IFileSystem fileSystem,
|
||||||
|
ITimerFactory timerFactory,
|
||||||
|
IEnvironmentInfo environmentInfo)
|
||||||
{
|
{
|
||||||
if (taskManager == null)
|
if (taskManager == null)
|
||||||
{
|
{
|
||||||
|
@ -154,26 +161,9 @@ namespace Emby.Server.Implementations.IO
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_timerFactory = timerFactory;
|
_timerFactory = timerFactory;
|
||||||
_environmentInfo = environmentInfo;
|
_environmentInfo = environmentInfo;
|
||||||
|
|
||||||
systemEvents.Resume += _systemEvents_Resume;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _systemEvents_Resume(object sender, EventArgs e)
|
private bool IsLibraryMonitorEnabled(BaseItem item)
|
||||||
{
|
|
||||||
Restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Restart()
|
|
||||||
{
|
|
||||||
Stop();
|
|
||||||
|
|
||||||
if (!_disposed)
|
|
||||||
{
|
|
||||||
Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsLibraryMonitorEnabaled(BaseItem item)
|
|
||||||
{
|
{
|
||||||
if (item is BasePluginFolder)
|
if (item is BasePluginFolder)
|
||||||
{
|
{
|
||||||
|
@ -200,7 +190,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
var paths = LibraryManager
|
var paths = LibraryManager
|
||||||
.RootFolder
|
.RootFolder
|
||||||
.Children
|
.Children
|
||||||
.Where(IsLibraryMonitorEnabaled)
|
.Where(IsLibraryMonitorEnabled)
|
||||||
.OfType<Folder>()
|
.OfType<Folder>()
|
||||||
.SelectMany(f => f.PhysicalLocations)
|
.SelectMany(f => f.PhysicalLocations)
|
||||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||||
|
@ -223,7 +213,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
|
|
||||||
private void StartWatching(BaseItem item)
|
private void StartWatching(BaseItem item)
|
||||||
{
|
{
|
||||||
if (IsLibraryMonitorEnabaled(item))
|
if (IsLibraryMonitorEnabled(item))
|
||||||
{
|
{
|
||||||
StartWatchingPath(item.Path);
|
StartWatchingPath(item.Path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
private readonly IMediaEncoder _mediaEncoder;
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
private readonly IProcessFactory _processFactory;
|
private readonly IProcessFactory _processFactory;
|
||||||
private readonly ISystemEvents _systemEvents;
|
|
||||||
private readonly IAssemblyInfo _assemblyInfo;
|
private readonly IAssemblyInfo _assemblyInfo;
|
||||||
private IMediaSourceManager _mediaSourceManager;
|
private IMediaSourceManager _mediaSourceManager;
|
||||||
|
|
||||||
|
@ -90,8 +89,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
IProviderManager providerManager,
|
IProviderManager providerManager,
|
||||||
IMediaEncoder mediaEncoder,
|
IMediaEncoder mediaEncoder,
|
||||||
ITimerFactory timerFactory,
|
ITimerFactory timerFactory,
|
||||||
IProcessFactory processFactory,
|
IProcessFactory processFactory)
|
||||||
ISystemEvents systemEvents)
|
|
||||||
{
|
{
|
||||||
Current = this;
|
Current = this;
|
||||||
|
|
||||||
|
@ -105,7 +103,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
_mediaEncoder = mediaEncoder;
|
_mediaEncoder = mediaEncoder;
|
||||||
_processFactory = processFactory;
|
_processFactory = processFactory;
|
||||||
_systemEvents = systemEvents;
|
|
||||||
_liveTvManager = (LiveTvManager)liveTvManager;
|
_liveTvManager = (LiveTvManager)liveTvManager;
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
_assemblyInfo = assemblyInfo;
|
_assemblyInfo = assemblyInfo;
|
||||||
|
@ -131,15 +128,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
{
|
{
|
||||||
_timerProvider.RestartTimers();
|
_timerProvider.RestartTimers();
|
||||||
|
|
||||||
_systemEvents.Resume += _systemEvents_Resume;
|
|
||||||
await CreateRecordingFolders().ConfigureAwait(false);
|
await CreateRecordingFolders().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _systemEvents_Resume(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
_timerProvider.RestartTimers();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void OnRecordingFoldersChanged()
|
private async void OnRecordingFoldersChanged()
|
||||||
{
|
{
|
||||||
await CreateRecordingFolders().ConfigureAwait(false);
|
await CreateRecordingFolders().ConfigureAwait(false);
|
||||||
|
|
|
@ -53,7 +53,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
/// <value>The task manager.</value>
|
/// <value>The task manager.</value>
|
||||||
private ITaskManager TaskManager { get; set; }
|
private ITaskManager TaskManager { get; set; }
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly ISystemEvents _systemEvents;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ScheduledTaskWorker" /> class.
|
/// Initializes a new instance of the <see cref="ScheduledTaskWorker" /> class.
|
||||||
|
@ -74,7 +73,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
/// or
|
/// or
|
||||||
/// logger
|
/// logger
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public ScheduledTaskWorker(IScheduledTask scheduledTask, IApplicationPaths applicationPaths, ITaskManager taskManager, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem, ISystemEvents systemEvents)
|
public ScheduledTaskWorker(IScheduledTask scheduledTask, IApplicationPaths applicationPaths, ITaskManager taskManager, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
if (scheduledTask == null)
|
if (scheduledTask == null)
|
||||||
{
|
{
|
||||||
|
@ -103,7 +102,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
JsonSerializer = jsonSerializer;
|
JsonSerializer = jsonSerializer;
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_systemEvents = systemEvents;
|
|
||||||
|
|
||||||
InitTriggerEvents();
|
InitTriggerEvents();
|
||||||
}
|
}
|
||||||
|
@ -762,20 +760,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.Type.Equals(typeof(SystemEventTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
if (!info.SystemEvent.HasValue)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Info did not contain a SystemEvent.", nameof(info));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new SystemEventTrigger(_systemEvents)
|
|
||||||
{
|
|
||||||
SystemEvent = info.SystemEvent.Value,
|
|
||||||
TaskOptions = options
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.Type.Equals(typeof(StartupTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
if (info.Type.Equals(typeof(StartupTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return new StartupTrigger();
|
return new StartupTrigger();
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
using MediaBrowser.Model.Tasks;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class SystemEventTrigger
|
|
||||||
/// </summary>
|
|
||||||
public class SystemEventTrigger : ITaskTrigger
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the system event.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The system event.</value>
|
|
||||||
public SystemEvent SystemEvent { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the options of this task.
|
|
||||||
/// </summary>
|
|
||||||
public TaskOptions TaskOptions { get; set; }
|
|
||||||
|
|
||||||
private readonly ISystemEvents _systemEvents;
|
|
||||||
|
|
||||||
public SystemEventTrigger(ISystemEvents systemEvents)
|
|
||||||
{
|
|
||||||
_systemEvents = systemEvents;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stars waiting for the trigger action
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="lastResult">The last result.</param>
|
|
||||||
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
|
|
||||||
public void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)
|
|
||||||
{
|
|
||||||
switch (SystemEvent)
|
|
||||||
{
|
|
||||||
case SystemEvent.WakeFromSleep:
|
|
||||||
_systemEvents.Resume += _systemEvents_Resume;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void _systemEvents_Resume(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (SystemEvent == SystemEvent.WakeFromSleep)
|
|
||||||
{
|
|
||||||
// This value is a bit arbitrary, but add a delay to help ensure network connections have been restored before running the task
|
|
||||||
await Task.Delay(10000).ConfigureAwait(false);
|
|
||||||
|
|
||||||
OnTriggered();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stops waiting for the trigger action
|
|
||||||
/// </summary>
|
|
||||||
public void Stop()
|
|
||||||
{
|
|
||||||
_systemEvents.Resume -= _systemEvents_Resume;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occurs when [triggered].
|
|
||||||
/// </summary>
|
|
||||||
public event EventHandler<EventArgs> Triggered;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when [triggered].
|
|
||||||
/// </summary>
|
|
||||||
private void OnTriggered()
|
|
||||||
{
|
|
||||||
if (Triggered != null)
|
|
||||||
{
|
|
||||||
Triggered(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -46,8 +46,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
/// <value>The application paths.</value>
|
/// <value>The application paths.</value>
|
||||||
private IApplicationPaths ApplicationPaths { get; set; }
|
private IApplicationPaths ApplicationPaths { get; set; }
|
||||||
|
|
||||||
private readonly ISystemEvents _systemEvents;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the logger.
|
/// Gets the logger.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -66,54 +64,16 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
IApplicationPaths applicationPaths,
|
IApplicationPaths applicationPaths,
|
||||||
IJsonSerializer jsonSerializer,
|
IJsonSerializer jsonSerializer,
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem)
|
||||||
ISystemEvents systemEvents)
|
|
||||||
{
|
{
|
||||||
ApplicationPaths = applicationPaths;
|
ApplicationPaths = applicationPaths;
|
||||||
JsonSerializer = jsonSerializer;
|
JsonSerializer = jsonSerializer;
|
||||||
Logger = loggerFactory.CreateLogger(nameof(TaskManager));
|
Logger = loggerFactory.CreateLogger(nameof(TaskManager));
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_systemEvents = systemEvents;
|
|
||||||
|
|
||||||
ScheduledTasks = new IScheduledTaskWorker[] { };
|
ScheduledTasks = new IScheduledTaskWorker[] { };
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BindToSystemEvent()
|
|
||||||
{
|
|
||||||
_systemEvents.Resume += _systemEvents_Resume;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _systemEvents_Resume(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
foreach (var task in ScheduledTasks)
|
|
||||||
{
|
|
||||||
task.ReloadTriggerEvents();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RunTaskOnNextStartup(string key)
|
|
||||||
{
|
|
||||||
var path = Path.Combine(ApplicationPaths.CachePath, "startuptasks.txt");
|
|
||||||
|
|
||||||
List<string> lines;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
lines = _fileSystem.ReadAllLines(path).ToList();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
lines = new List<string>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!lines.Contains(key, StringComparer.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
lines.Add(key);
|
|
||||||
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
|
|
||||||
_fileSystem.WriteAllLines(path, lines);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RunStartupTasks()
|
private void RunStartupTasks()
|
||||||
{
|
{
|
||||||
var path = Path.Combine(ApplicationPaths.CachePath, "startuptasks.txt");
|
var path = Path.Combine(ApplicationPaths.CachePath, "startuptasks.txt");
|
||||||
|
@ -290,12 +250,10 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
var myTasks = ScheduledTasks.ToList();
|
var myTasks = ScheduledTasks.ToList();
|
||||||
|
|
||||||
var list = tasks.ToList();
|
var list = tasks.ToList();
|
||||||
myTasks.AddRange(list.Select(t => new ScheduledTaskWorker(t, ApplicationPaths, this, JsonSerializer, Logger, _fileSystem, _systemEvents)));
|
myTasks.AddRange(list.Select(t => new ScheduledTaskWorker(t, ApplicationPaths, this, JsonSerializer, Logger, _fileSystem)));
|
||||||
|
|
||||||
ScheduledTasks = myTasks.ToArray();
|
ScheduledTasks = myTasks.ToArray();
|
||||||
|
|
||||||
BindToSystemEvent();
|
|
||||||
|
|
||||||
RunStartupTasks();
|
RunStartupTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
using System;
|
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations
|
|
||||||
{
|
|
||||||
public class SystemEvents : ISystemEvents
|
|
||||||
{
|
|
||||||
public event EventHandler Resume;
|
|
||||||
public event EventHandler Suspend;
|
|
||||||
public event EventHandler SessionLogoff;
|
|
||||||
public event EventHandler SystemShutdown;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,8 +11,8 @@ namespace Jellyfin.Server
|
||||||
{
|
{
|
||||||
public class CoreAppHost : ApplicationHost
|
public class CoreAppHost : ApplicationHost
|
||||||
{
|
{
|
||||||
public CoreAppHost(ServerApplicationPaths applicationPaths, ILoggerFactory loggerFactory, StartupOptions options, IFileSystem fileSystem, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, ISystemEvents systemEvents, MediaBrowser.Common.Net.INetworkManager networkManager)
|
public CoreAppHost(ServerApplicationPaths applicationPaths, ILoggerFactory loggerFactory, StartupOptions options, IFileSystem fileSystem, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, MediaBrowser.Common.Net.INetworkManager networkManager)
|
||||||
: base(applicationPaths, loggerFactory, options, fileSystem, environmentInfo, imageEncoder, systemEvents, networkManager)
|
: base(applicationPaths, loggerFactory, options, fileSystem, environmentInfo, imageEncoder, networkManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,6 @@ namespace Jellyfin.Server
|
||||||
fileSystem,
|
fileSystem,
|
||||||
environmentInfo,
|
environmentInfo,
|
||||||
new NullImageEncoder(),
|
new NullImageEncoder(),
|
||||||
new SystemEvents(),
|
|
||||||
new NetworkManager(_loggerFactory, environmentInfo)))
|
new NetworkManager(_loggerFactory, environmentInfo)))
|
||||||
{
|
{
|
||||||
appHost.Init();
|
appHost.Init();
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Model.System
|
|
||||||
{
|
|
||||||
public interface ISystemEvents
|
|
||||||
{
|
|
||||||
event EventHandler Resume;
|
|
||||||
event EventHandler Suspend;
|
|
||||||
event EventHandler SessionLogoff;
|
|
||||||
event EventHandler SystemShutdown;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -72,7 +72,5 @@ namespace MediaBrowser.Model.Tasks
|
||||||
|
|
||||||
event EventHandler<GenericEventArgs<IScheduledTaskWorker>> TaskExecuting;
|
event EventHandler<GenericEventArgs<IScheduledTaskWorker>> TaskExecuting;
|
||||||
event EventHandler<TaskCompletionEventArgs> TaskCompleted;
|
event EventHandler<TaskCompletionEventArgs> TaskCompleted;
|
||||||
|
|
||||||
void RunTaskOnNextStartup(string key);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
namespace MediaBrowser.Model.Tasks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Enum SystemEvent
|
|
||||||
/// </summary>
|
|
||||||
public enum SystemEvent
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The wake from sleep
|
|
||||||
/// </summary>
|
|
||||||
WakeFromSleep = 0
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -25,12 +25,6 @@ namespace MediaBrowser.Model.Tasks
|
||||||
/// <value>The interval.</value>
|
/// <value>The interval.</value>
|
||||||
public long? IntervalTicks { get; set; }
|
public long? IntervalTicks { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the system event.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The system event.</value>
|
|
||||||
public SystemEvent? SystemEvent { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the day of week.
|
/// Gets or sets the day of week.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user