Merge pull request #1852 from MediaBrowser/dev

Dev
pull/702/head
Luke 9 years ago committed by GitHub
commit 6a47d51fad

@ -666,6 +666,27 @@ namespace MediaBrowser.Controller.Entities
});
}
public virtual int GetChildCount(User user)
{
if (LinkedChildren.Count > 0)
{
if (!(this is ICollectionFolder))
{
return GetChildren(user, true).Count();
}
}
var result = GetItems(new InternalItemsQuery(user)
{
Recursive = false,
Limit = 0,
ParentId = Id
}).Result;
return result.TotalRecordCount;
}
public QueryResult<BaseItem> QueryRecursive(InternalItemsQuery query)
{
var user = query.User;

@ -75,6 +75,11 @@ namespace MediaBrowser.Controller.Entities.TV
return list;
}
public override int GetChildCount(User user)
{
return GetChildren(user, true).Count();
}
/// <summary>
/// This Episode's Series Instance
/// </summary>

@ -111,6 +111,20 @@ namespace MediaBrowser.Controller.Entities.TV
}
}
public override int GetChildCount(User user)
{
var result = LibraryManager.GetItemsResult(new InternalItemsQuery(user)
{
AncestorWithPresentationUniqueKey = PresentationUniqueKey,
IncludeItemTypes = new[] { typeof(Season).Name },
SortBy = new[] { ItemSortBy.SortName },
IsVirtualItem = false,
Limit = 0
});
return result.TotalRecordCount;
}
/// <summary>
/// Gets the user data key.
/// </summary>

@ -38,6 +38,11 @@ namespace MediaBrowser.Controller.Entities
return PostFilterAndSort(result.Where(filter), query);
}
public override int GetChildCount(User user)
{
return GetChildren(user, true).Count();
}
[IgnoreDataMember]
protected override bool SupportsShortcutChildren
{

@ -45,6 +45,11 @@ namespace MediaBrowser.Controller.Entities
return list;
}
public override int GetChildCount(User user)
{
return GetChildren(user, true).Count();
}
protected override Task<QueryResult<BaseItem>> GetItemsInternal(InternalItemsQuery query)
{
var parent = this as Folder;

@ -150,13 +150,6 @@ namespace MediaBrowser.Controller.Library
/// <returns>BaseItem.</returns>
BaseItem GetItemById(Guid id);
/// <summary>
/// Gets the memory item by identifier.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>BaseItem.</returns>
BaseItem GetMemoryItemById(Guid id);
/// <summary>
/// Gets the intros.
/// </summary>

@ -21,8 +21,8 @@ namespace MediaBrowser.Dlna.Profiles
new HttpHeaderInfo
{
Name = "User-Agent",
Value = @"SEC_",
Match = HeaderMatchType.Substring
Value = @".*(SEC_HHP_\[TV\] [A-Z]{2}\d{2}J[A-Z]?\d{3,4})*.",
Match = HeaderMatchType.Regex
}
}
};

@ -4,7 +4,7 @@
<Identification>
<ModelUrl>samsung.com</ModelUrl>
<Headers>
<HttpHeaderInfo name="User-Agent" value="SEC_" match="Substring" />
<HttpHeaderInfo name="User-Agent" value=".*(SEC_HHP_\[TV\] [A-Z]{2}\d{2}J[A-Z]?\d{3,4})*." match="Regex" />
</Headers>
</Identification>
<Manufacturer>Emby</Manufacturer>

@ -307,7 +307,6 @@ namespace MediaBrowser.Providers.Music
}
var nodes = releaseList.ChildNodes;
string releaseGroupId = null;
if (nodes != null)
{

@ -549,8 +549,7 @@ namespace MediaBrowser.Server.Implementations.Dto
private int GetChildCount(Folder folder, User user)
{
return folder.GetChildren(user, true)
.Count();
return folder.GetChildCount(user);
}
/// <summary>

@ -1276,18 +1276,9 @@ namespace MediaBrowser.Server.Implementations.Library
return item;
}
public BaseItem GetMemoryItemById(Guid id)
private bool EnableCaching
{
if (id == Guid.Empty)
{
throw new ArgumentNullException("id");
}
BaseItem item;
LibraryItemsCache.TryGetValue(id, out item);
return item;
get { return true; }
}
public IEnumerable<BaseItem> GetItemList(InternalItemsQuery query)
@ -1297,6 +1288,11 @@ namespace MediaBrowser.Server.Implementations.Library
AddUserToQuery(query, query.User);
}
if (!EnableCaching)
{
return ItemRepository.GetItemList(query);
}
var result = ItemRepository.GetItemIdsList(query);
return result.Select(GetItemById).Where(i => i != null);
@ -1336,6 +1332,11 @@ namespace MediaBrowser.Server.Implementations.Library
SetTopParentIdsOrAncestors(query, parents);
if (!EnableCaching)
{
return ItemRepository.GetItemList(query);
}
return GetItemIds(query).Select(GetItemById).Where(i => i != null);
}
@ -1358,6 +1359,11 @@ namespace MediaBrowser.Server.Implementations.Library
if (query.EnableTotalRecordCount)
{
if (!EnableCaching)
{
return ItemRepository.GetItems(query);
}
var initialResult = ItemRepository.GetItemIds(query);
return new QueryResult<BaseItem>
@ -1367,6 +1373,14 @@ namespace MediaBrowser.Server.Implementations.Library
};
}
if (!EnableCaching)
{
return new QueryResult<BaseItem>
{
Items = ItemRepository.GetItemList(query).ToArray()
};
}
return new QueryResult<BaseItem>
{
Items = ItemRepository.GetItemIdsList(query).Select(GetItemById).Where(i => i != null).ToArray()

@ -122,7 +122,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
protected override async Task<IDbConnection> CreateConnection(bool isReadOnly = false)
{
var connection = await DbConnector.Connect(DbFilePath, false, false, 20000).ConfigureAwait(false);
var connection = await DbConnector.Connect(DbFilePath, false, false, 5000).ConfigureAwait(false);
connection.RunQueries(new[]
{

Loading…
Cancel
Save