diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs index b5566650ca..f3316646bb 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs @@ -170,6 +170,17 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks QueueScheduledTask(new TaskExecutionOptions()); } + public void QueueIfNotRunning() + where T : IScheduledTask + { + var task = ScheduledTasks.First(t => t.ScheduledTask.GetType() == typeof(T)); + + if (task.State != TaskState.Running) + { + QueueScheduledTask(new TaskExecutionOptions()); + } + } + public void Execute() where T : IScheduledTask { diff --git a/MediaBrowser.Common/ScheduledTasks/ITaskManager.cs b/MediaBrowser.Common/ScheduledTasks/ITaskManager.cs index c1dc304f65..f1809c4516 100644 --- a/MediaBrowser.Common/ScheduledTasks/ITaskManager.cs +++ b/MediaBrowser.Common/ScheduledTasks/ITaskManager.cs @@ -50,6 +50,9 @@ namespace MediaBrowser.Common.ScheduledTasks void QueueScheduledTask() where T : IScheduledTask; + void QueueIfNotRunning() + where T : IScheduledTask; + /// /// Queues the scheduled task. /// diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index dcdd10dd6e..7314f81c7a 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -979,12 +979,6 @@ namespace MediaBrowser.Controller.Entities return true; } - if (query.HasOverview.HasValue) - { - Logger.Debug("Query requires post-filtering due to HasOverview"); - return true; - } - if (query.HasImdbId.HasValue) { Logger.Debug("Query requires post-filtering due to HasImdbId"); @@ -1078,13 +1072,6 @@ namespace MediaBrowser.Controller.Entities return true; } - // Apply official rating filter - if (query.OfficialRatings.Length > 0) - { - Logger.Debug("Query requires post-filtering due to OfficialRatings"); - return true; - } - // Apply person filter if (query.ItemIdsFromPersonFilters != null) { diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index e17b7d953e..1ec74a39d6 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -2080,6 +2080,18 @@ namespace MediaBrowser.Server.Implementations.Persistence } } + if (query.HasOverview.HasValue) + { + if (query.HasOverview.Value) + { + whereClauses.Add("(Overview not null AND Overview<>'')"); + } + else + { + whereClauses.Add("(Overview is null OR Overview='')"); + } + } + if (query.HasDeadParentId.HasValue) { if (query.HasDeadParentId.Value) diff --git a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs index 7086735c09..f553c8ea82 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs @@ -641,6 +641,8 @@ namespace MediaBrowser.Server.Implementations.Sync ReadInputAtNativeFramerate = !syncOptions.EnableFullSpeedTranscoding }, innerProgress, cancellationToken); + + _syncManager.OnConversionComplete(jobItem, job); } catch (OperationCanceledException) { @@ -825,6 +827,8 @@ namespace MediaBrowser.Server.Implementations.Sync CpuCoreLimit = syncOptions.TranscodingCpuCoreLimit }, innerProgress, cancellationToken); + + _syncManager.OnConversionComplete(jobItem, job); } catch (OperationCanceledException) { diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs index e22f86b117..fbbc6082ae 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs @@ -1325,5 +1325,16 @@ namespace MediaBrowser.Server.Implementations.Sync return list; } + + protected internal void OnConversionComplete(SyncJobItem item, SyncJob job) + { + var syncProvider = GetSyncProvider(item, job); + if (syncProvider is AppSyncProvider) + { + return; + } + + _taskManager.QueueIfNotRunning(); + } } }