|
|
@ -944,9 +944,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
private T CreateItemByName<T>(string path, string name)
|
|
|
|
private T CreateItemByName<T>(string path, string name)
|
|
|
|
where T : BaseItem, new()
|
|
|
|
where T : BaseItem, new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var isArtist = typeof(T) == typeof(MusicArtist);
|
|
|
|
if (typeof(T) == typeof(MusicArtist))
|
|
|
|
|
|
|
|
|
|
|
|
if (isArtist)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var existing = GetItemList(new InternalItemsQuery
|
|
|
|
var existing = GetItemList(new InternalItemsQuery
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1277,11 +1275,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
return item;
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private bool EnableCaching
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return false; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IEnumerable<BaseItem> GetItemList(InternalItemsQuery query)
|
|
|
|
public IEnumerable<BaseItem> GetItemList(InternalItemsQuery query)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (query.User != null)
|
|
|
|
if (query.User != null)
|
|
|
@ -1289,16 +1282,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
AddUserToQuery(query, query.User);
|
|
|
|
AddUserToQuery(query, query.User);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!EnableCaching)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return ItemRepository.GetItemList(query);
|
|
|
|
return ItemRepository.GetItemList(query);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var result = ItemRepository.GetItemIdsList(query);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result.Select(GetItemById).Where(i => i != null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public QueryResult<BaseItem> QueryItems(InternalItemsQuery query)
|
|
|
|
public QueryResult<BaseItem> QueryItems(InternalItemsQuery query)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (query.User != null)
|
|
|
|
if (query.User != null)
|
|
|
@ -1426,14 +1412,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
|
|
|
|
|
|
|
|
SetTopParentIdsOrAncestors(query, parents);
|
|
|
|
SetTopParentIdsOrAncestors(query, parents);
|
|
|
|
|
|
|
|
|
|
|
|
if (!EnableCaching)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return ItemRepository.GetItemList(query);
|
|
|
|
return ItemRepository.GetItemList(query);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return GetItemIds(query).Select(GetItemById).Where(i => i != null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public QueryResult<BaseItem> GetItemsResult(InternalItemsQuery query)
|
|
|
|
public QueryResult<BaseItem> GetItemsResult(InternalItemsQuery query)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (query.Recursive && query.ParentId.HasValue)
|
|
|
|
if (query.Recursive && query.ParentId.HasValue)
|
|
|
@ -1452,35 +1433,16 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (query.EnableTotalRecordCount)
|
|
|
|
if (query.EnableTotalRecordCount)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!EnableCaching)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return ItemRepository.GetItems(query);
|
|
|
|
return ItemRepository.GetItems(query);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var initialResult = ItemRepository.GetItemIds(query);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new QueryResult<BaseItem>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TotalRecordCount = initialResult.TotalRecordCount,
|
|
|
|
|
|
|
|
Items = initialResult.Items.Select(GetItemById).Where(i => i != null).ToArray()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!EnableCaching)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return new QueryResult<BaseItem>
|
|
|
|
return new QueryResult<BaseItem>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Items = ItemRepository.GetItemList(query).ToArray()
|
|
|
|
Items = ItemRepository.GetItemList(query).ToArray()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new QueryResult<BaseItem>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Items = ItemRepository.GetItemIdsList(query).Select(GetItemById).Where(i => i != null).ToArray()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public QueryResult<BaseItem> GetItemsResult(InternalItemsQuery query, IEnumerable<string> parentIds)
|
|
|
|
public QueryResult<BaseItem> GetItemsResult(InternalItemsQuery query, IEnumerable<string> parentIds)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var parents = parentIds.Select(i => GetItemById(new Guid(i))).Where(i => i != null).ToList();
|
|
|
|
var parents = parentIds.Select(i => GetItemById(new Guid(i))).Where(i => i != null).ToList();
|
|
|
|