diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs
index 7a1c78112f..c49a1f77ed 100644
--- a/MediaBrowser.Model/Dto/BaseItemDto.cs
+++ b/MediaBrowser.Model/Dto/BaseItemDto.cs
@@ -29,19 +29,19 @@ namespace MediaBrowser.Model.Dto
///
/// The server identifier.
public string ServerId { get; set; }
-
+
///
/// Gets or sets the id.
///
/// The id.
public string Id { get; set; }
-
+
///
/// Gets or sets the playlist item identifier.
///
/// The playlist item identifier.
public string PlaylistItemId { get; set; }
-
+
///
/// Gets or sets the date created.
///
@@ -50,7 +50,7 @@ namespace MediaBrowser.Model.Dto
public DateTime? DateLastMediaAdded { get; set; }
public ExtraType? ExtraType { get; set; }
-
+
public int? AirsBeforeSeasonNumber { get; set; }
public int? AirsAfterSeasonNumber { get; set; }
public int? AirsBeforeEpisodeNumber { get; set; }
@@ -71,8 +71,21 @@ namespace MediaBrowser.Model.Dto
public int? AnimeSeriesIndex { get; set; }
+ ///
+ /// Gets or sets a value indicating whether [supports synchronize].
+ ///
+ /// null if [supports synchronize] contains no value, true if [supports synchronize]; otherwise, false.
public bool? SupportsSync { get; set; }
+ ///
+ /// Gets or sets a value indicating whether this instance has synchronize job.
+ ///
+ /// null if [has synchronize job] contains no value, true if [has synchronize job]; otherwise, false.
public bool? HasSyncJob { get; set; }
+ ///
+ /// Gets or sets a value indicating whether this instance is synced.
+ ///
+ /// null if [is synced] contains no value, true if [is synced]; otherwise, false.
+ public bool? IsSynced { get; set; }
///
/// Gets or sets the DVD season number.
@@ -84,7 +97,7 @@ namespace MediaBrowser.Model.Dto
///
/// The DVD episode number.
public float? DvdEpisodeNumber { get; set; }
-
+
///
/// Gets or sets the name of the sort.
///
@@ -97,7 +110,7 @@ namespace MediaBrowser.Model.Dto
///
/// The video3 D format.
public Video3DFormat? Video3DFormat { get; set; }
-
+
///
/// Gets or sets the premiere date.
///
@@ -115,7 +128,7 @@ namespace MediaBrowser.Model.Dto
///
/// The media versions.
public List MediaSources { get; set; }
-
+
///
/// Gets or sets the critic rating.
///
@@ -127,7 +140,7 @@ namespace MediaBrowser.Model.Dto
///
/// The game system.
public string GameSystem { get; set; }
-
+
///
/// Gets or sets the critic rating summary.
///
@@ -135,13 +148,13 @@ namespace MediaBrowser.Model.Dto
public string CriticRatingSummary { get; set; }
public List MultiPartGameFiles { get; set; }
-
+
///
/// Gets or sets the path.
///
/// The path.
public string Path { get; set; }
-
+
///
/// Gets or sets the official rating.
///
@@ -178,7 +191,7 @@ namespace MediaBrowser.Model.Dto
///
/// The name of the TMDB collection.
public string TmdbCollectionName { get; set; }
-
+
///
/// Gets or sets the taglines.
///
@@ -196,7 +209,7 @@ namespace MediaBrowser.Model.Dto
///
/// The series genres.
public List SeriesGenres { get; set; }
-
+
///
/// Gets or sets the community rating.
///
@@ -220,7 +233,7 @@ namespace MediaBrowser.Model.Dto
///
/// The original run time ticks.
public long? OriginalRunTimeTicks { get; set; }
-
+
///
/// Gets or sets the run time ticks.
///
@@ -232,7 +245,7 @@ namespace MediaBrowser.Model.Dto
///
/// The play access.
public PlayAccess PlayAccess { get; set; }
-
+
///
/// Gets or sets the aspect ratio.
///
@@ -250,7 +263,7 @@ namespace MediaBrowser.Model.Dto
///
/// The season count.
public int? SeasonCount { get; set; }
-
+
///
/// Gets or sets the players supported by a game.
///
@@ -262,7 +275,7 @@ namespace MediaBrowser.Model.Dto
///
/// null if [is place holder] contains no value, true if [is place holder]; otherwise, false.
public bool? IsPlaceHolder { get; set; }
-
+
///
/// Gets or sets the index number.
///
@@ -292,7 +305,7 @@ namespace MediaBrowser.Model.Dto
///
/// The soundtrack ids.
public string[] SoundtrackIds { get; set; }
-
+
///
/// Gets or sets the provider ids.
///
@@ -304,7 +317,7 @@ namespace MediaBrowser.Model.Dto
///
/// null if [is HD] contains no value, true if [is HD]; otherwise, false.
public bool? IsHD { get; set; }
-
+
///
/// Gets or sets a value indicating whether this instance is folder.
///
@@ -399,7 +412,7 @@ namespace MediaBrowser.Model.Dto
///
/// The season identifier.
public string SeasonId { get; set; }
-
+
///
/// Gets or sets the special feature count.
///
@@ -447,7 +460,7 @@ namespace MediaBrowser.Model.Dto
///
/// The keywords.
public List Keywords { get; set; }
-
+
///
/// Gets or sets the primary image aspect ratio, after image enhancements.
///
@@ -483,13 +496,13 @@ namespace MediaBrowser.Model.Dto
///
/// The type of the collection.
public string CollectionType { get; set; }
-
+
///
/// Gets or sets the display order.
///
/// The display order.
public string DisplayOrder { get; set; }
-
+
///
/// Gets or sets the album id.
///
@@ -506,7 +519,7 @@ namespace MediaBrowser.Model.Dto
///
/// The series primary image tag.
public string SeriesPrimaryImageTag { get; set; }
-
+
///
/// Gets or sets the album artist.
///
@@ -518,13 +531,13 @@ namespace MediaBrowser.Model.Dto
///
/// The album artists.
public List AlbumArtists { get; set; }
-
+
///
/// Gets or sets the name of the season.
///
/// The name of the season.
public string SeasonName { get; set; }
-
+
///
/// Gets or sets the media streams.
///
@@ -629,7 +642,7 @@ namespace MediaBrowser.Model.Dto
///
/// The series studio.
public string SeriesStudio { get; set; }
-
+
///
/// Gets or sets the parent thumb item id.
///
@@ -749,7 +762,7 @@ namespace MediaBrowser.Model.Dto
///
/// The music video count.
public int? MusicVideoCount { get; set; }
-
+
///
/// Gets or sets a value indicating whether [enable internet providers].
///
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index dc6f4a5250..8934c9c8fc 100644
--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs
+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
@@ -85,7 +85,7 @@ namespace MediaBrowser.Server.Implementations.Dto
public IEnumerable GetBaseItemDtos(IEnumerable items, DtoOptions options, User user = null, BaseItem owner = null)
{
- var itemIdsWithSyncJobs = GetItemIdsWithSyncJobs(options).ToList();
+ var tuple = GetItemIdsWithSyncJobs(options);
var list = new List();
@@ -109,7 +109,7 @@ namespace MediaBrowser.Server.Implementations.Dto
}
}
- FillSyncInfo(dto, item, itemIdsWithSyncJobs, options, user);
+ FillSyncInfo(dto, item, tuple.Item1, tuple.Item2, options, user);
list.Add(dto);
}
@@ -145,29 +145,29 @@ namespace MediaBrowser.Server.Implementations.Dto
return dto;
}
- private IEnumerable GetItemIdsWithSyncJobs(DtoOptions options)
+ private Tuple, IEnumerable> GetItemIdsWithSyncJobs(DtoOptions options)
{
if (!options.Fields.Contains(ItemFields.SyncInfo))
{
- return new List();
+ return new Tuple, IEnumerable>(new List(), new List());
}
var deviceId = options.DeviceId;
if (string.IsNullOrWhiteSpace(deviceId))
{
- return new List();
+ return new Tuple, IEnumerable>(new List(), new List());
}
var caps = _deviceManager().GetCapabilities(deviceId);
if (caps == null || !caps.SupportsSync)
{
- return new List();
+ return new Tuple, IEnumerable>(new List(), new List());
}
- var result = _syncManager.GetLibraryItemIds(new SyncJobItemQuery
+ var result1 = _syncManager.GetLibraryItemIds(new SyncJobItemQuery
{
TargetId = deviceId,
- Statuses = new SyncJobItemStatus[]
+ Statuses = new[]
{
SyncJobItemStatus.Converting,
SyncJobItemStatus.Queued,
@@ -176,7 +176,16 @@ namespace MediaBrowser.Server.Implementations.Dto
}
});
- return result.Items;
+ var result2 = _syncManager.GetLibraryItemIds(new SyncJobItemQuery
+ {
+ TargetId = deviceId,
+ Statuses = new[]
+ {
+ SyncJobItemStatus.Synced
+ }
+ });
+
+ return new Tuple, IEnumerable>(result1.Items, result2.Items);
}
private void FillSyncInfo(BaseItemDto dto, BaseItem item, DtoOptions options, User user)
@@ -189,11 +198,14 @@ namespace MediaBrowser.Server.Implementations.Dto
if (dto.SupportsSync ?? false)
{
- dto.HasSyncJob = GetItemIdsWithSyncJobs(options).Contains(dto.Id, StringComparer.OrdinalIgnoreCase);
+ var tuple = GetItemIdsWithSyncJobs(options);
+
+ dto.HasSyncJob = tuple.Item1.Contains(dto.Id, StringComparer.OrdinalIgnoreCase);
+ dto.IsSynced = tuple.Item2.Contains(dto.Id, StringComparer.OrdinalIgnoreCase);
}
}
- private void FillSyncInfo(BaseItemDto dto, BaseItem item, IEnumerable itemIdsWithSyncJobs, DtoOptions options, User user)
+ private void FillSyncInfo(BaseItemDto dto, BaseItem item, IEnumerable itemIdsWithPendingSyncJobs, IEnumerable syncedItemIds, DtoOptions options, User user)
{
if (options.Fields.Contains(ItemFields.SyncInfo))
{
@@ -203,7 +215,8 @@ namespace MediaBrowser.Server.Implementations.Dto
if (dto.SupportsSync ?? false)
{
- dto.HasSyncJob = itemIdsWithSyncJobs.Contains(dto.Id, StringComparer.OrdinalIgnoreCase);
+ dto.HasSyncJob = itemIdsWithPendingSyncJobs.Contains(dto.Id, StringComparer.OrdinalIgnoreCase);
+ dto.IsSynced = syncedItemIds.Contains(dto.Id, StringComparer.OrdinalIgnoreCase);
}
}
@@ -269,7 +282,7 @@ namespace MediaBrowser.Server.Implementations.Dto
}
}
}
-
+
if (fields.Contains(ItemFields.Studios))
{
AttachStudios(dto, item);
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
index c0435a81e2..185c3464ea 100644
--- a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
+++ b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
@@ -394,7 +394,7 @@ namespace MediaBrowser.Server.Implementations.Sync
AddMetadata = false
});
- await SyncJobItems(result.Items, true, progress, cancellationToken).ConfigureAwait(false);
+ await SyncJobItems(result.Items, enableConversion, progress, cancellationToken).ConfigureAwait(false);
}
public async Task SyncJobItems(SyncJobItem[] items, bool enableConversion, IProgress progress, CancellationToken cancellationToken)