optimize series display
This commit is contained in:
parent
a9645e1429
commit
f9702672f4
|
@ -664,11 +664,18 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
var requiresReset = false;
|
var requiresReset = false;
|
||||||
|
|
||||||
using (var saveItemStatement = db.PrepareStatement(GetSaveItemCommandText()))
|
var statements = db.PrepareAll(string.Join(";", new string[]
|
||||||
{
|
{
|
||||||
using (var deleteAncestorsStatement = db.PrepareStatement("delete from AncestorIds where ItemId=@ItemId"))
|
GetSaveItemCommandText(),
|
||||||
|
"delete from AncestorIds where ItemId=@ItemId",
|
||||||
|
"insert into AncestorIds (ItemId, AncestorId, AncestorIdText) values (@ItemId, @AncestorId, @AncestorIdText)"
|
||||||
|
})).ToList();
|
||||||
|
|
||||||
|
using (var saveItemStatement = statements[0])
|
||||||
|
{
|
||||||
|
using (var deleteAncestorsStatement = statements[1])
|
||||||
{
|
{
|
||||||
using (var updateAncestorsStatement = db.PrepareStatement("insert into AncestorIds (ItemId, AncestorId, AncestorIdText) values (@ItemId, @AncestorId, @AncestorIdText)"))
|
using (var updateAncestorsStatement = statements[2])
|
||||||
{
|
{
|
||||||
foreach (var tuple in tuples)
|
foreach (var tuple in tuples)
|
||||||
{
|
{
|
||||||
|
@ -2576,16 +2583,42 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var totalRecordCount = 0;
|
||||||
|
var isReturningZeroItems = query.Limit.HasValue && query.Limit <= 0;
|
||||||
|
|
||||||
|
var statementTexts = new List<string>();
|
||||||
|
if (!isReturningZeroItems)
|
||||||
|
{
|
||||||
|
statementTexts.Add(commandText);
|
||||||
|
}
|
||||||
|
if (query.EnableTotalRecordCount)
|
||||||
|
{
|
||||||
|
commandText = string.Empty;
|
||||||
|
|
||||||
|
if (EnableGroupByPresentationUniqueKey(query))
|
||||||
|
{
|
||||||
|
commandText += " select count (distinct PresentationUniqueKey)" + GetFromText();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
commandText += " select count (guid)" + GetFromText();
|
||||||
|
}
|
||||||
|
|
||||||
|
commandText += GetJoinUserDataText(query);
|
||||||
|
commandText += whereTextWithoutPaging;
|
||||||
|
statementTexts.Add(commandText);
|
||||||
|
}
|
||||||
|
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
using (WriteLock.Read())
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
var totalRecordCount = 0;
|
var statements = connection.PrepareAll(string.Join(";", statementTexts.ToArray()))
|
||||||
var isReturningZeroItems = query.Limit.HasValue && query.Limit <= 0;
|
.ToList();
|
||||||
|
|
||||||
if (!isReturningZeroItems)
|
if (!isReturningZeroItems)
|
||||||
{
|
{
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
using (var statement = statements[0])
|
||||||
{
|
{
|
||||||
if (EnableJoinUserData(query))
|
if (EnableJoinUserData(query))
|
||||||
{
|
{
|
||||||
|
@ -2608,33 +2641,22 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
commandText = string.Empty;
|
if (query.EnableTotalRecordCount)
|
||||||
|
|
||||||
if (EnableGroupByPresentationUniqueKey(query))
|
|
||||||
{
|
{
|
||||||
commandText += " select count (distinct PresentationUniqueKey)" + GetFromText();
|
using (var statement = statements[statements.Count - 1])
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
commandText += " select count (guid)" + GetFromText();
|
|
||||||
}
|
|
||||||
|
|
||||||
commandText += GetJoinUserDataText(query);
|
|
||||||
commandText += whereTextWithoutPaging;
|
|
||||||
|
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
|
||||||
{
|
|
||||||
if (EnableJoinUserData(query))
|
|
||||||
{
|
{
|
||||||
statement.TryBind("@UserId", query.User.Id);
|
if (EnableJoinUserData(query))
|
||||||
|
{
|
||||||
|
statement.TryBind("@UserId", query.User.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
BindSimilarParams(query, statement);
|
||||||
|
|
||||||
|
// Running this again will bind the params
|
||||||
|
GetWhereClauses(query, statement);
|
||||||
|
|
||||||
|
totalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
|
||||||
}
|
}
|
||||||
|
|
||||||
BindSimilarParams(query, statement);
|
|
||||||
|
|
||||||
// Running this again will bind the params
|
|
||||||
GetWhereClauses(query, statement);
|
|
||||||
|
|
||||||
totalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LogQueryTime("GetItems", commandText, now);
|
LogQueryTime("GetItems", commandText, now);
|
||||||
|
@ -2966,58 +2988,77 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = new List<Guid>();
|
var list = new List<Guid>();
|
||||||
|
var isReturningZeroItems = query.Limit.HasValue && query.Limit <= 0;
|
||||||
|
|
||||||
|
var statementTexts = new List<string>();
|
||||||
|
if (!isReturningZeroItems)
|
||||||
|
{
|
||||||
|
statementTexts.Add(commandText);
|
||||||
|
}
|
||||||
|
if (query.EnableTotalRecordCount)
|
||||||
|
{
|
||||||
|
commandText = string.Empty;
|
||||||
|
|
||||||
|
if (EnableGroupByPresentationUniqueKey(query))
|
||||||
|
{
|
||||||
|
commandText += " select count (distinct PresentationUniqueKey)" + GetFromText();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
commandText += " select count (guid)" + GetFromText();
|
||||||
|
}
|
||||||
|
|
||||||
|
commandText += GetJoinUserDataText(query);
|
||||||
|
commandText += whereTextWithoutPaging;
|
||||||
|
statementTexts.Add(commandText);
|
||||||
|
}
|
||||||
|
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
|
var statements = connection.PrepareAll(string.Join(";", statementTexts.ToArray()))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
using (WriteLock.Read())
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
var totalRecordCount = 0;
|
var totalRecordCount = 0;
|
||||||
|
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
if (!isReturningZeroItems)
|
||||||
{
|
{
|
||||||
if (EnableJoinUserData(query))
|
using (var statement = statements[0])
|
||||||
{
|
{
|
||||||
statement.TryBind("@UserId", query.User.Id);
|
if (EnableJoinUserData(query))
|
||||||
}
|
{
|
||||||
|
statement.TryBind("@UserId", query.User.Id);
|
||||||
|
}
|
||||||
|
|
||||||
BindSimilarParams(query, statement);
|
BindSimilarParams(query, statement);
|
||||||
|
|
||||||
// Running this again will bind the params
|
// Running this again will bind the params
|
||||||
GetWhereClauses(query, statement);
|
GetWhereClauses(query, statement);
|
||||||
|
|
||||||
foreach (var row in statement.ExecuteQuery())
|
foreach (var row in statement.ExecuteQuery())
|
||||||
{
|
{
|
||||||
list.Add(row[0].ReadGuid());
|
list.Add(row[0].ReadGuid());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
commandText = string.Empty;
|
if (query.EnableTotalRecordCount)
|
||||||
|
|
||||||
if (EnableGroupByPresentationUniqueKey(query))
|
|
||||||
{
|
{
|
||||||
commandText += " select count (distinct PresentationUniqueKey)" + GetFromText();
|
using (var statement = statements[statements.Count - 1])
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
commandText += " select count (guid)" + GetFromText();
|
|
||||||
}
|
|
||||||
|
|
||||||
commandText += GetJoinUserDataText(query);
|
|
||||||
commandText += whereTextWithoutPaging;
|
|
||||||
|
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
|
||||||
{
|
|
||||||
if (EnableJoinUserData(query))
|
|
||||||
{
|
{
|
||||||
statement.TryBind("@UserId", query.User.Id);
|
if (EnableJoinUserData(query))
|
||||||
|
{
|
||||||
|
statement.TryBind("@UserId", query.User.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
BindSimilarParams(query, statement);
|
||||||
|
|
||||||
|
// Running this again will bind the params
|
||||||
|
GetWhereClauses(query, statement);
|
||||||
|
|
||||||
|
totalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
|
||||||
}
|
}
|
||||||
|
|
||||||
BindSimilarParams(query, statement);
|
|
||||||
|
|
||||||
// Running this again will bind the params
|
|
||||||
GetWhereClauses(query, statement);
|
|
||||||
|
|
||||||
totalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LogQueryTime("GetItemIds", commandText, now);
|
LogQueryTime("GetItemIds", commandText, now);
|
||||||
|
@ -4875,13 +4916,29 @@ namespace Emby.Server.Implementations.Data
|
||||||
var list = new List<Tuple<BaseItem, ItemCounts>>();
|
var list = new List<Tuple<BaseItem, ItemCounts>>();
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
|
var statementTexts = new List<string>();
|
||||||
|
if (!isReturningZeroItems)
|
||||||
|
{
|
||||||
|
statementTexts.Add(commandText);
|
||||||
|
}
|
||||||
|
if (query.EnableTotalRecordCount)
|
||||||
|
{
|
||||||
|
var countText = "select count (distinct PresentationUniqueKey)" + GetFromText();
|
||||||
|
|
||||||
|
countText += GetJoinUserDataText(query);
|
||||||
|
countText += whereText;
|
||||||
|
statementTexts.Add(countText);
|
||||||
|
}
|
||||||
|
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
using (WriteLock.Read())
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
|
var statements = connection.PrepareAll(string.Join(";", statementTexts.ToArray())).ToList();
|
||||||
|
|
||||||
if (!isReturningZeroItems)
|
if (!isReturningZeroItems)
|
||||||
{
|
{
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
using (var statement = statements[0])
|
||||||
{
|
{
|
||||||
statement.TryBind("@SelectType", returnType);
|
statement.TryBind("@SelectType", returnType);
|
||||||
if (EnableJoinUserData(query))
|
if (EnableJoinUserData(query))
|
||||||
|
@ -4919,7 +4976,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
commandText += GetJoinUserDataText(query);
|
commandText += GetJoinUserDataText(query);
|
||||||
commandText += whereText;
|
commandText += whereText;
|
||||||
|
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
using (var statement = statements[statements.Count - 1])
|
||||||
{
|
{
|
||||||
statement.TryBind("@SelectType", returnType);
|
statement.TryBind("@SelectType", returnType);
|
||||||
if (EnableJoinUserData(query))
|
if (EnableJoinUserData(query))
|
||||||
|
|
|
@ -70,9 +70,9 @@ namespace Emby.Server.Implementations.Security
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
using (var connection = CreateConnection())
|
using (WriteLock.Write())
|
||||||
{
|
{
|
||||||
using (WriteLock.Write())
|
using (var connection = CreateConnection())
|
||||||
{
|
{
|
||||||
connection.RunInTransaction(db =>
|
connection.RunInTransaction(db =>
|
||||||
{
|
{
|
||||||
|
@ -137,78 +137,78 @@ namespace Emby.Server.Implementations.Security
|
||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException("query");
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var connection = CreateConnection(true))
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
var commandText = BaseSelectText;
|
using (var connection = CreateConnection(true))
|
||||||
|
|
||||||
var whereClauses = new List<string>();
|
|
||||||
|
|
||||||
var startIndex = query.StartIndex ?? 0;
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.AccessToken))
|
|
||||||
{
|
{
|
||||||
whereClauses.Add("AccessToken=@AccessToken");
|
var commandText = BaseSelectText;
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.UserId))
|
var whereClauses = new List<string>();
|
||||||
{
|
|
||||||
whereClauses.Add("UserId=@UserId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.DeviceId))
|
var startIndex = query.StartIndex ?? 0;
|
||||||
{
|
|
||||||
whereClauses.Add("DeviceId=@DeviceId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query.IsActive.HasValue)
|
if (!string.IsNullOrWhiteSpace(query.AccessToken))
|
||||||
{
|
|
||||||
whereClauses.Add("IsActive=@IsActive");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query.HasUser.HasValue)
|
|
||||||
{
|
|
||||||
if (query.HasUser.Value)
|
|
||||||
{
|
{
|
||||||
whereClauses.Add("UserId not null");
|
whereClauses.Add("AccessToken=@AccessToken");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(query.UserId))
|
||||||
{
|
{
|
||||||
whereClauses.Add("UserId is null");
|
whereClauses.Add("UserId=@UserId");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var whereTextWithoutPaging = whereClauses.Count == 0 ?
|
if (!string.IsNullOrWhiteSpace(query.DeviceId))
|
||||||
string.Empty :
|
{
|
||||||
" where " + string.Join(" AND ", whereClauses.ToArray());
|
whereClauses.Add("DeviceId=@DeviceId");
|
||||||
|
}
|
||||||
|
|
||||||
if (startIndex > 0)
|
if (query.IsActive.HasValue)
|
||||||
{
|
{
|
||||||
var pagingWhereText = whereClauses.Count == 0 ?
|
whereClauses.Add("IsActive=@IsActive");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (query.HasUser.HasValue)
|
||||||
|
{
|
||||||
|
if (query.HasUser.Value)
|
||||||
|
{
|
||||||
|
whereClauses.Add("UserId not null");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
whereClauses.Add("UserId is null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var whereTextWithoutPaging = whereClauses.Count == 0 ?
|
||||||
string.Empty :
|
string.Empty :
|
||||||
" where " + string.Join(" AND ", whereClauses.ToArray());
|
" where " + string.Join(" AND ", whereClauses.ToArray());
|
||||||
|
|
||||||
whereClauses.Add(string.Format("Id NOT IN (SELECT Id FROM AccessTokens {0} ORDER BY DateCreated LIMIT {1})",
|
if (startIndex > 0)
|
||||||
pagingWhereText,
|
{
|
||||||
startIndex.ToString(_usCulture)));
|
var pagingWhereText = whereClauses.Count == 0 ?
|
||||||
}
|
string.Empty :
|
||||||
|
" where " + string.Join(" AND ", whereClauses.ToArray());
|
||||||
|
|
||||||
var whereText = whereClauses.Count == 0 ?
|
whereClauses.Add(string.Format("Id NOT IN (SELECT Id FROM AccessTokens {0} ORDER BY DateCreated LIMIT {1})",
|
||||||
string.Empty :
|
pagingWhereText,
|
||||||
" where " + string.Join(" AND ", whereClauses.ToArray());
|
startIndex.ToString(_usCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
commandText += whereText;
|
var whereText = whereClauses.Count == 0 ?
|
||||||
|
string.Empty :
|
||||||
|
" where " + string.Join(" AND ", whereClauses.ToArray());
|
||||||
|
|
||||||
commandText += " ORDER BY DateCreated";
|
commandText += whereText;
|
||||||
|
|
||||||
if (query.Limit.HasValue)
|
commandText += " ORDER BY DateCreated";
|
||||||
{
|
|
||||||
commandText += " LIMIT " + query.Limit.Value.ToString(_usCulture);
|
|
||||||
}
|
|
||||||
|
|
||||||
var list = new List<AuthenticationInfo>();
|
if (query.Limit.HasValue)
|
||||||
|
{
|
||||||
|
commandText += " LIMIT " + query.Limit.Value.ToString(_usCulture);
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = new List<AuthenticationInfo>();
|
||||||
|
|
||||||
using (WriteLock.Read())
|
|
||||||
{
|
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
using (var statement = connection.PrepareStatement(commandText))
|
||||||
{
|
{
|
||||||
BindAuthenticationQueryParams(query, statement);
|
BindAuthenticationQueryParams(query, statement);
|
||||||
|
@ -244,9 +244,9 @@ namespace Emby.Server.Implementations.Security
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException("id");
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var connection = CreateConnection(true))
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
using (WriteLock.Read())
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
var commandText = BaseSelectText + " where Id=@Id";
|
var commandText = BaseSelectText + " where Id=@Id";
|
||||||
|
|
||||||
|
|
|
@ -516,9 +516,23 @@ namespace Emby.Server.Implementations.Sync
|
||||||
commandText += " where " + string.Join(" AND ", whereClauses.ToArray());
|
commandText += " where " + string.Join(" AND ", whereClauses.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var statementTexts = new List<string>
|
||||||
|
{
|
||||||
|
commandText
|
||||||
|
};
|
||||||
|
|
||||||
|
commandText = commandText
|
||||||
|
.Replace("select ItemId,Status,Progress from SyncJobItems", "select ItemIds,Status,Progress from SyncJobs")
|
||||||
|
.Replace("'Synced'", "'Completed','CompletedWithError'");
|
||||||
|
|
||||||
|
statementTexts.Add(commandText);
|
||||||
|
|
||||||
using (WriteLock.Read())
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
var statements = connection.PrepareAll(string.Join(";", statementTexts.ToArray()))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
using (var statement = statements[0])
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(query.TargetId))
|
if (!string.IsNullOrWhiteSpace(query.TargetId))
|
||||||
{
|
{
|
||||||
|
@ -532,13 +546,9 @@ namespace Emby.Server.Implementations.Sync
|
||||||
LogQueryTime("GetSyncedItemProgresses", commandText, now);
|
LogQueryTime("GetSyncedItemProgresses", commandText, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
commandText = commandText
|
|
||||||
.Replace("select ItemId,Status,Progress from SyncJobItems", "select ItemIds,Status,Progress from SyncJobs")
|
|
||||||
.Replace("'Synced'", "'Completed','CompletedWithError'");
|
|
||||||
|
|
||||||
now = DateTime.UtcNow;
|
now = DateTime.UtcNow;
|
||||||
|
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
using (var statement = statements[1])
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(query.TargetId))
|
if (!string.IsNullOrWhiteSpace(query.TargetId))
|
||||||
{
|
{
|
||||||
|
|
|
@ -199,7 +199,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
|
|
||||||
if (!state.RunTimeTicks.HasValue)
|
if (!state.RunTimeTicks.HasValue)
|
||||||
{
|
{
|
||||||
args += " -fflags +genpts -flags +global_header";
|
args += " -flags -global_header";
|
||||||
}
|
}
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
|
|
|
@ -681,6 +681,19 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return result.TotalRecordCount;
|
return result.TotalRecordCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual int GetRecursiveChildCount(User user)
|
||||||
|
{
|
||||||
|
return GetItems(new InternalItemsQuery(user)
|
||||||
|
{
|
||||||
|
Recursive = true,
|
||||||
|
IsFolder = false,
|
||||||
|
IsVirtualItem = false,
|
||||||
|
EnableTotalRecordCount = true,
|
||||||
|
Limit = 0
|
||||||
|
|
||||||
|
}).Result.TotalRecordCount;
|
||||||
|
}
|
||||||
|
|
||||||
public QueryResult<BaseItem> QueryRecursive(InternalItemsQuery query)
|
public QueryResult<BaseItem> QueryRecursive(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
var user = query.User;
|
var user = query.User;
|
||||||
|
@ -1404,20 +1417,11 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var allItemsQueryResult = await GetItems(new InternalItemsQuery(user)
|
var recursiveItemCount = GetRecursiveChildCount(user);
|
||||||
{
|
|
||||||
Recursive = true,
|
|
||||||
IsFolder = false,
|
|
||||||
IsVirtualItem = false,
|
|
||||||
EnableTotalRecordCount = true,
|
|
||||||
Limit = 0
|
|
||||||
|
|
||||||
}).ConfigureAwait(false);
|
|
||||||
var recursiveItemCount = allItemsQueryResult.TotalRecordCount;
|
|
||||||
|
|
||||||
if (itemDto != null)
|
if (itemDto != null)
|
||||||
{
|
{
|
||||||
itemDto.RecursiveItemCount = allItemsQueryResult.TotalRecordCount;
|
itemDto.RecursiveItemCount = recursiveItemCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recursiveItemCount > 0 && SupportsPlayedStatus)
|
if (recursiveItemCount > 0 && SupportsPlayedStatus)
|
||||||
|
|
|
@ -142,6 +142,24 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
return result.TotalRecordCount;
|
return result.TotalRecordCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetRecursiveChildCount(User user)
|
||||||
|
{
|
||||||
|
var query = new InternalItemsQuery(user);
|
||||||
|
|
||||||
|
query.AncestorWithPresentationUniqueKey = GetUniqueSeriesKey(this);
|
||||||
|
if (query.SortBy.Length == 0)
|
||||||
|
{
|
||||||
|
query.SortBy = new[] { ItemSortBy.SortName };
|
||||||
|
}
|
||||||
|
if (query.IncludeItemTypes.Length == 0)
|
||||||
|
{
|
||||||
|
query.IncludeItemTypes = new[] { typeof(Episode).Name, typeof(Season).Name };
|
||||||
|
}
|
||||||
|
query.IsVirtualItem = false;
|
||||||
|
query.Limit = 0;
|
||||||
|
return LibraryManager.GetItemsResult(query).TotalRecordCount;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user data key.
|
/// Gets the user data key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -369,7 +387,10 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
|
|
||||||
public IEnumerable<Episode> GetSeasonEpisodes(Season parentSeason, User user)
|
public IEnumerable<Episode> GetSeasonEpisodes(Season parentSeason, User user)
|
||||||
{
|
{
|
||||||
var seriesKey = GetUniqueSeriesKey(this);
|
// add optimization when this setting is not enabled
|
||||||
|
var seriesKey = ConfigurationManager.Configuration.DisplaySpecialsWithinSeasons ?
|
||||||
|
GetUniqueSeriesKey(this) :
|
||||||
|
GetUniqueSeriesKey(parentSeason);
|
||||||
|
|
||||||
var query = new InternalItemsQuery(user)
|
var query = new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user