From 52a42229cd0f33954b211c5627b0e864feacbf21 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 20 Mar 2016 23:04:44 -0400 Subject: update sync task --- .../Persistence/SqliteItemRepository.cs | 12 ++++++++++++ MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs | 4 ++++ MediaBrowser.Server.Implementations/Sync/SyncManager.cs | 11 +++++++++++ 3 files changed, 27 insertions(+) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index e17b7d953..1ec74a39d 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 7086735c0..f553c8ea8 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 e22f86b11..fbbc6082a 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(); + } } } -- cgit v1.2.3 From d4870e788ac7f65190f6c82ec766d0340533de8c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 20 Mar 2016 23:10:37 -0400 Subject: update db querying --- MediaBrowser.Api/Reports/ReportsService.cs | 73 ++++------------------ MediaBrowser.Api/UserLibrary/ItemsService.cs | 64 ++++--------------- MediaBrowser.Controller/Entities/Folder.cs | 6 -- .../Entities/InternalItemsQuery.cs | 1 + .../Persistence/SqliteItemRepository.cs | 6 ++ 5 files changed, 31 insertions(+), 119 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Api/Reports/ReportsService.cs b/MediaBrowser.Api/Reports/ReportsService.cs index 5b492d8b4..5dc6e2d84 100644 --- a/MediaBrowser.Api/Reports/ReportsService.cs +++ b/MediaBrowser.Api/Reports/ReportsService.cs @@ -338,6 +338,18 @@ namespace MediaBrowser.Api.Reports query.LocationTypes = request.LocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray(); } + // Min official rating + if (!string.IsNullOrEmpty(request.MinOfficialRating)) + { + query.MinParentalRating = _localization.GetRatingLevel(request.MinOfficialRating); + } + + // Max official rating + if (!string.IsNullOrEmpty(request.MaxOfficialRating)) + { + query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating); + } + if (request.HasQueryLimit == false) { query.StartIndex = null; @@ -417,67 +429,6 @@ namespace MediaBrowser.Api.Reports return false; } - // Min index number - if (request.MinIndexNumber.HasValue) - { - if (!(i.IndexNumber.HasValue && i.IndexNumber.Value >= request.MinIndexNumber.Value)) - { - return false; - } - } - - // Min official rating - if (!string.IsNullOrEmpty(request.MinOfficialRating)) - { - var level = _localization.GetRatingLevel(request.MinOfficialRating); - - if (level.HasValue) - { - var rating = i.CustomRating; - - if (string.IsNullOrEmpty(rating)) - { - rating = i.OfficialRating; - } - - if (!string.IsNullOrEmpty(rating)) - { - var itemLevel = _localization.GetRatingLevel(rating); - - if (!(!itemLevel.HasValue || itemLevel.Value >= level.Value)) - { - return false; - } - } - } - } - - // Max official rating - if (!string.IsNullOrEmpty(request.MaxOfficialRating)) - { - var level = _localization.GetRatingLevel(request.MaxOfficialRating); - - if (level.HasValue) - { - var rating = i.CustomRating; - - if (string.IsNullOrEmpty(rating)) - { - rating = i.OfficialRating; - } - - if (!string.IsNullOrEmpty(rating)) - { - var itemLevel = _localization.GetRatingLevel(rating); - - if (!(!itemLevel.HasValue || itemLevel.Value <= level.Value)) - { - return false; - } - } - } - } - return true; } diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 92b2d6002..f32165fca 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -310,6 +310,18 @@ namespace MediaBrowser.Api.UserLibrary { query.LocationTypes = request.LocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray(); } + + // Min official rating + if (!string.IsNullOrEmpty(request.MinOfficialRating)) + { + query.MinParentalRating = _localization.GetRatingLevel(request.MinOfficialRating); + } + + // Max official rating + if (!string.IsNullOrEmpty(request.MaxOfficialRating)) + { + query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating); + } return query; } @@ -384,58 +396,6 @@ namespace MediaBrowser.Api.UserLibrary return false; } - // Min official rating - if (!string.IsNullOrEmpty(request.MinOfficialRating)) - { - var level = _localization.GetRatingLevel(request.MinOfficialRating); - - if (level.HasValue) - { - var rating = i.CustomRating; - - if (string.IsNullOrEmpty(rating)) - { - rating = i.OfficialRating; - } - - if (!string.IsNullOrEmpty(rating)) - { - var itemLevel = _localization.GetRatingLevel(rating); - - if (!(!itemLevel.HasValue || itemLevel.Value >= level.Value)) - { - return false; - } - } - } - } - - // Max official rating - if (!string.IsNullOrEmpty(request.MaxOfficialRating)) - { - var level = _localization.GetRatingLevel(request.MaxOfficialRating); - - if (level.HasValue) - { - var rating = i.CustomRating; - - if (string.IsNullOrEmpty(rating)) - { - rating = i.OfficialRating; - } - - if (!string.IsNullOrEmpty(rating)) - { - var itemLevel = _localization.GetRatingLevel(rating); - - if (!(!itemLevel.HasValue || itemLevel.Value <= level.Value)) - { - return false; - } - } - } - } - return true; } } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 7314f81c7..d2fa5d9a0 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1091,12 +1091,6 @@ namespace MediaBrowser.Controller.Entities return true; } - if (query.MinIndexNumber.HasValue) - { - Logger.Debug("Query requires post-filtering due to MinIndexNumber"); - return true; - } - if (query.OfficialRatings.Length > 0) { Logger.Debug("Query requires post-filtering due to OfficialRatings"); diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index da76e7db0..e98c89abf 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -105,6 +105,7 @@ namespace MediaBrowser.Controller.Entities internal List ItemIdsFromPersonFilters { get; set; } public int? ParentIndexNumber { get; set; } + public int? MinParentalRating { get; set; } public int? MaxParentalRating { get; set; } public bool? IsCurrentSchema { get; set; } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 1ec74a39d..a6e92171f 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -2062,6 +2062,12 @@ namespace MediaBrowser.Server.Implementations.Persistence whereClauses.Add(clause); } + if (query.MinParentalRating.HasValue) + { + whereClauses.Add("InheritedParentalRatingValue<=@MinParentalRating"); + cmd.Parameters.Add(cmd, "@MinParentalRating", DbType.Int32).Value = query.MinParentalRating.Value; + } + if (query.MaxParentalRating.HasValue) { whereClauses.Add("InheritedParentalRatingValue<=@MaxParentalRating"); -- cgit v1.2.3