using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Subtitles; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Providers.MediaInfo { public class SubtitleScheduledTask : IScheduledTask { private readonly ILibraryManager _libraryManager; private readonly IServerConfigurationManager _config; private readonly ISubtitleManager _subtitleManager; private readonly ILogger _logger; public SubtitleScheduledTask(ILibraryManager libraryManager, IServerConfigurationManager config, ISubtitleManager subtitleManager, ILogger logger) { _libraryManager = libraryManager; _config = config; _subtitleManager = subtitleManager; _logger = logger; } public string Name { get { return "Download missing subtitles"; } } public string Description { get { return "Searches the internet for missing subtitles based on metadata configuration."; } } public string Category { get { return "Library"; } } public async Task Execute(CancellationToken cancellationToken, IProgress progress) { var videos = _libraryManager.RootFolder .RecursiveChildren .OfType