using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.ScheduledTasks
{
///
/// Class ChapterImagesTask
///
class ChapterImagesTask : BaseScheduledTask
{
///
/// Initializes a new instance of the class.
///
/// The kernel.
///
public ChapterImagesTask(Kernel kernel, ITaskManager taskManager, ILogger logger)
: base(kernel, taskManager, logger)
{
}
///
/// Creates the triggers that define when the task will run
///
/// IEnumerable{BaseTaskTrigger}.
public override IEnumerable GetDefaultTriggers()
{
return new ITaskTrigger[]
{
new DailyTrigger { TimeOfDay = TimeSpan.FromHours(4) }
};
}
///
/// Returns the task to be executed
///
/// The cancellation token.
/// The progress.
/// Task.
protected override Task ExecuteInternal(CancellationToken cancellationToken, IProgress progress)
{
var videos = Kernel.RootFolder.RecursiveChildren.OfType