From fd53e18ee99123d2fac7d64d5772b0a3eff2b86b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 1 Aug 2016 14:16:07 -0400 Subject: [PATCH 1/2] fix sync layout --- MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs index 6e3114fa1..dfa5c1b71 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs @@ -199,10 +199,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers // int.TryParse is local aware, so it can be probamatic, force us culture if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval)) { - if ((item.ParentIndexNumber ?? 0) == 0) - { - item.AirsBeforeSeasonNumber = rval; - } + item.AirsBeforeSeasonNumber = rval; } } @@ -220,10 +217,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers // int.TryParse is local aware, so it can be probamatic, force us culture if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval)) { - if ((item.ParentIndexNumber ?? 0) == 0) - { - item.AirsBeforeEpisodeNumber = rval; - } + item.AirsBeforeEpisodeNumber = rval; } } From a308ab8912dc91d1bba61afa15f859eba0b2df2c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 2 Aug 2016 01:55:52 -0400 Subject: [PATCH 2/2] update components --- MediaBrowser.Model/Querying/ItemFields.cs | 1 + .../Dto/DtoService.cs | 48 ++++++------------- .../LiveTv/LiveTvManager.cs | 1 + .../Sync/SyncManager.cs | 1 + 4 files changed, 17 insertions(+), 34 deletions(-) diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index 21f87247a..0400e374a 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -219,6 +219,7 @@ /// Studios, + BasicSyncInfo, /// /// The synchronize information /// diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index f17f5e5a2..90111ad8e 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -133,7 +133,7 @@ namespace MediaBrowser.Server.Implementations.Dto } } - FillSyncInfo(dto, item, syncJobItems, options, user); + FillSyncInfo(dto, item, options, user, syncJobItems); list.Add(dto); } @@ -253,14 +253,16 @@ namespace MediaBrowser.Server.Implementations.Dto { var item = tuple.Item1; - FillSyncInfo(tuple.Item2, item, syncProgress, options, user); + FillSyncInfo(tuple.Item2, item, options, user, syncProgress); } } } private void FillSyncInfo(IHasSyncInfo dto, BaseItem item, DtoOptions options, User user, SyncedItemProgress[] syncProgress) { - if (options.Fields.Contains(ItemFields.SyncInfo)) + var hasFullSyncInfo = options.Fields.Contains(ItemFields.SyncInfo); + + if (hasFullSyncInfo || options.Fields.Contains(ItemFields.BasicSyncInfo)) { var userCanSync = user != null && user.Policy.EnableSync; dto.SupportsSync = userCanSync && _syncManager.SupportsSync(item); @@ -271,39 +273,17 @@ namespace MediaBrowser.Server.Implementations.Dto dto.HasSyncJob = syncProgress.Any(i => i.Status != SyncJobItemStatus.Synced && string.Equals(i.ItemId, dto.Id, StringComparison.OrdinalIgnoreCase)); dto.IsSynced = syncProgress.Any(i => i.Status == SyncJobItemStatus.Synced && string.Equals(i.ItemId, dto.Id, StringComparison.OrdinalIgnoreCase)); - if (dto.IsSynced.Value) + if (hasFullSyncInfo) { - dto.SyncStatus = SyncJobItemStatus.Synced; - } + if (dto.IsSynced.Value) + { + dto.SyncStatus = SyncJobItemStatus.Synced; + } - else if (dto.HasSyncJob.Value) - { - dto.SyncStatus = syncProgress.Where(i => string.Equals(i.ItemId, dto.Id, StringComparison.OrdinalIgnoreCase)).Select(i => i.Status).Max(); - } - } - } - - private void FillSyncInfo(IHasSyncInfo dto, BaseItem item, SyncedItemProgress[] syncProgress, DtoOptions options, User user) - { - if (options.Fields.Contains(ItemFields.SyncInfo)) - { - var userCanSync = user != null && user.Policy.EnableSync; - dto.SupportsSync = userCanSync && _syncManager.SupportsSync(item); - } - - if (dto.SupportsSync ?? false) - { - dto.HasSyncJob = syncProgress.Any(i => i.Status != SyncJobItemStatus.Synced && string.Equals(i.ItemId, dto.Id, StringComparison.OrdinalIgnoreCase)); - dto.IsSynced = syncProgress.Any(i => i.Status == SyncJobItemStatus.Synced && string.Equals(i.ItemId, dto.Id, StringComparison.OrdinalIgnoreCase)); - - if (dto.IsSynced.Value) - { - dto.SyncStatus = SyncJobItemStatus.Synced; - } - - else if (dto.HasSyncJob.Value) - { - dto.SyncStatus = syncProgress.Where(i => string.Equals(i.ItemId, dto.Id, StringComparison.OrdinalIgnoreCase)).Select(i => i.Status).Max(); + else if (dto.HasSyncJob.Value) + { + dto.SyncStatus = syncProgress.Where(i => string.Equals(i.ItemId, dto.Id, StringComparison.OrdinalIgnoreCase)).Select(i => i.Status).Max(); + } } } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 64af35a9a..26ec599fa 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1187,6 +1187,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv // Load these now which will prefetch metadata var dtoOptions = new DtoOptions(); dtoOptions.Fields.Remove(ItemFields.SyncInfo); + dtoOptions.Fields.Remove(ItemFields.BasicSyncInfo); await GetRecordings(new RecordingQuery(), dtoOptions, cancellationToken).ConfigureAwait(false); progress.Report(100); diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs index 92221ffba..15855f553 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs @@ -646,6 +646,7 @@ namespace MediaBrowser.Server.Implementations.Sync dtoOptions.Fields.Remove(ItemFields.SeriesGenres); dtoOptions.Fields.Remove(ItemFields.Settings); dtoOptions.Fields.Remove(ItemFields.SyncInfo); + dtoOptions.Fields.Remove(ItemFields.BasicSyncInfo); syncedItem.Item = _dtoService().GetBaseItemDto(libraryItem, dtoOptions);