From 9e8d35dadc2859d39c3daab98458fd9d1be03865 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 11 Feb 2016 13:29:42 -0500 Subject: [PATCH] update recording sync fields --- MediaBrowser.Controller/Dto/IDtoService.cs | 7 ++++--- MediaBrowser.Controller/Library/ILibraryManager.cs | 1 - MediaBrowser.Providers/People/MovieDbPersonProvider.cs | 2 +- MediaBrowser.Server.Implementations/Dto/DtoService.cs | 8 ++++---- .../LiveTv/LiveTvManager.cs | 10 ++++++---- .../Sync/SyncManager.cs | 5 +++++ 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/MediaBrowser.Controller/Dto/IDtoService.cs b/MediaBrowser.Controller/Dto/IDtoService.cs index 77a81d0c8..5f0442f93 100644 --- a/MediaBrowser.Controller/Dto/IDtoService.cs +++ b/MediaBrowser.Controller/Dto/IDtoService.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using System; +using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Querying; using System.Collections.Generic; @@ -44,10 +45,10 @@ namespace MediaBrowser.Controller.Dto /// /// Fills the synchronize information. /// - /// The dtos. + /// The tuples. /// The options. /// The user. - void FillSyncInfo(IEnumerable dtos, DtoOptions options, User user); + void FillSyncInfo(IEnumerable> tuples, DtoOptions options, User user); /// /// Gets the base item dto. diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 3b45d7764..1c515edd5 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -329,7 +329,6 @@ namespace MediaBrowser.Controller.Library /// The parent identifier. /// Type of the view. /// Name of the sort. - /// The unique identifier. /// The cancellation token. /// Task<UserView>. Task GetNamedView(User user, diff --git a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs index 14304c2eb..5525b547f 100644 --- a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs +++ b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs @@ -99,7 +99,7 @@ namespace MediaBrowser.Providers.People var requestCount = _requestCount; - if (requestCount >= 5) + if (requestCount >= 10) { //_logger.Debug("Throttling Tmdb people"); diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index ec54033df..89f572a54 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -212,17 +212,17 @@ namespace MediaBrowser.Server.Implementations.Dto }).Items; } - public void FillSyncInfo(IEnumerable dtos, DtoOptions options, User user) + public void FillSyncInfo(IEnumerable> tuples, DtoOptions options, User user) { if (options.Fields.Contains(ItemFields.SyncInfo)) { var syncProgress = GetSyncedItemProgress(options); - foreach (var dto in dtos) + foreach (var tuple in tuples) { - var item = _libraryManager.GetItemById(dto.Id); + var item = tuple.Item1; - FillSyncInfo(dto, item, syncProgress, options, user); + FillSyncInfo(tuple.Item2, item, syncProgress, options, user); } } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 1e878f28c..dcebc0c42 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1592,18 +1592,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv var internalResult = await GetInternalRecordings(query, cancellationToken).ConfigureAwait(false); - var returnArray = internalResult.Items - .Select(i => _dtoService.GetBaseItemDto(i, options, user)) + var tuples = internalResult.Items + .Select(i => new Tuple(i, _dtoService.GetBaseItemDto(i, options, user))) .ToArray(); if (user != null) { - _dtoService.FillSyncInfo(returnArray, new DtoOptions(), user); + _dtoService.FillSyncInfo(tuples, new DtoOptions(), user); } return new QueryResult { - Items = returnArray, + Items = tuples.Select(i => i.Item2).ToArray(), TotalRecordCount = internalResult.TotalRecordCount }; } @@ -1684,6 +1684,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv } + _lastRecordingRefreshTime = DateTime.MinValue; + // This is the responsibility of the live tv service await _libraryManager.DeleteItem((BaseItem)recording, new DeleteOptions { diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs index 21377da7e..50a960956 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs @@ -491,6 +491,11 @@ namespace MediaBrowser.Server.Implementations.Sync public bool SupportsSync(BaseItem item) { + if (item == null) + { + throw new ArgumentNullException("item"); + } + if (item is Playlist) { return true;