diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index 0df916ded3..f7dc930097 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -79,21 +79,6 @@ namespace Emby.Server.Implementations.Channels _channels = channels.ToArray(); } - public string ChannelDownloadPath - { - get - { - var options = _config.GetChannelsConfiguration(); - - if (!string.IsNullOrWhiteSpace(options.DownloadPath)) - { - return options.DownloadPath; - } - - return Path.Combine(_config.ApplicationPaths.ProgramDataPath, "channels"); - } - } - private IEnumerable GetAllChannels() { return _channels @@ -288,7 +273,7 @@ namespace Emby.Server.Implementations.Channels _jsonSerializer.SerializeToFile(mediaSources, path); } - public async Task> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken) + public async Task> GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken) { IEnumerable results = new List(); var video = item as Video; @@ -302,17 +287,9 @@ namespace Emby.Server.Implementations.Channels results = audio.ChannelMediaSources ?? GetSavedMediaSources(audio); } - var sources = SortMediaInfoResults(results) + return SortMediaInfoResults(results) .Select(i => GetMediaSource(item, i)) .ToList(); - - if (includeCachedVersions) - { - var cachedVersions = GetCachedChannelItemMediaSources(item); - sources.InsertRange(0, cachedVersions); - } - - return sources; } public async Task> GetDynamicMediaSources(BaseItem item, CancellationToken cancellationToken) @@ -334,14 +311,9 @@ namespace Emby.Server.Implementations.Channels results = new List(); } - var list = SortMediaInfoResults(results) + return SortMediaInfoResults(results) .Select(i => GetMediaSource(item, i)) .ToList(); - - var cachedVersions = GetCachedChannelItemMediaSources(item); - list.InsertRange(0, cachedVersions); - - return list; } private readonly ConcurrentDictionary>> _channelItemMediaInfo = @@ -369,55 +341,6 @@ namespace Emby.Server.Implementations.Channels return list; } - private IEnumerable GetCachedChannelItemMediaSources(BaseItem item) - { - var filenamePrefix = item.Id.ToString("N"); - var parentPath = Path.Combine(ChannelDownloadPath, item.ChannelId); - - try - { - var files = _fileSystem.GetFiles(parentPath); - - if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase)) - { - files = files.Where(i => _libraryManager.IsVideoFile(i.FullName)); - } - else - { - files = files.Where(i => _libraryManager.IsAudioFile(i.FullName)); - } - - var file = files - .FirstOrDefault(i => i.Name.StartsWith(filenamePrefix, StringComparison.OrdinalIgnoreCase)); - - if (file != null) - { - var cachedItem = _libraryManager.ResolvePath(file); - - if (cachedItem != null) - { - var hasMediaSources = _libraryManager.GetItemById(cachedItem.Id) as IHasMediaSources; - - if (hasMediaSources != null) - { - var source = hasMediaSources.GetMediaSources(true).FirstOrDefault(); - - if (source != null) - { - return new[] { source }; - } - } - } - } - } - catch (IOException) - { - - } - - return new List(); - } - private MediaSourceInfo GetMediaSource(BaseItem item, ChannelMediaInfo info) { var source = info.ToMediaSource(); diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs index 9177e2d813..7927446289 100644 --- a/MediaBrowser.Controller/Channels/IChannelManager.cs +++ b/MediaBrowser.Controller/Channels/IChannelManager.cs @@ -15,15 +15,8 @@ namespace MediaBrowser.Controller.Channels /// Adds the parts. /// /// The channels. - /// The factories. void AddParts(IEnumerable channels); - /// - /// Gets the channel download path. - /// - /// The channel download path. - string ChannelDownloadPath { get; } - /// /// Gets the channel features. /// @@ -115,10 +108,9 @@ namespace MediaBrowser.Controller.Channels /// Gets the channel item media sources. /// /// The item. - /// if set to true [include cached versions]. /// The cancellation token. /// Task{IEnumerable{MediaSourceInfo}}. - Task> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken); + Task> GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken); /// /// Gets the channel folder. diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index e4f638cb6f..3a6a7765b1 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -206,7 +206,7 @@ namespace MediaBrowser.Controller.Entities.Audio { if (SourceType == SourceType.Channel) { - var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None) + var sources = ChannelManager.GetStaticMediaSources(this, CancellationToken.None) .Result.ToList(); if (sources.Count > 0) diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 7ba59df4f3..47df12e1b6 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -549,7 +549,7 @@ namespace MediaBrowser.Controller.Entities { if (SourceType == SourceType.Channel) { - var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None) + var sources = ChannelManager.GetStaticMediaSources(this, CancellationToken.None) .Result.ToList(); if (sources.Count > 0)