added a new encoding settings page under advanced

This commit is contained in:
Luke Pulverenti 2014-01-07 13:39:35 -05:00
parent 9862959354
commit 5392ff4da4
16 changed files with 116 additions and 26 deletions

View file

@ -120,16 +120,16 @@ namespace MediaBrowser.Api.LiveTv
[ApiMember(Name = "UserId", Description = "Optional filter by user id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "UserId", Description = "Optional filter by user id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string UserId { get; set; } public string UserId { get; set; }
[ApiMember(Name = "MinStartDate", Description = "Optional. The minimum premiere date. Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "MinStartDate", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string MinStartDate { get; set; } public string MinStartDate { get; set; }
[ApiMember(Name = "MaxStartDate", Description = "Optional. The maximum premiere date. Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "MaxStartDate", Description = "Optional. The maximum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string MaxStartDate { get; set; } public string MaxStartDate { get; set; }
[ApiMember(Name = "MinEndDate", Description = "Optional. The minimum premiere date. Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "MinEndDate", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string MinEndDate { get; set; } public string MinEndDate { get; set; }
[ApiMember(Name = "MaxEndDate", Description = "Optional. The maximum premiere date. Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "MaxEndDate", Description = "Optional. The maximum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string MaxEndDate { get; set; } public string MaxEndDate { get; set; }
} }
@ -215,6 +215,12 @@ namespace MediaBrowser.Api.LiveTv
public string Id { get; set; } public string Id { get; set; }
} }
[Route("/LiveTv/GuideInfo", "GET")]
[Api(Description = "Gets guide info")]
public class GetGuideInfo : IReturn<GuideInfo>
{
}
public class LiveTvService : BaseApiService public class LiveTvService : BaseApiService
{ {
private readonly ILiveTvManager _liveTvManager; private readonly ILiveTvManager _liveTvManager;
@ -274,22 +280,22 @@ namespace MediaBrowser.Api.LiveTv
if (!string.IsNullOrEmpty(request.MinStartDate)) if (!string.IsNullOrEmpty(request.MinStartDate))
{ {
query.MinStartDate = DateTime.ParseExact(request.MinStartDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); query.MinStartDate = DateTime.Parse(request.MinStartDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
} }
if (!string.IsNullOrEmpty(request.MinEndDate)) if (!string.IsNullOrEmpty(request.MinEndDate))
{ {
query.MinEndDate = DateTime.ParseExact(request.MinEndDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); query.MinEndDate = DateTime.Parse(request.MinEndDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
} }
if (!string.IsNullOrEmpty(request.MaxStartDate)) if (!string.IsNullOrEmpty(request.MaxStartDate))
{ {
query.MaxStartDate = DateTime.ParseExact(request.MaxStartDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); query.MaxStartDate = DateTime.Parse(request.MaxStartDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
} }
if (!string.IsNullOrEmpty(request.MaxEndDate)) if (!string.IsNullOrEmpty(request.MaxEndDate))
{ {
query.MaxEndDate = DateTime.ParseExact(request.MaxEndDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); query.MaxEndDate = DateTime.Parse(request.MaxEndDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
} }
var result = _liveTvManager.GetPrograms(query, CancellationToken.None).Result; var result = _liveTvManager.GetPrograms(query, CancellationToken.None).Result;
@ -453,5 +459,10 @@ namespace MediaBrowser.Api.LiveTv
return ToOptimizedResult(group); return ToOptimizedResult(group);
} }
public object Get(GetGuideInfo request)
{
return ToOptimizedResult(_liveTvManager.GetGuideInfo());
}
} }
} }

View file

@ -257,10 +257,10 @@ namespace MediaBrowser.Api.Playback
/// Gets the number of threads. /// Gets the number of threads.
/// </summary> /// </summary>
/// <returns>System.Int32.</returns> /// <returns>System.Int32.</returns>
/// <exception cref="System.Exception">Unrecognized EncodingQuality value.</exception> /// <exception cref="System.Exception">Unrecognized MediaEncodingQuality value.</exception>
protected int GetNumberOfThreads() protected int GetNumberOfThreads()
{ {
var quality = ServerConfigurationManager.Configuration.EncodingQuality; var quality = ServerConfigurationManager.Configuration.MediaEncodingQuality;
switch (quality) switch (quality)
{ {
@ -273,7 +273,7 @@ namespace MediaBrowser.Api.Playback
case EncodingQuality.MaxQuality: case EncodingQuality.MaxQuality:
return 0; return 0;
default: default:
throw new Exception("Unrecognized EncodingQuality value."); throw new Exception("Unrecognized MediaEncodingQuality value.");
} }
} }
@ -706,6 +706,13 @@ namespace MediaBrowser.Api.Playback
state.IsoMount = await IsoManager.Mount(state.MediaPath, CancellationToken.None).ConfigureAwait(false); state.IsoMount = await IsoManager.Mount(state.MediaPath, CancellationToken.None).ConfigureAwait(false);
} }
var commandLineArgs = GetCommandLineArguments(outputPath, state, true);
if (ServerConfigurationManager.Configuration.EnableDebugEncodingLogging)
{
commandLineArgs = "-loglevel debug " + commandLineArgs;
}
var process = new Process var process = new Process
{ {
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo
@ -719,7 +726,7 @@ namespace MediaBrowser.Api.Playback
FileName = MediaEncoder.EncoderPath, FileName = MediaEncoder.EncoderPath,
WorkingDirectory = Path.GetDirectoryName(MediaEncoder.EncoderPath), WorkingDirectory = Path.GetDirectoryName(MediaEncoder.EncoderPath),
Arguments = GetCommandLineArguments(outputPath, state, true), Arguments = commandLineArgs,
WindowStyle = ProcessWindowStyle.Hidden, WindowStyle = ProcessWindowStyle.Hidden,
ErrorDialog = false, ErrorDialog = false,

View file

@ -7,6 +7,7 @@ using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using System; using System;
@ -111,7 +112,15 @@ namespace MediaBrowser.Api.Playback.Hls
if (isPlaylistNewlyCreated) if (isPlaylistNewlyCreated)
{ {
await WaitForMinimumSegmentCount(playlist, 3).ConfigureAwait(false); var minimumSegmentCount = 3;
var quality = ServerConfigurationManager.Configuration.MediaEncodingQuality;
if (quality == EncodingQuality.HighSpeed || quality == EncodingQuality.HighQuality)
{
minimumSegmentCount = 2;
}
await WaitForMinimumSegmentCount(playlist, minimumSegmentCount).ConfigureAwait(false);
} }
int audioBitrate; int audioBitrate;

View file

@ -29,6 +29,7 @@ namespace MediaBrowser.Api.Playback.Progressive
[Route("/Videos/{Id}/stream.m2ts", "GET")] [Route("/Videos/{Id}/stream.m2ts", "GET")]
[Route("/Videos/{Id}/stream.3gp", "GET")] [Route("/Videos/{Id}/stream.3gp", "GET")]
[Route("/Videos/{Id}/stream.wmv", "GET")] [Route("/Videos/{Id}/stream.wmv", "GET")]
[Route("/Videos/{Id}/stream.wtv", "GET")]
[Route("/Videos/{Id}/stream", "GET")] [Route("/Videos/{Id}/stream", "GET")]
[Route("/Videos/{Id}/stream.ts", "HEAD")] [Route("/Videos/{Id}/stream.ts", "HEAD")]
[Route("/Videos/{Id}/stream.webm", "HEAD")] [Route("/Videos/{Id}/stream.webm", "HEAD")]
@ -42,6 +43,7 @@ namespace MediaBrowser.Api.Playback.Progressive
[Route("/Videos/{Id}/stream.avi", "HEAD")] [Route("/Videos/{Id}/stream.avi", "HEAD")]
[Route("/Videos/{Id}/stream.3gp", "HEAD")] [Route("/Videos/{Id}/stream.3gp", "HEAD")]
[Route("/Videos/{Id}/stream.wmv", "HEAD")] [Route("/Videos/{Id}/stream.wmv", "HEAD")]
[Route("/Videos/{Id}/stream.wtv", "HEAD")]
[Route("/Videos/{Id}/stream.m2ts", "HEAD")] [Route("/Videos/{Id}/stream.m2ts", "HEAD")]
[Route("/Videos/{Id}/stream", "HEAD")] [Route("/Videos/{Id}/stream", "HEAD")]
[Api(Description = "Gets a video stream")] [Api(Description = "Gets a video stream")]

View file

@ -196,10 +196,10 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "AiredDuringSeason", Description = "Gets all episodes that aired during a season, including specials.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "AiredDuringSeason", Description = "Gets all episodes that aired during a season, including specials.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? AiredDuringSeason { get; set; } public int? AiredDuringSeason { get; set; }
[ApiMember(Name = "MinPremiereDate", Description = "Optional. The minimum premiere date. Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "MinPremiereDate", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string MinPremiereDate { get; set; } public string MinPremiereDate { get; set; }
[ApiMember(Name = "MaxPremiereDate", Description = "Optional. The maximum premiere date. Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "MaxPremiereDate", Description = "Optional. The maximum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string MaxPremiereDate { get; set; } public string MaxPremiereDate { get; set; }
[ApiMember(Name = "HasOverview", Description = "Optional filter by items that have an overview or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "HasOverview", Description = "Optional filter by items that have an overview or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
@ -1031,14 +1031,14 @@ namespace MediaBrowser.Api.UserLibrary
if (!string.IsNullOrEmpty(request.MinPremiereDate)) if (!string.IsNullOrEmpty(request.MinPremiereDate))
{ {
var date = DateTime.ParseExact(request.MinPremiereDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); var date = DateTime.Parse(request.MinPremiereDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
items = items.Where(i => i.PremiereDate.HasValue && i.PremiereDate.Value >= date); items = items.Where(i => i.PremiereDate.HasValue && i.PremiereDate.Value >= date);
} }
if (!string.IsNullOrEmpty(request.MaxPremiereDate)) if (!string.IsNullOrEmpty(request.MaxPremiereDate))
{ {
var date = DateTime.ParseExact(request.MaxPremiereDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); var date = DateTime.Parse(request.MaxPremiereDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
items = items.Where(i => i.PremiereDate.HasValue && i.PremiereDate.Value <= date); items = items.Where(i => i.PremiereDate.HasValue && i.PremiereDate.Value <= date);
} }

View file

@ -109,7 +109,12 @@ namespace MediaBrowser.Api.WebSocket
{ {
while (!reader.EndOfStream) while (!reader.EndOfStream)
{ {
lines.Add(await reader.ReadLineAsync().ConfigureAwait(false)); var line = await reader.ReadLineAsync().ConfigureAwait(false);
if (line.IndexOf(", Debug,", StringComparison.OrdinalIgnoreCase) == -1)
{
lines.Add(line);
}
} }
} }
} }

View file

@ -235,5 +235,11 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
Task CloseLiveStream(string id, CancellationToken cancellationToken); Task CloseLiveStream(string id, CancellationToken cancellationToken);
/// <summary>
/// Gets the guide information.
/// </summary>
/// <returns>GuideInfo.</returns>
GuideInfo GetGuideInfo();
} }
} }

View file

@ -45,7 +45,7 @@ namespace MediaBrowser.Controller.Providers
protected static readonly Task<bool> FalseTaskResult = Task.FromResult(false); protected static readonly Task<bool> FalseTaskResult = Task.FromResult(false);
protected static readonly SemaphoreSlim XmlParsingResourcePool = new SemaphoreSlim(5, 5); protected static readonly SemaphoreSlim XmlParsingResourcePool = new SemaphoreSlim(4, 4);
/// <summary> /// <summary>
/// Supportses the specified item. /// Supportses the specified item.

View file

@ -207,7 +207,7 @@ namespace MediaBrowser.Model.Configuration
/// Gets or sets the encoding quality. /// Gets or sets the encoding quality.
/// </summary> /// </summary>
/// <value>The encoding quality.</value> /// <value>The encoding quality.</value>
public EncodingQuality EncodingQuality { get; set; } public EncodingQuality MediaEncodingQuality { get; set; }
public bool EnableMovieChapterImageExtraction { get; set; } public bool EnableMovieChapterImageExtraction { get; set; }
public bool EnableEpisodeChapterImageExtraction { get; set; } public bool EnableEpisodeChapterImageExtraction { get; set; }
@ -219,12 +219,15 @@ namespace MediaBrowser.Model.Configuration
public MetadataOptions GameOptions { get; set; } public MetadataOptions GameOptions { get; set; }
public MetadataOptions BookOptions { get; set; } public MetadataOptions BookOptions { get; set; }
public bool EnableDebugEncodingLogging { get; set; }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary> /// </summary>
public ServerConfiguration() public ServerConfiguration()
: base() : base()
{ {
MediaEncodingQuality = EncodingQuality.HighSpeed;
ImageSavingConvention = ImageSavingConvention.Legacy; ImageSavingConvention = ImageSavingConvention.Legacy;
HttpServerPortNumber = 8096; HttpServerPortNumber = 8096;
LegacyWebSocketPortNumber = 8945; LegacyWebSocketPortNumber = 8945;

View file

@ -1,4 +1,5 @@
 using System;
namespace MediaBrowser.Model.LiveTv namespace MediaBrowser.Model.LiveTv
{ {
/// <summary> /// <summary>
@ -12,4 +13,19 @@ namespace MediaBrowser.Model.LiveTv
/// <value>The name.</value> /// <value>The name.</value>
public string Name { get; set; } public string Name { get; set; }
} }
public class GuideInfo
{
/// <summary>
/// Gets or sets the start date.
/// </summary>
/// <value>The start date.</value>
public DateTime StartDate { get; set; }
/// <summary>
/// Gets or sets the end date.
/// </summary>
/// <value>The end date.</value>
public DateTime EndDate { get; set; }
}
} }

View file

@ -57,6 +57,7 @@ namespace MediaBrowser.Providers.Movies
/// </summary> /// </summary>
/// <param name="item">The item.</param> /// <param name="item">The item.</param>
/// <param name="force">if set to <c>true</c> [force].</param> /// <param name="force">if set to <c>true</c> [force].</param>
/// <param name="providerInfo">The provider information.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{System.Boolean}.</returns> /// <returns>Task{System.Boolean}.</returns>
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
@ -79,12 +80,10 @@ namespace MediaBrowser.Providers.Movies
{ {
XmlParsingResourcePool.Release(); XmlParsingResourcePool.Release();
} }
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
return true;
} }
return false; SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
return true;
} }
} }
} }

