update notifications

This commit is contained in:
Luke Pulverenti 2015-11-07 20:17:32 -05:00
parent 8f239f0cde
commit 5eb86b686b

View File

@ -22,6 +22,8 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.LiveTv;
namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
{ {
@ -311,8 +313,11 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
private readonly List<BaseItem> _itemsAdded = new List<BaseItem>(); private readonly List<BaseItem> _itemsAdded = new List<BaseItem>();
void _libraryManager_ItemAdded(object sender, ItemChangeEventArgs e) void _libraryManager_ItemAdded(object sender, ItemChangeEventArgs e)
{ {
if (e.Item.LocationType == LocationType.FileSystem && !e.Item.IsFolder) if (!FilterItem(e.Item))
{ {
return;
}
lock (_libraryChangedSyncLock) lock (_libraryChangedSyncLock)
{ {
if (LibraryUpdateTimer == null) if (LibraryUpdateTimer == null)
@ -328,6 +333,20 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
_itemsAdded.Add(e.Item); _itemsAdded.Add(e.Item);
} }
} }
private bool FilterItem(BaseItem item)
{
if (!item.IsFolder && item.LocationType == LocationType.Virtual)
{
return false;
}
if (item is IItemByName && !(item is MusicArtist))
{
return false;
}
return !(item is IChannelItem) && !(item is ILiveTvItem);
} }
private async void LibraryUpdateTimerCallback(object state) private async void LibraryUpdateTimerCallback(object state)