diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index 593d88cf50..bf3183fd2d 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -188,15 +188,10 @@ namespace MediaBrowser.Providers.Manager if (preferredLanguages.Count > 0) { result = result.Where(i => string.IsNullOrEmpty(i.Language) || - preferredLanguages.Contains(i.Language, StringComparer.OrdinalIgnoreCase)); + preferredLanguages.Contains(i.Language, StringComparer.OrdinalIgnoreCase) || + string.Equals(i.Language, "en", StringComparison.OrdinalIgnoreCase)); } - //if (string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase)) - //{ - // result = result.Where(i => string.IsNullOrEmpty(i.Language) || - // string.Equals(i.Language, "en", StringComparison.OrdinalIgnoreCase)); - //} - return result; } catch (OperationCanceledException) diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csproj index 080732b320..406c5e2e53 100644 --- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj +++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj @@ -99,6 +99,7 @@ + diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs new file mode 100644 index 0000000000..361cc317c2 --- /dev/null +++ b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs @@ -0,0 +1,127 @@ +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