rework channel checking
This commit is contained in:
parent
be18983f91
commit
a46cbfa02b
|
@ -8,7 +8,6 @@ using MediaBrowser.Controller.Entities.TV;
|
|||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Channels;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
@ -432,21 +431,6 @@ namespace MediaBrowser.Api.Library
|
|||
var songs = filteredItems.OfType<Audio>().ToList();
|
||||
var series = filteredItems.OfType<Series>().ToList();
|
||||
|
||||
var channelCount = 0;
|
||||
|
||||
try
|
||||
{
|
||||
channelCount = _channelManager.GetChannels(new ChannelQuery
|
||||
{
|
||||
UserId = request.UserId.HasValue ? request.UserId.Value.ToString("N") : null
|
||||
|
||||
}, CancellationToken.None).Result.TotalRecordCount;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error getting channels", ex);
|
||||
}
|
||||
|
||||
var counts = new ItemCounts
|
||||
{
|
||||
AlbumCount = albums.Count,
|
||||
|
@ -462,9 +446,7 @@ namespace MediaBrowser.Api.Library
|
|||
BoxSetCount = boxsets.Count,
|
||||
BookCount = books.Count,
|
||||
|
||||
UniqueTypes = items.Select(i => i.GetClientTypeName()).Distinct().ToList(),
|
||||
|
||||
ChannelCount = channelCount
|
||||
UniqueTypes = items.Select(i => i.GetClientTypeName()).Distinct().ToList()
|
||||
};
|
||||
|
||||
return ToOptimizedSerializedResultUsingCache(counts);
|
||||
|
|
|
@ -124,7 +124,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
|
||||
{
|
||||
CreateResolveArgs(directoryService);
|
||||
ResetDynamicChildren();
|
||||
|
||||
return NullTaskResult;
|
||||
}
|
||||
|
@ -150,8 +149,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
.ToList();
|
||||
}
|
||||
|
||||
private IEnumerable<BaseItem> _actualChildren;
|
||||
|
||||
/// <summary>
|
||||
/// Our children are actually just references to the ones in the physical root...
|
||||
/// </summary>
|
||||
|
@ -170,10 +167,5 @@ namespace MediaBrowser.Controller.Entities
|
|||
.SelectMany(c => c.Children)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public void ResetDynamicChildren()
|
||||
{
|
||||
_actualChildren = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,6 @@ namespace MediaBrowser.Model.Dto
|
|||
/// </summary>
|
||||
/// <value>The unique types.</value>
|
||||
public List<string> UniqueTypes { get; set; }
|
||||
public int ChannelCount { get; set; }
|
||||
|
||||
public ItemCounts()
|
||||
{
|
||||
|
|
|
@ -87,18 +87,30 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
.ToList();
|
||||
}
|
||||
|
||||
var all = channels;
|
||||
var totalCount = all.Count;
|
||||
|
||||
if (query.StartIndex.HasValue)
|
||||
{
|
||||
all = all.Skip(query.StartIndex.Value).ToList();
|
||||
}
|
||||
if (query.Limit.HasValue)
|
||||
{
|
||||
all = all.Take(query.Limit.Value).ToList();
|
||||
}
|
||||
|
||||
// Get everything
|
||||
var fields = Enum.GetNames(typeof(ItemFields))
|
||||
.Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
|
||||
.ToList();
|
||||
|
||||
var returnItems = channels.Select(i => _dtoService.GetBaseItemDto(i, fields, user))
|
||||
var returnItems = all.Select(i => _dtoService.GetBaseItemDto(i, fields, user))
|
||||
.ToArray();
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
Items = returnItems,
|
||||
TotalRecordCount = returnItems.Length
|
||||
TotalRecordCount = totalCount
|
||||
};
|
||||
|
||||
return Task.FromResult(result);
|
||||
|
|
|
@ -1348,8 +1348,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
UpdateItemInLibraryCache(item);
|
||||
}
|
||||
|
||||
UpdateCollectionFolders();
|
||||
|
||||
if (ItemAdded != null)
|
||||
{
|
||||
foreach (var item in list)
|
||||
|
@ -1412,8 +1410,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// <param name="item">The item.</param>
|
||||
public void ReportItemRemoved(BaseItem item)
|
||||
{
|
||||
UpdateCollectionFolders();
|
||||
|
||||
if (ItemRemoved != null)
|
||||
{
|
||||
try
|
||||
|
@ -1427,14 +1423,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
}
|
||||
}
|
||||
|
||||
private void UpdateCollectionFolders()
|
||||
{
|
||||
foreach (var folder in _userManager.Users.SelectMany(i => i.RootFolder.Children).OfType<CollectionFolder>().ToList())
|
||||
{
|
||||
folder.ResetDynamicChildren();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the item.
|
||||
/// </summary>
|
||||
|
|
|
@ -348,7 +348,7 @@
|
|||
"OptionDownloadPrimaryImage": "Primary",
|
||||
"HeaderFetchImages": "Fetch Images:",
|
||||
"HeaderImageSettings": "Image Settings",
|
||||
"TabCustomizations": "Customizations",
|
||||
"TabOther": "Other",
|
||||
"LabelMaxBackdropsPerItem": "Maximum number of backdrops per item:",
|
||||
"LabelMaxScreenshotsPerItem": "Maximum number of screenshots per item:",
|
||||
"LabelMinBackdropDownloadWidth": "Minimum backdrop download width:",
|
||||
|
|
Loading…
Reference in New Issue
Block a user