View file

@ -980,5 +980,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{ {
return ActiveService.CloseLiveStream(id, cancellationToken); return ActiveService.CloseLiveStream(id, cancellationToken);
} }
public GuideInfo GetGuideInfo()
{
var programs = _programs.ToList();
var startDate = programs.Select(i => i.Value.ProgramInfo.StartDate).Min();
var endDate = programs.Select(i => i.Value.ProgramInfo.StartDate).Max();
return new GuideInfo
{
StartDate = startDate,
EndDate = endDate
};
}
} }
} }

View file

@ -481,6 +481,7 @@ namespace MediaBrowser.WebDashboard.Api
"edititemmetadata.js", "edititemmetadata.js",
"edititempeople.js", "edititempeople.js",
"edititemimages.js", "edititemimages.js",
"encodingsettings.js",
"gamesrecommendedpage.js", "gamesrecommendedpage.js",
"gamesystemspage.js", "gamesystemspage.js",
"gamespage.js", "gamespage.js",

View file

@ -389,6 +389,17 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
}); });
}; };
self.getLiveTvGuideInfo = function (options) {
var url = self.getUrl("LiveTv/GuideInfo", options || {});
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.getLiveTvChannel = function (id, userId) { self.getLiveTvChannel = function (id, userId) {
if (!id) { if (!id) {

View file

@ -160,6 +160,9 @@
<Content Include="dashboard-ui\css\mediaplayer.css"> <Content Include="dashboard-ui\css\mediaplayer.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\encodingsettings.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\livetvchannel.html"> <Content Include="dashboard-ui\livetvchannel.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -397,6 +400,9 @@
<Content Include="dashboard-ui\scripts\appsplayback.js"> <Content Include="dashboard-ui\scripts\appsplayback.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\scripts\encodingsettings.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\librarymenu.js"> <Content Include="dashboard-ui\scripts\librarymenu.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.218" targetFramework="net45" /> <package id="MediaBrowser.ApiClient.Javascript" version="3.0.219" targetFramework="net45" />
</packages> </packages>