| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.Linq; |
| | 4 | | using System.Threading; |
| | 5 | | using System.Threading.Tasks; |
| | 6 | | using MediaBrowser.Controller.Channels; |
| | 7 | | using MediaBrowser.Controller.Entities; |
| | 8 | | using MediaBrowser.Controller.Library; |
| | 9 | | using MediaBrowser.Model.Dto; |
| | 10 | |
|
| | 11 | | namespace Jellyfin.LiveTv.Channels |
| | 12 | | { |
| | 13 | | /// <summary> |
| | 14 | | /// A media source provider for channels. |
| | 15 | | /// </summary> |
| | 16 | | public class ChannelDynamicMediaSourceProvider : IMediaSourceProvider |
| | 17 | | { |
| | 18 | | private readonly ChannelManager _channelManager; |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Initializes a new instance of the <see cref="ChannelDynamicMediaSourceProvider"/> class. |
| | 22 | | /// </summary> |
| | 23 | | /// <param name="channelManager">The channel manager.</param> |
| | 24 | | public ChannelDynamicMediaSourceProvider(IChannelManager channelManager) |
| | 25 | | { |
| 21 | 26 | | _channelManager = (ChannelManager)channelManager; |
| 21 | 27 | | } |
| | 28 | |
|
| | 29 | | /// <inheritdoc /> |
| | 30 | | public Task<IEnumerable<MediaSourceInfo>> GetMediaSources(BaseItem item, CancellationToken cancellationToken) |
| | 31 | | { |
| 0 | 32 | | return item.SourceType == SourceType.Channel |
| 0 | 33 | | ? _channelManager.GetDynamicMediaSources(item, cancellationToken) |
| 0 | 34 | | : Task.FromResult(Enumerable.Empty<MediaSourceInfo>()); |
| | 35 | | } |
| | 36 | |
|
| | 37 | | /// <inheritdoc /> |
| | 38 | | public Task<ILiveStream> OpenMediaSource(string openToken, List<ILiveStream> currentLiveStreams, CancellationTok |
| | 39 | | { |
| 0 | 40 | | throw new NotImplementedException(); |
| | 41 | | } |
| | 42 | | } |
| | 43 | | } |