fixes #859 - Support adaptive bitrate streaming

This commit is contained in:
Luke Pulverenti
2014-06-30 13:40:46 -04:00
parent f526a07edd
commit 8ae316a2f3
11 changed files with 122 additions and 98 deletions

View File

@@ -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)
}
};
}
}
}

View File

@@ -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;

View File

@@ -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)
{

View File

@@ -101,6 +101,7 @@
<Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link>
</Compile>
<Compile Include="Channels\ChannelConfigurations.cs" />
<Compile Include="Channels\ChannelDownloadScheduledTask.cs" />
<Compile Include="Channels\ChannelImageProvider.cs" />
<Compile Include="Channels\ChannelItemImageProvider.cs" />