diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-19 00:05:33 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-19 00:05:33 -0400 |
| commit | 9e495d38868cdcb127edc5002187f546044f7477 (patch) | |
| tree | f1594d605a188e9cf280d2ecacd337a042bb5963 /MediaBrowser.Server.Implementations | |
| parent | bd06308f2c8f33eb646ea07a38157c5a8239ee59 (diff) | |
remove IChannelItem interface
Diffstat (limited to 'MediaBrowser.Server.Implementations')
7 files changed, 14 insertions, 21 deletions
diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index c7865b6aa..9cb0e25c2 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -1079,7 +1079,7 @@ namespace MediaBrowser.Server.Implementations.Channels if (!string.IsNullOrWhiteSpace(folderId)) { - var categoryItem = (IChannelItem)_libraryManager.GetItemById(new Guid(folderId)); + var categoryItem = _libraryManager.GetItemById(new Guid(folderId)); query.FolderId = categoryItem.ExternalId; } @@ -1195,7 +1195,7 @@ namespace MediaBrowser.Server.Implementations.Channels } private T GetItemById<T>(string idString, string channelName, string channnelDataVersion, out bool isNew) - where T : BaseItem, IChannelItem, new() + where T : BaseItem, new() { var id = GetIdToHash(idString, channelName).GetMBId(typeof(T)); @@ -1263,9 +1263,7 @@ namespace MediaBrowser.Server.Implementations.Channels item.Tags = info.Tags; } - var channelItem = (IChannelItem)item; - - channelItem.ChannelId = internalChannelId.ToString("N"); + item.ChannelId = internalChannelId.ToString("N"); if (item.ParentId != internalChannelId) { @@ -1273,11 +1271,11 @@ namespace MediaBrowser.Server.Implementations.Channels } item.ParentId = internalChannelId; - if (!string.Equals(channelItem.ExternalId, info.Id, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(item.ExternalId, info.Id, StringComparison.OrdinalIgnoreCase)) { forceUpdate = true; } - channelItem.ExternalId = info.Id; + item.ExternalId = info.Id; var channelMediaItem = item as IChannelMediaItem; diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index fb202b798..d0e2ffde7 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -480,7 +480,7 @@ namespace MediaBrowser.Server.Implementations.Dto var folder = (Folder)item; - if (!(folder is IChannelItem) && !(folder is Channel)) + if (item.SourceType == SourceType.Library) { dto.ChildCount = GetChildCount(folder, user); @@ -1531,10 +1531,9 @@ namespace MediaBrowser.Server.Implementations.Dto dto.ChannelId = item.ChannelId; - var channelItem = item as IChannelItem; - if (channelItem != null) + if (item.SourceType == SourceType.Channel) { - dto.ChannelName = _channelManagerFactory().GetChannel(channelItem.ChannelId).Name; + dto.ChannelName = _channelManagerFactory().GetChannel(item.ChannelId).Name; } var channelMediaItem = item as IChannelMediaItem; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs index 28883e9a2..dfaedbc9d 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs @@ -342,7 +342,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints void _libraryManager_ItemRemoved(object sender, ItemChangeEventArgs e) { - if (e.Item is LiveTvProgram || e.Item is IChannelItem) + if (e.Item.SourceType != SourceType.Library) { return; } @@ -356,7 +356,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints void _libraryManager_ItemAdded(object sender, ItemChangeEventArgs e) { - if (e.Item is LiveTvProgram || e.Item is IChannelItem) + if (e.Item.SourceType != SourceType.Library) { return; } diff --git a/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs index 703096a2b..237c7157b 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs @@ -282,7 +282,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints return false; } - return !(item is IChannelItem) && !(item is ILiveTvItem); + return item.SourceType == SourceType.Library; } /// <summary> diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs index a9e4aaa0b..da1d25f2c 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs @@ -346,7 +346,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications return false; } - return !(item is IChannelItem) && !(item is ILiveTvItem); + return item.SourceType == SourceType.Library; } private async void LibraryUpdateTimerCallback(object state) diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 3c56af9e6..184737ece 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -347,11 +347,7 @@ namespace MediaBrowser.Server.Implementations.Library private void RegisterItem(Guid id, BaseItem item) { - if (item is LiveTvProgram) - { - return; - } - if (item is IChannelItem) + if (item.SourceType != SourceType.Library) { return; } diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs index 8ebc8d91e..e22f86b11 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs @@ -536,7 +536,7 @@ namespace MediaBrowser.Server.Implementations.Sync } } - if (item is LiveTvChannel || item is IChannelItem) + if (item.SourceType != SourceType.Library) { return false; } |
