Пример #1
0
        /// <summary>
        /// Posts the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <exception cref="MediaBrowser.Common.Extensions.ResourceNotFoundException">Task not found</exception>
        public void Post(StartScheduledTask request)
        {
            var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));

            if (task == null)
            {
                throw new ResourceNotFoundException("Task not found");
            }

            var hasKey = task.ScheduledTask as IHasKey;

            if (hasKey != null)
            {
                if (string.Equals(hasKey.Key, "SystemUpdateTask", StringComparison.OrdinalIgnoreCase))
                {
                    // This is a hack for now just to get the update application function to work when auto-update is disabled
                    if (!_config.Configuration.EnableAutoUpdate)
                    {
                        _config.Configuration.EnableAutoUpdate = true;
                        _config.SaveConfiguration();
                    }
                }
            }

            TaskManager.Execute(task);
        }
Пример #2
0
        /// <summary>
        /// Posts the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <exception cref="ResourceNotFoundException">Task not found</exception>
        public void Post(StartScheduledTask request)
        {
            var task = _taskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));

            if (task == null)
            {
                throw new ResourceNotFoundException("Task not found");
            }

            _taskManager.Execute(task, new TaskOptions());
        }
Пример #3
0
        /// <summary>
        /// Posts the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <exception cref="MediaBrowser.Common.Extensions.ResourceNotFoundException">Task not found</exception>
        public void Post(StartScheduledTask request)
        {
            var task = TaskManager.ScheduledTasks.FirstOrDefault(i => i.Id == request.Id);

            if (task == null)
            {
                throw new ResourceNotFoundException("Task not found");
            }

            TaskManager.Execute(task);
        }