diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs
index 44a367be0..3ff432d74 100644
--- a/MediaBrowser.Api/BaseApiService.cs
+++ b/MediaBrowser.Api/BaseApiService.cs
@@ -139,6 +139,10 @@ namespace MediaBrowser.Api
{
options.ImageTypeLimit = hasDtoOptions.ImageTypeLimit.Value;
}
+ if (hasDtoOptions.EnableUserData.HasValue)
+ {
+ options.EnableUserData = hasDtoOptions.EnableUserData.Value;
+ }
if (!string.IsNullOrWhiteSpace(hasDtoOptions.EnableImageTypes))
{
diff --git a/MediaBrowser.Api/IHasDtoOptions.cs b/MediaBrowser.Api/IHasDtoOptions.cs
index dac366113..6ed1670c2 100644
--- a/MediaBrowser.Api/IHasDtoOptions.cs
+++ b/MediaBrowser.Api/IHasDtoOptions.cs
@@ -4,6 +4,7 @@ namespace MediaBrowser.Api
public interface IHasDtoOptions : IHasItemFields
{
bool? EnableImages { get; set; }
+ bool? EnableUserData { get; set; }
int? ImageTypeLimit { get; set; }
diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs
index 91157cd11..545ac162f 100644
--- a/MediaBrowser.Api/LiveTv/LiveTvService.cs
+++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs
@@ -82,6 +82,9 @@ namespace MediaBrowser.Api.LiveTv
[ApiMember(Name = "AddCurrentProgram", Description = "Optional. Adds current program info to each channel", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public bool AddCurrentProgram { get; set; }
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
+
public GetChannels()
{
AddCurrentProgram = true;
@@ -149,6 +152,9 @@ namespace MediaBrowser.Api.LiveTv
public bool EnableTotalRecordCount { get; set; }
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
+
public GetRecordings()
{
EnableTotalRecordCount = true;
@@ -271,6 +277,9 @@ namespace MediaBrowser.Api.LiveTv
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get; set; }
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
+
///
/// Fields to return within the items, in addition to basic information
///
@@ -331,6 +340,9 @@ namespace MediaBrowser.Api.LiveTv
/// The fields.
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string Fields { get; set; }
+
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
}
[Route("/LiveTv/Programs/{Id}", "GET", Summary = "Gets a live tv program")]
@@ -726,7 +738,12 @@ namespace MediaBrowser.Api.LiveTv
var user = string.IsNullOrEmpty(request.UserId) ? null : _userManager.GetUserById(request.UserId);
- var returnArray = (await _dtoService.GetBaseItemDtos(channelResult.Items, GetDtoOptions(Request), user).ConfigureAwait(false)).ToArray();
+ var options = GetDtoOptions(request);
+ RemoveFields(options);
+
+ options.AddCurrentProgram = request.AddCurrentProgram;
+
+ var returnArray = (await _dtoService.GetBaseItemDtos(channelResult.Items, options, user).ConfigureAwait(false)).ToArray();
var result = new QueryResult
{
@@ -737,6 +754,14 @@ namespace MediaBrowser.Api.LiveTv
return ToOptimizedSerializedResultUsingCache(result);
}
+ private void RemoveFields(DtoOptions options)
+ {
+ options.Fields.Remove(ItemFields.CanDelete);
+ options.Fields.Remove(ItemFields.CanDownload);
+ options.Fields.Remove(ItemFields.DisplayPreferencesId);
+ options.Fields.Remove(ItemFields.Etag);
+ }
+
public object Get(GetChannel request)
{
var user = string.IsNullOrWhiteSpace(request.UserId) ? null : _userManager.GetUserById(request.UserId);
diff --git a/MediaBrowser.Api/PlaylistService.cs b/MediaBrowser.Api/PlaylistService.cs
index 604227a15..969399288 100644
--- a/MediaBrowser.Api/PlaylistService.cs
+++ b/MediaBrowser.Api/PlaylistService.cs
@@ -72,7 +72,7 @@ namespace MediaBrowser.Api
}
[Route("/Playlists/{Id}/Items", "GET", Summary = "Gets the original items of a playlist")]
- public class GetPlaylistItems : IReturn>, IHasItemFields
+ public class GetPlaylistItems : IReturn>, IHasDtoOptions
{
[ApiMember(Name = "Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
public string Id { get; set; }
@@ -104,6 +104,18 @@ namespace MediaBrowser.Api
/// The fields.
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string Fields { get; set; }
+
+ [ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableImages { get; set; }
+
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
+
+ [ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
+ public int? ImageTypeLimit { get; set; }
+
+ [ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string EnableImageTypes { get; set; }
}
[Authenticated]
diff --git a/MediaBrowser.Api/SimilarItemsHelper.cs b/MediaBrowser.Api/SimilarItemsHelper.cs
index a1e47bd8f..1621c8056 100644
--- a/MediaBrowser.Api/SimilarItemsHelper.cs
+++ b/MediaBrowser.Api/SimilarItemsHelper.cs
@@ -29,8 +29,20 @@ namespace MediaBrowser.Api
public string ExcludeArtistIds { get; set; }
}
- public class BaseGetSimilarItems : IReturn, IHasItemFields
+ public class BaseGetSimilarItems : IReturn, IHasDtoOptions
{
+ [ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableImages { get; set; }
+
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
+
+ [ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
+ public int? ImageTypeLimit { get; set; }
+
+ [ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string EnableImageTypes { get; set; }
+
///
/// Gets or sets the user id.
///
diff --git a/MediaBrowser.Api/Sync/SyncHelper.cs b/MediaBrowser.Api/Sync/SyncHelper.cs
index 0d3e8707d..2f857000c 100644
--- a/MediaBrowser.Api/Sync/SyncHelper.cs
+++ b/MediaBrowser.Api/Sync/SyncHelper.cs
@@ -24,7 +24,7 @@ namespace MediaBrowser.Api.Sync
}
break;
}
- if (item.IsFolder && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)
+ if (item.IsFolderItem && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)
{
options.Add(SyncJobOption.Quality);
options.Add(SyncJobOption.Profile);
@@ -44,7 +44,7 @@ namespace MediaBrowser.Api.Sync
{
if (item.SupportsSync ?? false)
{
- if (item.IsFolder || item.IsGameGenre || item.IsMusicGenre || item.IsGenre || item.IsArtist || item.IsStudio || item.IsPerson)
+ if (item.IsFolderItem || item.IsGameGenre || item.IsMusicGenre || item.IsGenre || item.IsArtist || item.IsStudio || item.IsPerson)
{
options.Add(SyncJobOption.SyncNewContent);
options.Add(SyncJobOption.ItemLimit);
diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs
index 92189c245..e295f3b3a 100644
--- a/MediaBrowser.Api/TvShowsService.cs
+++ b/MediaBrowser.Api/TvShowsService.cs
@@ -69,6 +69,9 @@ namespace MediaBrowser.Api
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get; set; }
+
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
}
[Route("/Shows/Upcoming", "GET", Summary = "Gets a list of upcoming episodes")]
@@ -117,6 +120,9 @@ namespace MediaBrowser.Api
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get; set; }
+
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
}
[Route("/Shows/{Id}/Similar", "GET", Summary = "Finds tv shows similar to a given one.")]
@@ -184,6 +190,10 @@ namespace MediaBrowser.Api
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get; set; }
+
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
+
}
[Route("/Shows/{Id}/Seasons", "GET", Summary = "Gets seasons for a tv series")]
@@ -226,6 +236,10 @@ namespace MediaBrowser.Api
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get; set; }
+
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
+
}
///
diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs
index 3e9a541c0..96acb1f60 100644
--- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs
+++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs
@@ -226,6 +226,9 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableImages { get; set; }
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
+
[ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? ImageTypeLimit { get; set; }
diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
index bbccef6de..c392ef463 100644
--- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
+++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
@@ -246,6 +246,9 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get; set; }
+ [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+ public bool? EnableUserData { get; set; }
+
public GetLatestMedia()
{
Limit = 20;
diff --git a/MediaBrowser.Controller/Dto/DtoOptions.cs b/MediaBrowser.Controller/Dto/DtoOptions.cs
index d627cc67a..e69b64948 100644
--- a/MediaBrowser.Controller/Dto/DtoOptions.cs
+++ b/MediaBrowser.Controller/Dto/DtoOptions.cs
@@ -19,12 +19,16 @@ namespace MediaBrowser.Controller.Dto
public bool EnableImages { get; set; }
public bool AddProgramRecordingInfo { get; set; }
public string DeviceId { get; set; }
+ public bool EnableUserData { get; set; }
+ public bool AddCurrentProgram { get; set; }
public DtoOptions()
{
Fields = new List();
ImageTypeLimit = int.MaxValue;
EnableImages = true;
+ EnableUserData = true;
+ AddCurrentProgram = true;
Fields = Enum.GetNames(typeof (ItemFields))
.Select(i => (ItemFields) Enum.Parse(typeof (ItemFields), i, true))
diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs
index 7d69359d1..348a781ae 100644
--- a/MediaBrowser.Model/Dto/BaseItemDto.cs
+++ b/MediaBrowser.Model/Dto/BaseItemDto.cs
@@ -346,7 +346,16 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets a value indicating whether this instance is folder.
///
/// true if this instance is folder; otherwise, false.
- public bool IsFolder { get; set; }
+ public bool? IsFolder { get; set; }
+
+ [IgnoreDataMember]
+ public bool IsFolderItem
+ {
+ get
+ {
+ return IsFolder ?? false;
+ }
+ }
///
/// Gets or sets the parent id.
@@ -656,7 +665,7 @@ namespace MediaBrowser.Model.Dto
{
get
{
- return RunTimeTicks.HasValue || IsFolder || IsGenre || IsMusicGenre || IsArtist;
+ return RunTimeTicks.HasValue || IsFolderItem || IsGenre || IsMusicGenre || IsArtist;
}
}
diff --git a/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs b/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs
index 3a6ad0444..0ece1e4a0 100644
--- a/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs
+++ b/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs
@@ -59,5 +59,11 @@ namespace MediaBrowser.Model.LiveTv
///
/// true if [add current program]; otherwise, false.
public bool AddCurrentProgram { get; set; }
+ public bool EnableUserData { get; set; }
+
+ public LiveTvChannelQuery()
+ {
+ EnableUserData = true;
+ }
}
}
diff --git a/MediaBrowser.Model/LiveTv/ProgramQuery.cs b/MediaBrowser.Model/LiveTv/ProgramQuery.cs
index 0141191c1..bf459237a 100644
--- a/MediaBrowser.Model/LiveTv/ProgramQuery.cs
+++ b/MediaBrowser.Model/LiveTv/ProgramQuery.cs
@@ -15,9 +15,11 @@ namespace MediaBrowser.Model.LiveTv
SortBy = new string[] { };
Genres = new string[] { };
EnableTotalRecordCount = true;
+ EnableUserData = true;
}
public bool EnableTotalRecordCount { get; set; }
+ public bool EnableUserData { get; set; }
///
/// Fields to return within the items, in addition to basic information
diff --git a/MediaBrowser.Model/Sync/SyncJobQuery.cs b/MediaBrowser.Model/Sync/SyncJobQuery.cs
index e86ec929f..bb99b5d5f 100644
--- a/MediaBrowser.Model/Sync/SyncJobQuery.cs
+++ b/MediaBrowser.Model/Sync/SyncJobQuery.cs
@@ -23,6 +23,7 @@ namespace MediaBrowser.Model.Sync
///
/// The user identifier.
public string UserId { get; set; }
+ public string ExcludeTargetIds { get; set; }
///
/// Gets or sets the status.
///
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index b646605ed..3d257d194 100644
--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs
+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
@@ -329,7 +329,7 @@ namespace MediaBrowser.Server.Implementations.Dto
if (user != null)
{
- await AttachUserSpecificInfo(dto, item, user, fields).ConfigureAwait(false);
+ await AttachUserSpecificInfo(dto, item, user, options).ConfigureAwait(false);
}
var hasMediaSources = item as IHasMediaSources;
@@ -446,17 +446,18 @@ namespace MediaBrowser.Server.Implementations.Dto
///
/// Attaches the user specific info.
///
- /// The dto.
- /// The item.
- /// The user.
- /// The fields.
- private async Task AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, List fields)
+ private async Task AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, DtoOptions dtoOptions)
{
+ var fields = dtoOptions.Fields;
+
if (item.IsFolder)
{
var folder = (Folder)item;
- dto.UserData = await _userDataRepository.GetUserDataDto(item, dto, user).ConfigureAwait(false);
+ if (dtoOptions.EnableUserData)
+ {
+ dto.UserData = await _userDataRepository.GetUserDataDto(item, dto, user).ConfigureAwait(false);
+ }
if (!dto.ChildCount.HasValue && item.SourceType == SourceType.Library)
{
@@ -476,7 +477,10 @@ namespace MediaBrowser.Server.Implementations.Dto
else
{
- dto.UserData = _userDataRepository.GetUserDataDto(item, user).Result;
+ if (dtoOptions.EnableUserData)
+ {
+ dto.UserData = _userDataRepository.GetUserDataDto(item, user).Result;
+ }
}
dto.PlayAccess = item.GetPlayAccess(user);
@@ -484,7 +488,10 @@ namespace MediaBrowser.Server.Implementations.Dto
if (fields.Contains(ItemFields.BasicSyncInfo) || fields.Contains(ItemFields.SyncInfo))
{
var userCanSync = user != null && user.Policy.EnableSync;
- dto.SupportsSync = userCanSync && _syncManager.SupportsSync(item);
+ if (userCanSync && _syncManager.SupportsSync(item))
+ {
+ dto.SupportsSync = true;
+ }
}
if (fields.Contains(ItemFields.SeasonUserData))
@@ -969,7 +976,16 @@ namespace MediaBrowser.Server.Implementations.Dto
dto.Id = GetDtoId(item);
dto.IndexNumber = item.IndexNumber;
dto.ParentIndexNumber = item.ParentIndexNumber;
- dto.IsFolder = item.IsFolder;
+
+ if (item.IsFolder)
+ {
+ dto.IsFolder = true;
+ }
+ else if (item is IHasMediaSources)
+ {
+ dto.IsFolder = false;
+ }
+
dto.MediaType = item.MediaType;
dto.LocationType = item.LocationType;
if (item.IsHD.HasValue && item.IsHD.Value)
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
index 09d156661..ccbcb910d 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -951,6 +951,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var queryResult = _libraryManager.QueryItems(internalQuery);
+ RemoveFields(options);
+
var returnArray = (await _dtoService.GetBaseItemDtos(queryResult.Items, options, user).ConfigureAwait(false)).ToArray();
var result = new QueryResult
@@ -1031,6 +1033,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var user = _userManager.GetUserById(query.UserId);
+ RemoveFields(options);
+
var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user).ConfigureAwait(false)).ToArray();
var result = new QueryResult
@@ -1662,6 +1666,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var internalResult = await GetInternalRecordings(query, cancellationToken).ConfigureAwait(false);
+ RemoveFields(options);
+
var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user).ConfigureAwait(false)).ToArray();
return new QueryResult
@@ -1922,7 +1928,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var channelIds = tuples.Select(i => i.Item2.Id.ToString("N")).Distinct().ToArray();
- var programs = _libraryManager.GetItemList(new InternalItemsQuery(user)
+ var programs = options.AddCurrentProgram ? _libraryManager.GetItemList(new InternalItemsQuery(user)
{
IncludeItemTypes = new[] { typeof(LiveTvProgram).Name },
ChannelIds = channelIds,
@@ -1932,7 +1938,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
SortBy = new[] { "StartDate" },
TopParentIds = new[] { GetInternalLiveTvFolder(CancellationToken.None).Result.Id.ToString("N") }
- }).ToList();
+ }).ToList() : new List();
+
+ RemoveFields(options);
foreach (var tuple in tuples)
{
@@ -1944,14 +1952,20 @@ namespace MediaBrowser.Server.Implementations.LiveTv
dto.ChannelType = channel.ChannelType;
dto.ServiceName = GetService(channel).Name;
- dto.MediaSources = channel.GetMediaSources(true).ToList();
+ if (options.Fields.Contains(ItemFields.MediaSources))
+ {
+ dto.MediaSources = channel.GetMediaSources(true).ToList();
+ }
var channelIdString = channel.Id.ToString("N");
- var currentProgram = programs.FirstOrDefault(i => string.Equals(i.ChannelId, channelIdString));
-
- if (currentProgram != null)
+ if (options.AddCurrentProgram)
{
- dto.CurrentProgram = _dtoService.GetBaseItemDto(currentProgram, options, user);
+ var currentProgram = programs.FirstOrDefault(i => string.Equals(i.ChannelId, channelIdString));
+
+ if (currentProgram != null)
+ {
+ dto.CurrentProgram = _dtoService.GetBaseItemDto(currentProgram, options, user);
+ }
}
}
}
@@ -2447,6 +2461,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return _dtoService.GetBaseItemDto(folder, new DtoOptions(), user);
}
+ private void RemoveFields(DtoOptions options)
+ {
+ options.Fields.Remove(ItemFields.CanDelete);
+ options.Fields.Remove(ItemFields.CanDownload);
+ options.Fields.Remove(ItemFields.DisplayPreferencesId);
+ options.Fields.Remove(ItemFields.Etag);
+ }
+
public async Task GetInternalLiveTvFolder(CancellationToken cancellationToken)
{
var name = _localization.GetLocalizedString("ViewTypeLiveTV");
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs b/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs
index d7c77e655..6b7bcfa01 100644
--- a/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs
+++ b/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs
@@ -414,6 +414,20 @@ namespace MediaBrowser.Server.Implementations.Sync
whereClauses.Add("TargetId=@TargetId");
cmd.Parameters.Add(cmd, "@TargetId", DbType.String).Value = query.TargetId;
}
+ if (!string.IsNullOrWhiteSpace(query.ExcludeTargetIds))
+ {
+ var excludeIds = (query.ExcludeTargetIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+ if (excludeIds.Length == 1)
+ {
+ whereClauses.Add("TargetId<>@ExcludeTargetId");
+ cmd.Parameters.Add(cmd, "@ExcludeTargetId", DbType.String).Value = excludeIds[0];
+ }
+ else if (excludeIds.Length > 1)
+ {
+ whereClauses.Add("TargetId<>@ExcludeTargetId");
+ cmd.Parameters.Add(cmd, "@ExcludeTargetId", DbType.String).Value = excludeIds[0];
+ }
+ }
if (!string.IsNullOrWhiteSpace(query.UserId))
{
whereClauses.Add("UserId=@UserId");