示例#1
0
        private void AddOrUpdateSystemTimer(TimerInfo item, bool scheduleSystemWakeTimer)
        {
            StopTimer(item);

            if (!ShouldStartTimer(item))
            {
                return;
            }

            var startDate = RecordingHelper.GetStartTime(item);
            var now       = DateTime.UtcNow;

            if (startDate < now)
            {
                EventHelper.FireEventIfNotNull(TimerFired, this, new GenericEventArgs <TimerInfo> {
                    Argument = item
                }, Logger);
                return;
            }

            var dueTime = startDate - now;

            StartTimer(item, dueTime);

            if (scheduleSystemWakeTimer && dueTime >= TimeSpan.FromMinutes(15))
            {
                ScheduleSystemWakeTimer(startDate, item.Name);
            }
        }
示例#2
0
文件: TimerManager.cs 项目: vvuk/Emby
        private void AddOrUpdateSystemTimer(TimerInfo item)
        {
            StopTimer(item);

            if (!ShouldStartTimer(item))
            {
                return;
            }

            var startDate = RecordingHelper.GetStartTime(item);
            var now = DateTime.UtcNow;

            if (startDate < now)
            {
                EventHelper.FireEventIfNotNull(TimerFired, this, new GenericEventArgs<TimerInfo> { Argument = item }, Logger);
                return;
            }

            var dueTime = startDate - now;
            StartTimer(item, dueTime);
        }
示例#3
0
        private void AddOrUpdateSystemTimer(TimerInfo item)
        {
            StopTimer(item);

            if (!ShouldStartTimer(item))
            {
                return;
            }

            var startDate = RecordingHelper.GetStartTime(item);
            var now       = DateTime.UtcNow;

            if (startDate < now)
            {
                TimerFired?.Invoke(this, new GenericEventArgs <TimerInfo>(item));
                return;
            }

            var dueTime = startDate - now;

            StartTimer(item, dueTime);
        }