using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.ScheduledTasks
{
///
/// Class ChapterImagesTask
///
class ChapterImagesTask : IScheduledTask
{
///
/// The _kernel
///
private readonly Kernel _kernel;
///
/// The _logger
///
private readonly ILogger _logger;
///
/// The _library manager
///
private readonly ILibraryManager _libraryManager;
///
/// Initializes a new instance of the class.
///
/// The kernel.
/// The logger.
/// The library manager.
public ChapterImagesTask(Kernel kernel, ILogger logger, ILibraryManager libraryManager)
{
_kernel = kernel;
_logger = logger;
_libraryManager = libraryManager;
}
///
/// Creates the triggers that define when the task will run
///
/// IEnumerable{BaseTaskTrigger}.
public IEnumerable GetDefaultTriggers()
{
return new ITaskTrigger[]
{
new DailyTrigger { TimeOfDay = TimeSpan.FromHours(4) }
};
}
///
/// Returns the task to be executed
///
/// The cancellation token.
/// The progress.
/// Task.
public Task Execute(CancellationToken cancellationToken, IProgress progress)
{
var videos = _libraryManager.RootFolder.RecursiveChildren.OfType