|
|
@ -1,5 +1,3 @@
|
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading;
|
|
|
@ -11,20 +9,29 @@ using MediaBrowser.Model.Entities;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Emby.Server.Implementations.Channels
|
|
|
|
namespace Emby.Server.Implementations.Channels
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// An image provider for channels.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public class ChannelImageProvider : IDynamicImageProvider, IHasItemChangeMonitor
|
|
|
|
public class ChannelImageProvider : IDynamicImageProvider, IHasItemChangeMonitor
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly IChannelManager _channelManager;
|
|
|
|
private readonly IChannelManager _channelManager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Initializes a new instance of the <see cref="ChannelImageProvider"/> class.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="channelManager">The channel manager.</param>
|
|
|
|
public ChannelImageProvider(IChannelManager channelManager)
|
|
|
|
public ChannelImageProvider(IChannelManager channelManager)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_channelManager = channelManager;
|
|
|
|
_channelManager = channelManager;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
|
|
|
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return GetChannel(item).GetSupportedChannelImages();
|
|
|
|
return GetChannel(item).GetSupportedChannelImages();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public Task<DynamicImageResponse> GetImage(BaseItem item, ImageType type, CancellationToken cancellationToken)
|
|
|
|
public Task<DynamicImageResponse> GetImage(BaseItem item, ImageType type, CancellationToken cancellationToken)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var channel = GetChannel(item);
|
|
|
|
var channel = GetChannel(item);
|
|
|
@ -32,8 +39,10 @@ namespace Emby.Server.Implementations.Channels
|
|
|
|
return channel.GetChannelImage(type, cancellationToken);
|
|
|
|
return channel.GetChannelImage(type, cancellationToken);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public string Name => "Channel Image Provider";
|
|
|
|
public string Name => "Channel Image Provider";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public bool Supports(BaseItem item)
|
|
|
|
public bool Supports(BaseItem item)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return item is Channel;
|
|
|
|
return item is Channel;
|
|
|
@ -46,6 +55,7 @@ namespace Emby.Server.Implementations.Channels
|
|
|
|
return ((ChannelManager)_channelManager).GetChannelProvider(channel);
|
|
|
|
return ((ChannelManager)_channelManager).GetChannelProvider(channel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public bool HasChanged(BaseItem item, IDirectoryService directoryService)
|
|
|
|
public bool HasChanged(BaseItem item, IDirectoryService directoryService)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return GetSupportedImages(item).Any(i => !item.HasImage(i));
|
|
|
|
return GetSupportedImages(item).Any(i => !item.HasImage(i));
|
|
|
|