From c71a319685b7a5027112ce3059e7fdff3fff3729 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 21 Jan 2016 11:53:03 -0500 Subject: use image magick for auto-orientation --- MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj | 2 +- MediaBrowser.ServerApplication/packages.config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.ServerApplication') diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 3e62f47351..c629831923 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -67,7 +67,7 @@ False - ..\packages\ImageMagickSharp.1.0.0.17\lib\net45\ImageMagickSharp.dll + ..\packages\ImageMagickSharp.1.0.0.18\lib\net45\ImageMagickSharp.dll ..\packages\MediaBrowser.IsoMounting.3.0.69\lib\net45\MediaBrowser.IsoMounter.dll diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index db2bb54761..be12bcd5c3 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -1,7 +1,7 @@  - + -- cgit v1.2.3 From 06f8047ee6a68fb5429b3d938b2916f1a17a63b5 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 21 Jan 2016 12:29:14 -0500 Subject: support system wake on recording schedule --- .../MediaBrowser.Controller.csproj | 1 + MediaBrowser.Controller/Power/IPowerManagement.cs | 13 +++++++ .../LiveTv/EmbyTV/EmbyTV.cs | 5 +-- .../LiveTv/EmbyTV/TimerManager.cs | 30 ++++++++++++++-- MediaBrowser.Server.Mono/Native/BaseMonoApp.cs | 14 ++++++++ .../ApplicationHost.cs | 2 ++ MediaBrowser.Server.Startup.Common/INativeApp.cs | 7 ++++ .../MediaBrowser.ServerApplication.csproj | 1 + .../Native/WindowsApp.cs | 6 ++++ .../Native/WindowsPowerManagement.cs | 40 ++++++++++++++++++++++ 10 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 MediaBrowser.Controller/Power/IPowerManagement.cs create mode 100644 MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs (limited to 'MediaBrowser.ServerApplication') diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 2227df3f03..471aa38d4b 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -265,6 +265,7 @@ + diff --git a/MediaBrowser.Controller/Power/IPowerManagement.cs b/MediaBrowser.Controller/Power/IPowerManagement.cs new file mode 100644 index 0000000000..faa2896952 --- /dev/null +++ b/MediaBrowser.Controller/Power/IPowerManagement.cs @@ -0,0 +1,13 @@ +using System; + +namespace MediaBrowser.Controller.Power +{ + public interface IPowerManagement + { + /// + /// Schedules the wake. + /// + /// The UTC time. + void ScheduleWake(DateTime utcTime); + } +} diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 356d0d83d5..3d1d9e0bab 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -28,6 +28,7 @@ using System.Threading; using System.Threading.Tasks; using CommonIO; using MediaBrowser.Common.Extensions; +using MediaBrowser.Controller.Power; namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { @@ -55,7 +56,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV public static EmbyTV Current; - public EmbyTV(IApplicationHost appHost, ILogger logger, IJsonSerializer jsonSerializer, IHttpClient httpClient, IServerConfigurationManager config, ILiveTvManager liveTvManager, IFileSystem fileSystem, ISecurityManager security, ILibraryManager libraryManager, ILibraryMonitor libraryMonitor, IProviderManager providerManager, IFileOrganizationService organizationService, IMediaEncoder mediaEncoder) + public EmbyTV(IApplicationHost appHost, ILogger logger, IJsonSerializer jsonSerializer, IHttpClient httpClient, IServerConfigurationManager config, ILiveTvManager liveTvManager, IFileSystem fileSystem, ISecurityManager security, ILibraryManager libraryManager, ILibraryMonitor libraryMonitor, IProviderManager providerManager, IFileOrganizationService organizationService, IMediaEncoder mediaEncoder, IPowerManagement powerManagement) { Current = this; @@ -75,7 +76,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV _recordingProvider = new ItemDataProvider(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "recordings"), (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase)); _seriesTimerProvider = new SeriesTimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers")); - _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers")); + _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), powerManagement, _logger); _timerProvider.TimerFired += _timerProvider_TimerFired; } diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs index 80bb671fa7..ca20379b66 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs @@ -8,19 +8,23 @@ using System.Collections.Concurrent; using System.Linq; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; +using MediaBrowser.Controller.Power; namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { public class TimerManager : ItemDataProvider { private readonly ConcurrentDictionary _timers = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); + private readonly IPowerManagement _powerManagement; + private readonly ILogger _logger; public event EventHandler> TimerFired; - public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath) + public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, IPowerManagement powerManagement, ILogger logger1) : base(fileSystem, jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase)) { + _powerManagement = powerManagement; + _logger = logger1; } public void RestartTimers() @@ -58,6 +62,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { var timespan = RecordingHelper.GetStartTime(item) - DateTime.UtcNow; timer.Change(timespan, TimeSpan.Zero); + ScheduleWake(item); } else { @@ -74,6 +79,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV base.Add(item); AddTimer(item); + ScheduleWake(item); } private void AddTimer(TimerInfo item) @@ -91,6 +97,26 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV StartTimer(item, timerLength); } + private void ScheduleWake(TimerInfo info) + { + var startDate = RecordingHelper.GetStartTime(info).AddMinutes(-5); + _logger.Info("Scheduling system wake timer at {0} (UTC)", startDate); + + try + { + _powerManagement.ScheduleWake(startDate); + _logger.Info("Scheduled system wake timer at {0} (UTC)", startDate); + } + catch (NotImplementedException) + { + + } + catch (Exception ex) + { + _logger.ErrorException("Error scheduling wake timer", ex); + } + } + public void StartTimer(TimerInfo item, TimeSpan length) { StopTimer(item); diff --git a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs index 31d4592c8e..e57a651c00 100644 --- a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs +++ b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Text.RegularExpressions; +using MediaBrowser.Controller.Power; namespace MediaBrowser.Server.Mono.Native { @@ -203,5 +204,18 @@ namespace MediaBrowser.Server.Mono.Native public string sysname = string.Empty; public string machine = string.Empty; } + + public IPowerManagement GetPowerManagement() + { + return new NullPowerManagement(); + } + } + + public class NullPowerManagement : IPowerManagement + { + public void ScheduleWake(DateTime utcTime) + { + throw new NotImplementedException(); + } } } diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index 21731a3a60..1db019d8d2 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -533,6 +533,8 @@ namespace MediaBrowser.Server.Startup.Common EncodingManager = new EncodingManager(FileSystemManager, Logger, MediaEncoder, ChapterManager); RegisterSingleInstance(EncodingManager); + RegisterSingleInstance(NativeApp.GetPowerManagement()); + var sharingRepo = new SharingRepository(LogManager, ApplicationPaths); await sharingRepo.Initialize().ConfigureAwait(false); RegisterSingleInstance(new SharingManager(sharingRepo, ServerConfigurationManager, LibraryManager, this)); diff --git a/MediaBrowser.Server.Startup.Common/INativeApp.cs b/MediaBrowser.Server.Startup.Common/INativeApp.cs index 597caf34cc..75b38d0c4c 100644 --- a/MediaBrowser.Server.Startup.Common/INativeApp.cs +++ b/MediaBrowser.Server.Startup.Common/INativeApp.cs @@ -2,6 +2,7 @@ using MediaBrowser.Model.Logging; using System.Collections.Generic; using System.Reflection; +using MediaBrowser.Controller.Power; namespace MediaBrowser.Server.Startup.Common { @@ -90,5 +91,11 @@ namespace MediaBrowser.Server.Startup.Common /// Prevents the system stand by. /// void PreventSystemStandby(); + + /// + /// Gets the power management. + /// + /// IPowerManagement. + IPowerManagement GetPowerManagement(); } } diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index c629831923..80e56d6e11 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -120,6 +120,7 @@ + diff --git a/MediaBrowser.ServerApplication/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.cs index ceab5379d5..9ef9c7d501 100644 --- a/MediaBrowser.ServerApplication/Native/WindowsApp.cs +++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs @@ -6,6 +6,7 @@ using MediaBrowser.ServerApplication.Networking; using System.Collections.Generic; using System.Reflection; using CommonIO; +using MediaBrowser.Controller.Power; namespace MediaBrowser.ServerApplication.Native { @@ -117,5 +118,10 @@ namespace MediaBrowser.ServerApplication.Native { Standby.PreventSystemStandby(); } + + public IPowerManagement GetPowerManagement() + { + return new WindowsPowerManagement(); + } } } diff --git a/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs b/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs new file mode 100644 index 0000000000..6bd78553b6 --- /dev/null +++ b/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs @@ -0,0 +1,40 @@ +using System; +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Threading; +using MediaBrowser.Controller.Power; +using Microsoft.Win32.SafeHandles; + +namespace MediaBrowser.ServerApplication.Native +{ + public class WindowsPowerManagement : IPowerManagement + { + [DllImport("kernel32.dll")] + public static extern SafeWaitHandle CreateWaitableTimer(IntPtr lpTimerAttributes, bool bManualReset, string lpTimerName); + + [DllImport("kernel32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SetWaitableTimer(SafeWaitHandle hTimer, [In] ref long pDueTime, int lPeriod, IntPtr pfnCompletionRoutine, IntPtr lpArgToCompletionRoutine, bool fResume); + + public void ScheduleWake(DateTime utcTime) + { + long duetime = utcTime.ToFileTime(); + + using (SafeWaitHandle handle = CreateWaitableTimer(IntPtr.Zero, true, "MyWaitabletimer")) + { + if (SetWaitableTimer(handle, ref duetime, 0, IntPtr.Zero, IntPtr.Zero, true)) + { + using (EventWaitHandle wh = new EventWaitHandle(false, EventResetMode.AutoReset)) + { + wh.SafeWaitHandle = handle; + wh.WaitOne(); + } + } + else + { + throw new Win32Exception(Marshal.GetLastWin32Error()); + } + } + } + } +} -- cgit v1.2.3 From a10347a455fbc27284caa8a42c5e77cda9683eab Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 21 Jan 2016 12:45:42 -0500 Subject: update wake timer --- .../LiveTv/LiveTvManager.cs | 1 + MediaBrowser.ServerApplication/MainStartup.cs | 2 +- .../Native/WindowsApp.cs | 6 +- .../Native/WindowsPowerManagement.cs | 77 ++++++++++++++++++---- 4 files changed, 71 insertions(+), 15 deletions(-) (limited to 'MediaBrowser.ServerApplication') diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index e09e06bd4b..8bf1d27b8b 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1954,6 +1954,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv await service.CreateTimerAsync(info, cancellationToken).ConfigureAwait(false); _lastRecordingRefreshTime = DateTime.MinValue; + _logger.Info("New recording scheduled"); } public async Task CreateSeriesTimer(SeriesTimerInfoDto timer, CancellationToken cancellationToken) diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 62cdbd05f4..cf174c2d3b 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -218,7 +218,7 @@ namespace MediaBrowser.ServerApplication var fileSystem = new WindowsFileSystem(new PatternsLogger(logManager.GetLogger("FileSystem"))); fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem)); - var nativeApp = new WindowsApp(fileSystem) + var nativeApp = new WindowsApp(fileSystem, _logger) { IsRunningAsService = runService }; diff --git a/MediaBrowser.ServerApplication/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.cs index 9ef9c7d501..fe2fe6de6c 100644 --- a/MediaBrowser.ServerApplication/Native/WindowsApp.cs +++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs @@ -13,10 +13,12 @@ namespace MediaBrowser.ServerApplication.Native public class WindowsApp : INativeApp { private readonly IFileSystem _fileSystem; + private readonly ILogger _logger; - public WindowsApp(IFileSystem fileSystem) + public WindowsApp(IFileSystem fileSystem, ILogger logger) { _fileSystem = fileSystem; + _logger = logger; } public List GetAssembliesWithParts() @@ -121,7 +123,7 @@ namespace MediaBrowser.ServerApplication.Native public IPowerManagement GetPowerManagement() { - return new WindowsPowerManagement(); + return new WindowsPowerManagement(_logger); } } } diff --git a/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs b/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs index 6bd78553b6..3b05febafe 100644 --- a/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs +++ b/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using System.Runtime.InteropServices; using System.Threading; using MediaBrowser.Controller.Power; +using MediaBrowser.Model.Logging; using Microsoft.Win32.SafeHandles; namespace MediaBrowser.ServerApplication.Native @@ -10,31 +11,83 @@ namespace MediaBrowser.ServerApplication.Native public class WindowsPowerManagement : IPowerManagement { [DllImport("kernel32.dll")] - public static extern SafeWaitHandle CreateWaitableTimer(IntPtr lpTimerAttributes, bool bManualReset, string lpTimerName); + public static extern SafeWaitHandle CreateWaitableTimer(IntPtr lpTimerAttributes, + bool bManualReset, + string lpTimerName); [DllImport("kernel32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SetWaitableTimer(SafeWaitHandle hTimer, [In] ref long pDueTime, int lPeriod, IntPtr pfnCompletionRoutine, IntPtr lpArgToCompletionRoutine, bool fResume); + public static extern bool SetWaitableTimer(SafeWaitHandle hTimer, + [In] ref long pDueTime, + int lPeriod, + IntPtr pfnCompletionRoutine, + IntPtr lpArgToCompletionRoutine, + bool fResume); + + private BackgroundWorker _bgWorker; + private readonly ILogger _logger; + private readonly object _initLock = new object(); + + public WindowsPowerManagement(ILogger logger) + { + _logger = logger; + } public void ScheduleWake(DateTime utcTime) { - long duetime = utcTime.ToFileTime(); + Initialize(); + _bgWorker.RunWorkerAsync(utcTime.ToFileTime()); + } - using (SafeWaitHandle handle = CreateWaitableTimer(IntPtr.Zero, true, "MyWaitabletimer")) + private void Initialize() + { + lock (_initLock) { - if (SetWaitableTimer(handle, ref duetime, 0, IntPtr.Zero, IntPtr.Zero, true)) + if (_bgWorker == null) { - using (EventWaitHandle wh = new EventWaitHandle(false, EventResetMode.AutoReset)) - { - wh.SafeWaitHandle = handle; - wh.WaitOne(); - } + _bgWorker = new BackgroundWorker(); + + _bgWorker.DoWork += bgWorker_DoWork; + _bgWorker.RunWorkerCompleted += bgWorker_RunWorkerCompleted; } - else + } + } + + void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + //if (Woken != null) + //{ + // Woken(this, new EventArgs()); + //} + } + + private void bgWorker_DoWork(object sender, DoWorkEventArgs e) + { + try + { + long waketime = (long)e.Argument; + + using (SafeWaitHandle handle = CreateWaitableTimer(IntPtr.Zero, true, GetType().Assembly.GetName().Name + "Timer")) { - throw new Win32Exception(Marshal.GetLastWin32Error()); + if (SetWaitableTimer(handle, ref waketime, 0, IntPtr.Zero, IntPtr.Zero, true)) + { + using (EventWaitHandle wh = new EventWaitHandle(false, + EventResetMode.AutoReset)) + { + wh.SafeWaitHandle = handle; + wh.WaitOne(); + } + } + else + { + throw new Win32Exception(Marshal.GetLastWin32Error()); + } } } + catch (Exception ex) + { + _logger.ErrorException("Error scheduling wake timer", ex); + } } } } -- cgit v1.2.3 From 9a83394e5d09c8685841f2fe951f5d1b8d5e43b1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 27 Jan 2016 01:06:45 -0500 Subject: disable wake timer --- MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.ServerApplication') diff --git a/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs b/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs index 3b05febafe..abfbab50c0 100644 --- a/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs +++ b/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs @@ -35,8 +35,8 @@ namespace MediaBrowser.ServerApplication.Native public void ScheduleWake(DateTime utcTime) { - Initialize(); - _bgWorker.RunWorkerAsync(utcTime.ToFileTime()); + //Initialize(); + //_bgWorker.RunWorkerAsync(utcTime.ToFileTime()); } private void Initialize() -- cgit v1.2.3 From 9d6f1a8b6151c2bfcb43ca0b358bab087044de83 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 28 Jan 2016 14:10:56 -0500 Subject: update recording logging --- .../LiveTv/EmbyTV/TimerManager.cs | 9 +++++++-- MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.ServerApplication') diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs index ca20379b66..94381cdac1 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs @@ -5,6 +5,7 @@ using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; using System; using System.Collections.Concurrent; +using System.Globalization; using System.Linq; using System.Threading; using CommonIO; @@ -100,7 +101,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV private void ScheduleWake(TimerInfo info) { var startDate = RecordingHelper.GetStartTime(info).AddMinutes(-5); - _logger.Info("Scheduling system wake timer at {0} (UTC)", startDate); try { @@ -123,9 +123,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV var timer = new Timer(TimerCallback, item.Id, length, TimeSpan.Zero); - if (!_timers.TryAdd(item.Id, timer)) + if (_timers.TryAdd(item.Id, timer)) + { + _logger.Warn("Creating recording timer for {0}, {1}. Timer will fire in {2} minutes", item.Id, item.Name, length.TotalMinutes.ToString(CultureInfo.InvariantCulture)); + } + else { timer.Dispose(); + _logger.Warn("Timer already exists for item {0}", item.Id); } } diff --git a/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs b/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs index abfbab50c0..866272639f 100644 --- a/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs +++ b/MediaBrowser.ServerApplication/Native/WindowsPowerManagement.cs @@ -37,6 +37,7 @@ namespace MediaBrowser.ServerApplication.Native { //Initialize(); //_bgWorker.RunWorkerAsync(utcTime.ToFileTime()); + throw new NotImplementedException(); } private void Initialize() -- cgit v1.2.3