diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-06-30 13:40:46 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-06-30 13:40:46 -0400 |
| commit | 8ae316a2f3333106921e7bc587bc990a8899c613 (patch) | |
| tree | be4e6947b504ffdcc64bcafd63a476b125f05e36 /MediaBrowser.Server.Implementations/Channels | |
| parent | f526a07edd13866644dbbee05a6caec85c3e10e1 (diff) | |
fixes #859 - Support adaptive bitrate streaming
Diffstat (limited to 'MediaBrowser.Server.Implementations/Channels')
3 files changed, 43 insertions, 6 deletions
diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelConfigurations.cs b/MediaBrowser.Server.Implementations/Channels/ChannelConfigurations.cs new file mode 100644 index 000000000..9dfb0404e --- /dev/null +++ b/MediaBrowser.Server.Implementations/Channels/ChannelConfigurations.cs @@ -0,0 +1,29 @@ +using MediaBrowser.Common.Configuration; +using MediaBrowser.Model.Configuration; +using System.Collections.Generic; + +namespace MediaBrowser.Server.Implementations.Channels +{ + public static class ChannelConfigurationExtension + { + public static ChannelOptions GetChannelsConfiguration(this IConfigurationManager manager) + { + return manager.GetConfiguration<ChannelOptions>("channels"); + } + } + + public class ChannelConfigurationFactory : IConfigurationFactory + { + public IEnumerable<ConfigurationStore> GetConfigurations() + { + return new List<ConfigurationStore> + { + new ConfigurationStore + { + Key = "channels", + ConfigurationType = typeof (ChannelOptions) + } + }; + } + } +} diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.cs b/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.cs index ce5c41f89..d219ab027 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.cs @@ -146,9 +146,11 @@ namespace MediaBrowser.Server.Implementations.Channels { var numComplete = 0; + var options = _config.GetChannelsConfiguration(); + foreach (var item in result.Items) { - if (_config.Configuration.ChannelOptions.DownloadingChannels.Contains(item.ChannelId)) + if (options.DownloadingChannels.Contains(item.ChannelId)) { try { @@ -282,12 +284,14 @@ namespace MediaBrowser.Server.Implementations.Channels private void CleanChannelContent(CancellationToken cancellationToken) { - if (!_config.Configuration.ChannelOptions.MaxDownloadAge.HasValue) + var options = _config.GetChannelsConfiguration(); + + if (!options.MaxDownloadAge.HasValue) { return; } - var minDateModified = DateTime.UtcNow.AddDays(0 - _config.Configuration.ChannelOptions.MaxDownloadAge.Value); + var minDateModified = DateTime.UtcNow.AddDays(0 - options.MaxDownloadAge.Value); var path = _manager.ChannelDownloadPath; diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index 188a26c60..c6dd80758 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -77,9 +77,11 @@ namespace MediaBrowser.Server.Implementations.Channels { get { - if (!string.IsNullOrWhiteSpace(_config.Configuration.ChannelOptions.DownloadPath)) + var options = _config.GetChannelsConfiguration(); + + if (!string.IsNullOrWhiteSpace(options.DownloadPath)) { - return _config.Configuration.ChannelOptions.DownloadPath; + return options.DownloadPath; } return Path.Combine(_config.ApplicationPaths.ProgramDataPath, "channels"); @@ -374,7 +376,9 @@ namespace MediaBrowser.Server.Implementations.Channels { var list = channelMediaSources.ToList(); - var width = _config.Configuration.ChannelOptions.PreferredStreamingWidth; + var options = _config.GetChannelsConfiguration(); + + var width = options.PreferredStreamingWidth; if (width.HasValue) { |
