aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Channels
diff options
context:
space:
mode:
authorT. Adams <t.adams88@gmail.com>2015-04-03 11:04:25 -0700
committerT. Adams <t.adams88@gmail.com>2015-04-03 11:04:25 -0700
commitabf12569ba2aa31ea3a00e4faf3adad2f740cbd9 (patch)
tree47c57c6361825491d38e3def6b716926ddd9aa59 /MediaBrowser.Controller/Channels
parent46c92107490263f8e6abefbd2259780013fa195d (diff)
parentef505c8e9e2b8f348aeaa89be6bc446014b72996 (diff)
Merging in latest dev
Diffstat (limited to 'MediaBrowser.Controller/Channels')
-rw-r--r--MediaBrowser.Controller/Channels/Channel.cs15
-rw-r--r--MediaBrowser.Controller/Channels/ChannelAudioItem.cs16
-rw-r--r--MediaBrowser.Controller/Channels/ChannelMediaInfo.cs6
-rw-r--r--MediaBrowser.Controller/Channels/ChannelVideoItem.cs16
-rw-r--r--MediaBrowser.Controller/Channels/IChannelManager.cs6
5 files changed, 32 insertions, 27 deletions
diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs
index b6514ca0a..f746d87ff 100644
--- a/MediaBrowser.Controller/Channels/Channel.cs
+++ b/MediaBrowser.Controller/Channels/Channel.cs
@@ -5,7 +5,6 @@ using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using MediaBrowser.Model.Users;
namespace MediaBrowser.Controller.Channels
{
@@ -15,19 +14,9 @@ namespace MediaBrowser.Controller.Channels
public override bool IsVisible(User user)
{
- if (user.Policy.BlockedChannels != null)
+ if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
{
- if (user.Policy.BlockedChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
- {
- return false;
- }
- }
- else
- {
- if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
- {
- return false;
- }
+ return false;
}
return base.IsVisible(user);
diff --git a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
index 91b2407be..8d9024676 100644
--- a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
@@ -75,17 +75,23 @@ namespace MediaBrowser.Controller.Channels
public override IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
{
- var list = base.GetMediaSources(enablePathSubstitution).ToList();
-
- var sources = ChannelManager.GetChannelItemMediaSources(Id.ToString("N"), false, CancellationToken.None)
- .Result.ToList();
+ var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
+ .Result.ToList();
if (sources.Count > 0)
{
return sources;
}
- list.InsertRange(0, sources);
+ var list = base.GetMediaSources(enablePathSubstitution).ToList();
+
+ foreach (var mediaSource in list)
+ {
+ if (string.IsNullOrWhiteSpace(mediaSource.Path))
+ {
+ mediaSource.Type = MediaSourceType.Placeholder;
+ }
+ }
return list;
}
diff --git a/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs
index 0c2e30923..1672b75fa 100644
--- a/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs
+++ b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs
@@ -38,6 +38,7 @@ namespace MediaBrowser.Controller.Channels
public string Id { get; set; }
public bool ReadAtNativeFramerate { get; set; }
+ public bool SupportsDirectPlay { get; set; }
public ChannelMediaInfo()
{
@@ -45,6 +46,7 @@ namespace MediaBrowser.Controller.Channels
// This is most common
Protocol = MediaProtocol.Http;
+ SupportsDirectPlay = true;
}
public MediaSourceInfo ToMediaSource()
@@ -62,7 +64,9 @@ namespace MediaBrowser.Controller.Channels
RunTimeTicks = RunTimeTicks,
Name = id,
Id = id,
- ReadAtNativeFramerate = ReadAtNativeFramerate
+ ReadAtNativeFramerate = ReadAtNativeFramerate,
+ SupportsDirectStream = Protocol == MediaProtocol.File || Protocol == MediaProtocol.Http,
+ SupportsDirectPlay = SupportsDirectPlay
};
var bitrate = (AudioBitrate ?? 0) + (VideoBitrate ?? 0);
diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
index d7d4483cd..8eec2021b 100644
--- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
@@ -90,17 +90,23 @@ namespace MediaBrowser.Controller.Channels
public override IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
{
- var list = base.GetMediaSources(enablePathSubstitution).ToList();
-
- var sources = ChannelManager.GetChannelItemMediaSources(Id.ToString("N"), false, CancellationToken.None)
- .Result.ToList();
+ var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
+ .Result.ToList();
if (sources.Count > 0)
{
return sources;
}
- list.InsertRange(0, sources);
+ var list = base.GetMediaSources(enablePathSubstitution).ToList();
+
+ foreach (var mediaSource in list)
+ {
+ if (string.IsNullOrWhiteSpace(mediaSource.Path))
+ {
+ mediaSource.Type = MediaSourceType.Placeholder;
+ }
+ }
return list;
}
diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs
index 05015da37..f5c4ab373 100644
--- a/MediaBrowser.Controller/Channels/IChannelManager.cs
+++ b/MediaBrowser.Controller/Channels/IChannelManager.cs
@@ -112,11 +112,11 @@ namespace MediaBrowser.Controller.Channels
/// <summary>
/// Gets the channel item media sources.
/// </summary>
- /// <param name="id">The identifier.</param>
- /// <param name="includeDynamicSources">if set to <c>true</c> [include dynamic sources].</param>
+ /// <param name="item">The item.</param>
+ /// <param name="includeCachedVersions">if set to <c>true</c> [include cached versions].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{MediaSourceInfo}}.</returns>
- Task<IEnumerable<MediaSourceInfo>> GetChannelItemMediaSources(string id, bool includeDynamicSources, CancellationToken cancellationToken);
+ Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(IChannelMediaItem item, bool includeCachedVersions, CancellationToken cancellationToken);
/// <summary>
/// Gets the channel folder.