aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Controller/Channels/ChannelFolderItem.cs2
-rw-r--r--MediaBrowser.Controller/Channels/ChannelVideoItem.cs4
-rw-r--r--MediaBrowser.Controller/Channels/IChannelItem.cs11
-rw-r--r--MediaBrowser.Controller/Channels/IChannelMediaItem.cs9
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs3
-rw-r--r--MediaBrowser.Controller/Entities/SourceType.cs10
-rw-r--r--MediaBrowser.Controller/MediaBrowser.Controller.csproj2
-rw-r--r--MediaBrowser.Server.Implementations/Channels/ChannelManager.cs12
-rw-r--r--MediaBrowser.Server.Implementations/Dto/DtoService.cs7
-rw-r--r--MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs4
-rw-r--r--MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs2
-rw-r--r--MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs2
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs6
-rw-r--r--MediaBrowser.Server.Implementations/Sync/SyncManager.cs2
14 files changed, 38 insertions, 38 deletions
diff --git a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
index f662020bb..174cd282a 100644
--- a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
@@ -11,7 +11,7 @@ using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Channels
{
- public class ChannelFolderItem : Folder, IChannelItem
+ public class ChannelFolderItem : Folder
{
public ChannelFolderType ChannelFolderType { get; set; }
diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
index 79ad4b36b..098db1891 100644
--- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
@@ -132,9 +132,9 @@ namespace MediaBrowser.Controller.Channels
return IsVisibleStandaloneInternal(user, false) && IsChannelVisible(this, user);
}
- internal static bool IsChannelVisible(IChannelItem item, User user)
+ internal static bool IsChannelVisible(BaseItem channelItem, User user)
{
- var channel = ChannelManager.GetChannel(item.ChannelId);
+ var channel = ChannelManager.GetChannel(channelItem.ChannelId);
return channel.IsVisible(user);
}
diff --git a/MediaBrowser.Controller/Channels/IChannelItem.cs b/MediaBrowser.Controller/Channels/IChannelItem.cs
deleted file mode 100644
index 9b5f0359b..000000000
--- a/MediaBrowser.Controller/Channels/IChannelItem.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using MediaBrowser.Controller.Entities;
-
-namespace MediaBrowser.Controller.Channels
-{
- public interface IChannelItem : IHasImages, IHasTags
- {
- string ChannelId { get; set; }
-
- string ExternalId { get; set; }
- }
-}
diff --git a/MediaBrowser.Controller/Channels/IChannelMediaItem.cs b/MediaBrowser.Controller/Channels/IChannelMediaItem.cs
index 60a29da90..8970879c9 100644
--- a/MediaBrowser.Controller/Channels/IChannelMediaItem.cs
+++ b/MediaBrowser.Controller/Channels/IChannelMediaItem.cs
@@ -1,11 +1,16 @@
-using MediaBrowser.Model.Channels;
+using System;
+using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Entities;
using System.Collections.Generic;
namespace MediaBrowser.Controller.Channels
{
- public interface IChannelMediaItem : IChannelItem
+ public interface IChannelMediaItem
{
+ string ChannelId { get; set; }
+ Guid Id { get; set; }
+ string ExternalId { get; set; }
+
long? RunTimeTicks { get; set; }
string MediaType { get; }
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 4106c7197..d607facf1 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -169,6 +169,9 @@ namespace MediaBrowser.Controller.Entities
[IgnoreDataMember]
public bool IsOffline { get; set; }
+ [IgnoreDataMember]
+ public SourceType SourceType { get; set; }
+
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
diff --git a/MediaBrowser.Controller/Entities/SourceType.cs b/MediaBrowser.Controller/Entities/SourceType.cs
new file mode 100644
index 000000000..9c307b4e6
--- /dev/null
+++ b/MediaBrowser.Controller/Entities/SourceType.cs
@@ -0,0 +1,10 @@
+
+namespace MediaBrowser.Controller.Entities
+{
+ public enum SourceType
+ {
+ Library = 0,
+ Channel = 1,
+ LiveTV = 2
+ }
+}
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index f74d82caa..a4f30224b 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -84,7 +84,6 @@
<Compile Include="Channels\ChannelSearchInfo.cs" />
<Compile Include="Channels\IChannel.cs" />
<Compile Include="Channels\IChannelManager.cs" />
- <Compile Include="Channels\IChannelItem.cs" />
<Compile Include="Channels\ChannelAudioItem.cs" />
<Compile Include="Channels\ChannelVideoItem.cs" />
<Compile Include="Channels\Channel.cs" />
@@ -180,6 +179,7 @@
<Compile Include="Entities\Photo.cs" />
<Compile Include="Entities\PhotoAlbum.cs" />
<Compile Include="Entities\Share.cs" />
+ <Compile Include="Entities\SourceType.cs" />
<Compile Include="Entities\UserView.cs" />
<Compile Include="Entities\UserViewBuilder.cs" />
<Compile Include="FileOrganization\IFileOrganizationService.cs" />
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;
}