update query fields
This commit is contained in:
parent
54cf0da758
commit
2f93d4498b
|
@ -1347,6 +1347,11 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
private BaseItem GetItem(IReadOnlyList<IResultSetValue> reader, InternalItemsQuery query)
|
private BaseItem GetItem(IReadOnlyList<IResultSetValue> reader, InternalItemsQuery query)
|
||||||
|
{
|
||||||
|
return GetItem(reader, query, HasProgramAttributes(query), HasEpisodeAttributes(query), HasStartDate(query), HasTrailerTypes(query), HasArtistFields(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
private BaseItem GetItem(IReadOnlyList<IResultSetValue> reader, InternalItemsQuery query, bool enableProgramAttributes, bool hasEpisodeAttributes, bool queryHasStartDate, bool hasTrailerTypes, bool hasArtistFields)
|
||||||
{
|
{
|
||||||
var typeString = reader.GetString(0);
|
var typeString = reader.GetString(0);
|
||||||
|
|
||||||
|
@ -1394,28 +1399,34 @@ namespace Emby.Server.Implementations.Data
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reader.IsDBNull(2))
|
var index = 2;
|
||||||
|
|
||||||
|
if (queryHasStartDate)
|
||||||
|
{
|
||||||
|
if (!reader.IsDBNull(index))
|
||||||
{
|
{
|
||||||
var hasStartDate = item as IHasStartDate;
|
var hasStartDate = item as IHasStartDate;
|
||||||
if (hasStartDate != null)
|
if (hasStartDate != null)
|
||||||
{
|
{
|
||||||
hasStartDate.StartDate = reader[2].ReadDateTime();
|
hasStartDate.StartDate = reader[index].ReadDateTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!reader.IsDBNull(3))
|
if (!reader.IsDBNull(index))
|
||||||
{
|
{
|
||||||
item.EndDate = reader[3].ReadDateTime();
|
item.EndDate = reader[index].ReadDateTime();
|
||||||
}
|
}
|
||||||
|
index++;
|
||||||
|
|
||||||
if (!reader.IsDBNull(4))
|
if (!reader.IsDBNull(index))
|
||||||
{
|
{
|
||||||
item.ChannelId = reader.GetString(4);
|
item.ChannelId = reader.GetString(index);
|
||||||
}
|
}
|
||||||
|
index++;
|
||||||
|
|
||||||
var index = 5;
|
if (enableProgramAttributes)
|
||||||
|
|
||||||
if (HasProgramAttributes(query))
|
|
||||||
{
|
{
|
||||||
var hasProgramAttributes = item as IHasProgramAttributes;
|
var hasProgramAttributes = item as IHasProgramAttributes;
|
||||||
if (hasProgramAttributes != null)
|
if (hasProgramAttributes != null)
|
||||||
|
@ -1728,6 +1739,8 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
|
if (hasTrailerTypes)
|
||||||
|
{
|
||||||
var trailer = item as Trailer;
|
var trailer = item as Trailer;
|
||||||
if (trailer != null)
|
if (trailer != null)
|
||||||
{
|
{
|
||||||
|
@ -1737,6 +1750,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
if (HasField(query, ItemFields.OriginalTitle))
|
if (HasField(query, ItemFields.OriginalTitle))
|
||||||
{
|
{
|
||||||
|
@ -1795,6 +1809,8 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
|
if (hasEpisodeAttributes)
|
||||||
|
{
|
||||||
var episode = item as Episode;
|
var episode = item as Episode;
|
||||||
if (episode != null)
|
if (episode != null)
|
||||||
{
|
{
|
||||||
|
@ -1813,6 +1829,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasSeries != null)
|
if (hasSeries != null)
|
||||||
{
|
{
|
||||||
|
@ -1931,6 +1948,8 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
|
if (hasArtistFields)
|
||||||
|
{
|
||||||
var hasArtists = item as IHasArtist;
|
var hasArtists = item as IHasArtist;
|
||||||
if (hasArtists != null && !reader.IsDBNull(index))
|
if (hasArtists != null && !reader.IsDBNull(index))
|
||||||
{
|
{
|
||||||
|
@ -1944,6 +1963,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
hasAlbumArtists.AlbumArtists = reader.GetString(index).Split('|').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
|
hasAlbumArtists.AlbumArtists = reader.GetString(index).Split('|').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!reader.IsDBNull(index))
|
if (!reader.IsDBNull(index))
|
||||||
{
|
{
|
||||||
|
@ -2312,6 +2332,20 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
private bool HasProgramAttributes(InternalItemsQuery query)
|
private bool HasProgramAttributes(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
|
var excludeParentTypes = new string[]
|
||||||
|
{
|
||||||
|
"Series",
|
||||||
|
"Season",
|
||||||
|
"MusicAlbum",
|
||||||
|
"MusicArtist",
|
||||||
|
"PhotoAlbum"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (excludeParentTypes.Contains(query.ParentType ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (query.IncludeItemTypes.Length == 0)
|
if (query.IncludeItemTypes.Length == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -2331,6 +2365,102 @@ namespace Emby.Server.Implementations.Data
|
||||||
return types.Any(i => query.IncludeItemTypes.Contains(i, StringComparer.OrdinalIgnoreCase));
|
return types.Any(i => query.IncludeItemTypes.Contains(i, StringComparer.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool HasStartDate(InternalItemsQuery query)
|
||||||
|
{
|
||||||
|
var excludeParentTypes = new string[]
|
||||||
|
{
|
||||||
|
"Series",
|
||||||
|
"Season",
|
||||||
|
"MusicAlbum",
|
||||||
|
"MusicArtist",
|
||||||
|
"PhotoAlbum"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (excludeParentTypes.Contains(query.ParentType ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (query.IncludeItemTypes.Length == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var types = new string[]
|
||||||
|
{
|
||||||
|
"Program",
|
||||||
|
"Recording",
|
||||||
|
"LiveTvAudioRecording",
|
||||||
|
"LiveTvVideoRecording",
|
||||||
|
"LiveTvProgram"
|
||||||
|
};
|
||||||
|
|
||||||
|
return types.Any(i => query.IncludeItemTypes.Contains(i, StringComparer.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool HasEpisodeAttributes(InternalItemsQuery query)
|
||||||
|
{
|
||||||
|
if (query.IncludeItemTypes.Length == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var types = new string[]
|
||||||
|
{
|
||||||
|
"Episode"
|
||||||
|
};
|
||||||
|
|
||||||
|
return types.Any(i => query.IncludeItemTypes.Contains(i, StringComparer.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool HasTrailerTypes(InternalItemsQuery query)
|
||||||
|
{
|
||||||
|
if (query.IncludeItemTypes.Length == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var types = new string[]
|
||||||
|
{
|
||||||
|
"Trailer"
|
||||||
|
};
|
||||||
|
|
||||||
|
return types.Any(i => query.IncludeItemTypes.Contains(i, StringComparer.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool HasArtistFields(InternalItemsQuery query)
|
||||||
|
{
|
||||||
|
var excludeParentTypes = new string[]
|
||||||
|
{
|
||||||
|
"Series",
|
||||||
|
"Season",
|
||||||
|
"PhotoAlbum"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (excludeParentTypes.Contains(query.ParentType ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (query.IncludeItemTypes.Length == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var types = new string[]
|
||||||
|
{
|
||||||
|
"Audio",
|
||||||
|
"MusicAlbum",
|
||||||
|
"MusicVideo",
|
||||||
|
"AudioBook",
|
||||||
|
"AudioPodcast",
|
||||||
|
"LiveTvAudioRecording",
|
||||||
|
"Recording"
|
||||||
|
};
|
||||||
|
|
||||||
|
return types.Any(i => query.IncludeItemTypes.Contains(i, StringComparer.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
|
||||||
private string[] GetFinalColumnsToSelect(InternalItemsQuery query, string[] startColumns)
|
private string[] GetFinalColumnsToSelect(InternalItemsQuery query, string[] startColumns)
|
||||||
{
|
{
|
||||||
var list = startColumns.ToList();
|
var list = startColumns.ToList();
|
||||||
|
@ -2359,6 +2489,34 @@ namespace Emby.Server.Implementations.Data
|
||||||
list.Remove("IsRepeat");
|
list.Remove("IsRepeat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!HasEpisodeAttributes(query))
|
||||||
|
{
|
||||||
|
list.Remove("SeasonName");
|
||||||
|
list.Remove("SeasonId");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!HasStartDate(query))
|
||||||
|
{
|
||||||
|
list.Remove("StartDate");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!HasTrailerTypes(query))
|
||||||
|
{
|
||||||
|
list.Remove("TrailerTypes");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!HasArtistFields(query))
|
||||||
|
{
|
||||||
|
list.Remove("AlbumArtists");
|
||||||
|
list.Remove("Artists");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!HasEpisodeAttributes(query))
|
||||||
|
{
|
||||||
|
list.Remove("SeasonName");
|
||||||
|
list.Remove("SeasonId");
|
||||||
|
}
|
||||||
|
|
||||||
if (!query.DtoOptions.EnableImages)
|
if (!query.DtoOptions.EnableImages)
|
||||||
{
|
{
|
||||||
list.Remove("Images");
|
list.Remove("Images");
|
||||||
|
@ -2590,9 +2748,15 @@ namespace Emby.Server.Implementations.Data
|
||||||
// Running this again will bind the params
|
// Running this again will bind the params
|
||||||
GetWhereClauses(query, statement);
|
GetWhereClauses(query, statement);
|
||||||
|
|
||||||
|
var hasEpisodeAttributes = HasEpisodeAttributes(query);
|
||||||
|
var hasProgramAttributes = HasProgramAttributes(query);
|
||||||
|
var hasStartDate = HasStartDate(query);
|
||||||
|
var hasTrailerTypes = HasTrailerTypes(query);
|
||||||
|
var hasArtistFields = HasArtistFields(query);
|
||||||
|
|
||||||
foreach (var row in statement.ExecuteQuery())
|
foreach (var row in statement.ExecuteQuery())
|
||||||
{
|
{
|
||||||
var item = GetItem(row, query);
|
var item = GetItem(row, query, hasProgramAttributes, hasEpisodeAttributes, hasStartDate, hasTrailerTypes, hasArtistFields);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
|
@ -2792,9 +2956,15 @@ namespace Emby.Server.Implementations.Data
|
||||||
// Running this again will bind the params
|
// Running this again will bind the params
|
||||||
GetWhereClauses(query, statement);
|
GetWhereClauses(query, statement);
|
||||||
|
|
||||||
|
var hasEpisodeAttributes = HasEpisodeAttributes(query);
|
||||||
|
var hasProgramAttributes = HasProgramAttributes(query);
|
||||||
|
var hasStartDate = HasStartDate(query);
|
||||||
|
var hasTrailerTypes = HasTrailerTypes(query);
|
||||||
|
var hasArtistFields = HasArtistFields(query);
|
||||||
|
|
||||||
foreach (var row in statement.ExecuteQuery())
|
foreach (var row in statement.ExecuteQuery())
|
||||||
{
|
{
|
||||||
var item = GetItem(row, query);
|
var item = GetItem(row, query, hasProgramAttributes, hasEpisodeAttributes, hasStartDate, hasTrailerTypes, hasArtistFields);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
|
@ -3562,6 +3732,15 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (query.MinDateLastSavedForUser.HasValue)
|
||||||
|
{
|
||||||
|
whereClauses.Add("DateLastSaved>=@MinDateLastSaved");
|
||||||
|
if (statement != null)
|
||||||
|
{
|
||||||
|
statement.TryBind("@MinDateLastSaved", query.MinDateLastSavedForUser.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//if (query.MinPlayers.HasValue)
|
//if (query.MinPlayers.HasValue)
|
||||||
//{
|
//{
|
||||||
// whereClauses.Add("Players>=@MinPlayers");
|
// whereClauses.Add("Players>=@MinPlayers");
|
||||||
|
@ -3756,7 +3935,6 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.SlugName))
|
if (!string.IsNullOrWhiteSpace(query.SlugName))
|
||||||
{
|
{
|
||||||
Logger.Info("Searching by SlugName for {0}", query.SlugName);
|
|
||||||
whereClauses.Add("CleanName=@SlugName");
|
whereClauses.Add("CleanName=@SlugName");
|
||||||
if (statement != null)
|
if (statement != null)
|
||||||
{
|
{
|
||||||
|
@ -5137,9 +5315,15 @@ namespace Emby.Server.Implementations.Data
|
||||||
GetWhereClauses(innerQuery, statement);
|
GetWhereClauses(innerQuery, statement);
|
||||||
GetWhereClauses(outerQuery, statement);
|
GetWhereClauses(outerQuery, statement);
|
||||||
|
|
||||||
|
var hasEpisodeAttributes = HasEpisodeAttributes(query);
|
||||||
|
var hasProgramAttributes = HasProgramAttributes(query);
|
||||||
|
var hasStartDate = HasStartDate(query);
|
||||||
|
var hasTrailerTypes = HasTrailerTypes(query);
|
||||||
|
var hasArtistFields = HasArtistFields(query);
|
||||||
|
|
||||||
foreach (var row in statement.ExecuteQuery())
|
foreach (var row in statement.ExecuteQuery())
|
||||||
{
|
{
|
||||||
var item = GetItem(row, query);
|
var item = GetItem(row, query, hasProgramAttributes, hasEpisodeAttributes, hasStartDate, hasTrailerTypes, hasArtistFields);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
var countStartColumn = columns.Count - 1;
|
var countStartColumn = columns.Count - 1;
|
||||||
|
|
|
@ -1546,7 +1546,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
query.ParentId = null;
|
query.Parent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddUserToQuery(InternalItemsQuery query, User user)
|
private void AddUserToQuery(InternalItemsQuery query, User user)
|
||||||
|
|
|
@ -68,15 +68,18 @@ namespace MediaBrowser.Api.Playback
|
||||||
if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var userAgent = UserAgent ?? string.Empty;
|
var userAgent = UserAgent ?? string.Empty;
|
||||||
if (userAgent.IndexOf("AppleTV", StringComparison.OrdinalIgnoreCase) != -1)
|
|
||||||
{
|
if (userAgent.IndexOf("AppleTV", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
return 10;
|
userAgent.IndexOf("cfnetwork", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
}
|
|
||||||
if (userAgent.IndexOf("cfnetwork", StringComparison.OrdinalIgnoreCase) != -1 ||
|
|
||||||
userAgent.IndexOf("ipad", StringComparison.OrdinalIgnoreCase) != -1 ||
|
userAgent.IndexOf("ipad", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
userAgent.IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 ||
|
userAgent.IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
userAgent.IndexOf("ipod", StringComparison.OrdinalIgnoreCase) != -1)
|
userAgent.IndexOf("ipod", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
|
if (IsSegmentedLiveStream)
|
||||||
|
{
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,12 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
[ApiMember(Name = "MinPremiereDate", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
[ApiMember(Name = "MinPremiereDate", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||||
public string MinPremiereDate { get; set; }
|
public string MinPremiereDate { get; set; }
|
||||||
|
|
||||||
|
[ApiMember(Name = "MinDateLastSaved", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||||
|
public string MinDateLastSaved { get; set; }
|
||||||
|
|
||||||
|
[ApiMember(Name = "MinDateLastSavedForUser", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||||
|
public string MinDateLastSavedForUser { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "MaxPremiereDate", Description = "Optional. The maximum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
[ApiMember(Name = "MaxPremiereDate", Description = "Optional. The maximum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||||
public string MaxPremiereDate { get; set; }
|
public string MaxPremiereDate { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -294,6 +294,16 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(request.MinDateLastSaved))
|
||||||
|
{
|
||||||
|
query.MinDateLastSaved = DateTime.Parse(request.MinDateLastSaved, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(request.MinDateLastSavedForUser))
|
||||||
|
{
|
||||||
|
query.MinDateLastSavedForUser = DateTime.Parse(request.MinDateLastSavedForUser, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(request.MinPremiereDate))
|
if (!string.IsNullOrEmpty(request.MinPremiereDate))
|
||||||
{
|
{
|
||||||
query.MinPremiereDate = DateTime.Parse(request.MinPremiereDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
|
query.MinPremiereDate = DateTime.Parse(request.MinPremiereDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
|
||||||
|
|
|
@ -672,7 +672,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
return ItemRepository.GetItemList(new InternalItemsQuery
|
return ItemRepository.GetItemList(new InternalItemsQuery
|
||||||
{
|
{
|
||||||
ParentId = Id,
|
Parent = this,
|
||||||
GroupByPresentationUniqueKey = false,
|
GroupByPresentationUniqueKey = false,
|
||||||
DtoOptions = new DtoOptions(true)
|
DtoOptions = new DtoOptions(true)
|
||||||
});
|
});
|
||||||
|
@ -692,7 +692,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
Recursive = false,
|
Recursive = false,
|
||||||
Limit = 0,
|
Limit = 0,
|
||||||
ParentId = Id,
|
Parent = this,
|
||||||
DtoOptions = new DtoOptions(false)
|
DtoOptions = new DtoOptions(false)
|
||||||
{
|
{
|
||||||
EnableImages = false
|
EnableImages = false
|
||||||
|
@ -743,7 +743,10 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
if (!(this is UserRootFolder) && !(this is AggregateFolder))
|
if (!(this is UserRootFolder) && !(this is AggregateFolder))
|
||||||
{
|
{
|
||||||
query.ParentId = query.ParentId ?? Id;
|
if (!query.ParentId.HasValue)
|
||||||
|
{
|
||||||
|
query.Parent = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RequiresPostFiltering2(query))
|
if (RequiresPostFiltering2(query))
|
||||||
|
|
|
@ -126,9 +126,27 @@ namespace MediaBrowser.Controller.Entities
|
||||||
public bool? IsVirtualItem { get; set; }
|
public bool? IsVirtualItem { get; set; }
|
||||||
|
|
||||||
public Guid? ParentId { get; set; }
|
public Guid? ParentId { get; set; }
|
||||||
|
public string ParentType { get; set; }
|
||||||
public string[] AncestorIds { get; set; }
|
public string[] AncestorIds { get; set; }
|
||||||
public string[] TopParentIds { get; set; }
|
public string[] TopParentIds { get; set; }
|
||||||
|
|
||||||
|
public BaseItem Parent
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
ParentId = null;
|
||||||
|
ParentType = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ParentId = value.Id;
|
||||||
|
ParentType = value.GetType().Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string[] PresetViews { get; set; }
|
public string[] PresetViews { get; set; }
|
||||||
public SourceType[] SourceTypes { get; set; }
|
public SourceType[] SourceTypes { get; set; }
|
||||||
public SourceType[] ExcludeSourceTypes { get; set; }
|
public SourceType[] ExcludeSourceTypes { get; set; }
|
||||||
|
@ -156,6 +174,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
public DateTime? MinDateCreated { get; set; }
|
public DateTime? MinDateCreated { get; set; }
|
||||||
public DateTime? MinDateLastSaved { get; set; }
|
public DateTime? MinDateLastSaved { get; set; }
|
||||||
|
public DateTime? MinDateLastSavedForUser { get; set; }
|
||||||
|
|
||||||
public DtoOptions DtoOptions { get; set; }
|
public DtoOptions DtoOptions { get; set; }
|
||||||
public int MinSimilarityScore { get; set; }
|
public int MinSimilarityScore { get; set; }
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
if (query.Recursive)
|
if (query.Recursive)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = queryParent.Id;
|
query.Parent = queryParent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
|
|
||||||
return _libraryManager.GetItemsResult(query);
|
return _libraryManager.GetItemsResult(query);
|
||||||
|
@ -355,7 +355,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
private QueryResult<BaseItem> GetMusicPlaylists(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetMusicPlaylists(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.ParentId = null;
|
query.Parent = null;
|
||||||
query.IncludeItemTypes = new[] { typeof(Playlist).Name };
|
query.IncludeItemTypes = new[] { typeof(Playlist).Name };
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
|
@ -366,7 +366,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private QueryResult<BaseItem> GetMusicAlbums(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetMusicAlbums(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
|
|
||||||
query.IncludeItemTypes = new[] { typeof(MusicAlbum).Name };
|
query.IncludeItemTypes = new[] { typeof(MusicAlbum).Name };
|
||||||
|
@ -377,7 +377,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private QueryResult<BaseItem> GetMusicSongs(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetMusicSongs(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
|
|
||||||
query.IncludeItemTypes = new[] { typeof(Audio.Audio).Name };
|
query.IncludeItemTypes = new[] { typeof(Audio.Audio).Name };
|
||||||
|
@ -405,7 +405,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private QueryResult<BaseItem> GetFavoriteSongs(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetFavoriteSongs(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
query.IsFavorite = true;
|
query.IsFavorite = true;
|
||||||
query.IncludeItemTypes = new[] { typeof(Audio.Audio).Name };
|
query.IncludeItemTypes = new[] { typeof(Audio.Audio).Name };
|
||||||
|
@ -416,7 +416,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private QueryResult<BaseItem> GetFavoriteAlbums(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetFavoriteAlbums(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
query.IsFavorite = true;
|
query.IsFavorite = true;
|
||||||
query.IncludeItemTypes = new[] { typeof(MusicAlbum).Name };
|
query.IncludeItemTypes = new[] { typeof(MusicAlbum).Name };
|
||||||
|
@ -466,7 +466,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private QueryResult<BaseItem> GetFavoriteMovies(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetFavoriteMovies(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
query.IsFavorite = true;
|
query.IsFavorite = true;
|
||||||
query.IncludeItemTypes = new[] { typeof(Movie).Name };
|
query.IncludeItemTypes = new[] { typeof(Movie).Name };
|
||||||
|
@ -477,7 +477,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private QueryResult<BaseItem> GetFavoriteSeries(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetFavoriteSeries(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
query.IsFavorite = true;
|
query.IsFavorite = true;
|
||||||
query.IncludeItemTypes = new[] { typeof(Series).Name };
|
query.IncludeItemTypes = new[] { typeof(Series).Name };
|
||||||
|
@ -488,7 +488,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private QueryResult<BaseItem> GetFavoriteEpisodes(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetFavoriteEpisodes(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
query.IsFavorite = true;
|
query.IsFavorite = true;
|
||||||
query.IncludeItemTypes = new[] { typeof(Episode).Name };
|
query.IncludeItemTypes = new[] { typeof(Episode).Name };
|
||||||
|
@ -499,7 +499,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private QueryResult<BaseItem> GetMovieMovies(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetMovieMovies(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
|
|
||||||
query.IncludeItemTypes = new[] { typeof(Movie).Name };
|
query.IncludeItemTypes = new[] { typeof(Movie).Name };
|
||||||
|
@ -518,7 +518,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
query.SortOrder = SortOrder.Descending;
|
query.SortOrder = SortOrder.Descending;
|
||||||
|
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
query.Limit = GetSpecialItemsLimit();
|
query.Limit = GetSpecialItemsLimit();
|
||||||
query.IncludeItemTypes = new[] { typeof(Movie).Name };
|
query.IncludeItemTypes = new[] { typeof(Movie).Name };
|
||||||
|
@ -532,7 +532,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
query.SortOrder = SortOrder.Descending;
|
query.SortOrder = SortOrder.Descending;
|
||||||
query.IsResumable = true;
|
query.IsResumable = true;
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
query.Limit = GetSpecialItemsLimit();
|
query.Limit = GetSpecialItemsLimit();
|
||||||
query.IncludeItemTypes = new[] { typeof(Movie).Name };
|
query.IncludeItemTypes = new[] { typeof(Movie).Name };
|
||||||
|
@ -586,7 +586,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private async Task<QueryResult<BaseItem>> GetMovieGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
private async Task<QueryResult<BaseItem>> GetMovieGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = queryParent.Id;
|
query.Parent = queryParent;
|
||||||
query.GenreIds = new[] { displayParent.Id.ToString("N") };
|
query.GenreIds = new[] { displayParent.Id.ToString("N") };
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
private QueryResult<BaseItem> GetBoxsetView(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetBoxsetView(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.ParentId = null;
|
query.Parent = null;
|
||||||
query.IncludeItemTypes = new[] { typeof(BoxSet).Name };
|
query.IncludeItemTypes = new[] { typeof(BoxSet).Name };
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
|
@ -644,7 +644,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
query.SortOrder = SortOrder.Descending;
|
query.SortOrder = SortOrder.Descending;
|
||||||
|
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
query.Limit = GetSpecialItemsLimit();
|
query.Limit = GetSpecialItemsLimit();
|
||||||
query.IncludeItemTypes = new[] { typeof(Episode).Name };
|
query.IncludeItemTypes = new[] { typeof(Episode).Name };
|
||||||
|
@ -674,7 +674,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
query.SortOrder = SortOrder.Descending;
|
query.SortOrder = SortOrder.Descending;
|
||||||
query.IsResumable = true;
|
query.IsResumable = true;
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
query.Limit = GetSpecialItemsLimit();
|
query.Limit = GetSpecialItemsLimit();
|
||||||
query.IncludeItemTypes = new[] { typeof(Episode).Name };
|
query.IncludeItemTypes = new[] { typeof(Episode).Name };
|
||||||
|
@ -685,7 +685,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private QueryResult<BaseItem> GetTvSeries(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetTvSeries(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = parent.Id;
|
query.Parent = parent;
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
|
|
||||||
query.IncludeItemTypes = new[] { typeof(Series).Name };
|
query.IncludeItemTypes = new[] { typeof(Series).Name };
|
||||||
|
@ -729,7 +729,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private QueryResult<BaseItem> GetTvGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetTvGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = queryParent.Id;
|
query.Parent = queryParent;
|
||||||
query.GenreIds = new[] { displayParent.Id.ToString("N") };
|
query.GenreIds = new[] { displayParent.Id.ToString("N") };
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace MediaBrowser.Server.Implementations.Devices
|
||||||
{
|
{
|
||||||
if (!_hasChildren.HasValue)
|
if (!_hasChildren.HasValue)
|
||||||
{
|
{
|
||||||
_hasChildren = LibraryManager.GetItemIds(new InternalItemsQuery { ParentId = Id }).Count > 0;
|
_hasChildren = LibraryManager.GetItemIds(new InternalItemsQuery { Parent = this }).Count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _hasChildren.Value;
|
return _hasChildren.Value;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user