mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-09 07:10:34 +02:00
Added SupportsAutoRunAtStartup
This commit is contained in:
parent
6ed380ed1b
commit
b4ac51aa10
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Controller.Library;
|
using System.Globalization;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.LiveTv;
|
using MediaBrowser.Controller.LiveTv;
|
||||||
using MediaBrowser.Model.LiveTv;
|
using MediaBrowser.Model.LiveTv;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -118,6 +119,18 @@ 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")]
|
||||||
|
public string MinStartDate { get; set; }
|
||||||
|
|
||||||
|
[ApiMember(Name = "MaxStartDate", Description = "Optional. The maximum premiere date. Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||||
|
public string MaxStartDate { get; set; }
|
||||||
|
|
||||||
|
[ApiMember(Name = "MinEndDate", Description = "Optional. The minimum premiere date. Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||||
|
public string MinEndDate { get; set; }
|
||||||
|
|
||||||
|
[ApiMember(Name = "MaxEndDate", Description = "Optional. The maximum premiere date. Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||||
|
public string MaxEndDate { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/LiveTv/Programs/{Id}", "GET")]
|
[Route("/LiveTv/Programs/{Id}", "GET")]
|
||||||
|
@ -253,12 +266,33 @@ namespace MediaBrowser.Api.LiveTv
|
||||||
|
|
||||||
public object Get(GetPrograms request)
|
public object Get(GetPrograms request)
|
||||||
{
|
{
|
||||||
var result = _liveTvManager.GetPrograms(new ProgramQuery
|
var query = new ProgramQuery
|
||||||
{
|
{
|
||||||
ChannelIdList = (request.ChannelIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToArray(),
|
ChannelIdList = (request.ChannelIds ?? string.Empty).Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToArray(),
|
||||||
UserId = request.UserId
|
UserId = request.UserId
|
||||||
|
};
|
||||||
|
|
||||||
}, CancellationToken.None).Result;
|
if (!string.IsNullOrEmpty(request.MinStartDate))
|
||||||
|
{
|
||||||
|
query.MinStartDate = DateTime.ParseExact(request.MinStartDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(request.MinEndDate))
|
||||||
|
{
|
||||||
|
query.MinEndDate = DateTime.ParseExact(request.MinEndDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(request.MaxStartDate))
|
||||||
|
{
|
||||||
|
query.MaxStartDate = DateTime.ParseExact(request.MaxStartDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(request.MaxEndDate))
|
||||||
|
{
|
||||||
|
query.MaxEndDate = DateTime.ParseExact(request.MaxEndDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = _liveTvManager.GetPrograms(query, CancellationToken.None).Result;
|
||||||
|
|
||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,5 +25,11 @@ namespace MediaBrowser.Controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The HTTP server URL prefix.</value>
|
/// <value>The HTTP server URL prefix.</value>
|
||||||
string HttpServerUrlPrefix { get; }
|
string HttpServerUrlPrefix { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether [supports automatic run at startup].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
|
||||||
|
bool SupportsAutoRunAtStartup { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,14 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
public override string GetUserDataKey()
|
public override string GetUserDataKey()
|
||||||
{
|
{
|
||||||
return GetClientTypeName() + "-" + Name;
|
var name = GetClientTypeName();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(RecordingInfo.ProgramId))
|
||||||
|
{
|
||||||
|
return name + "-" + RecordingInfo.ProgramId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return name + "-" + RecordingInfo.Name + (RecordingInfo.EpisodeTitle ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecordingInfo RecordingInfo { get; set; }
|
public RecordingInfo RecordingInfo { get; set; }
|
||||||
|
|
|
@ -11,7 +11,14 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
public override string GetUserDataKey()
|
public override string GetUserDataKey()
|
||||||
{
|
{
|
||||||
return GetClientTypeName() + "-" + Name;
|
var name = GetClientTypeName();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(RecordingInfo.ProgramId))
|
||||||
|
{
|
||||||
|
return name + "-" + RecordingInfo.ProgramId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return name + "-" + RecordingInfo.Name + (RecordingInfo.EpisodeTitle ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecordingInfo RecordingInfo { get; set; }
|
public RecordingInfo RecordingInfo { get; set; }
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
namespace MediaBrowser.Model.LiveTv
|
using System;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Model.LiveTv
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class ProgramQuery.
|
/// Class ProgramQuery.
|
||||||
|
@ -17,6 +19,14 @@
|
||||||
/// <value>The user identifier.</value>
|
/// <value>The user identifier.</value>
|
||||||
public string UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
|
public DateTime? MinStartDate { get; set; }
|
||||||
|
|
||||||
|
public DateTime? MaxStartDate { get; set; }
|
||||||
|
|
||||||
|
public DateTime? MinEndDate { get; set; }
|
||||||
|
|
||||||
|
public DateTime? MaxEndDate { get; set; }
|
||||||
|
|
||||||
public ProgramQuery()
|
public ProgramQuery()
|
||||||
{
|
{
|
||||||
ChannelIdList = new string[] { };
|
ChannelIdList = new string[] { };
|
||||||
|
|
|
@ -128,6 +128,12 @@ namespace MediaBrowser.Model.System
|
||||||
/// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value>
|
||||||
public bool HasUpdateAvailable { get; set; }
|
public bool HasUpdateAvailable { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether [supports automatic run at startup].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
|
||||||
|
public bool SupportsAutoRunAtStartup { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SystemInfo" /> class.
|
/// Initializes a new instance of the <see cref="SystemInfo" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
<Properties>
|
<Properties>
|
||||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Release Mono" />
|
<MonoDevelop.Ide.Workspace ActiveConfiguration="Release Mono" />
|
||||||
<MonoDevelop.Ide.Workbench ActiveDocument="MediaBrowser.Server.Mono\app.config">
|
<MonoDevelop.Ide.Workbench ActiveDocument="MediaBrowser.Server.Mono\Native\NativeApp.cs">
|
||||||
<Files>
|
<Files>
|
||||||
<File FileName="MediaBrowser.Server.Mono\app.config" Line="1" Column="1" />
|
<File FileName="MediaBrowser.Server.Mono\app.config" Line="14" Column="3" />
|
||||||
|
<File FileName="MediaBrowser.ServerApplication\ApplicationHost.cs" Line="189" Column="1" />
|
||||||
|
<File FileName="MediaBrowser.Server.Mono\Native\NativeApp.cs" Line="40" Column="17" />
|
||||||
</Files>
|
</Files>
|
||||||
</MonoDevelop.Ide.Workbench>
|
</MonoDevelop.Ide.Workbench>
|
||||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||||
|
|
|
@ -336,6 +336,34 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||||
{
|
{
|
||||||
IEnumerable<LiveTvProgram> programs = _programs.Values;
|
IEnumerable<LiveTvProgram> programs = _programs.Values;
|
||||||
|
|
||||||
|
if (query.MinEndDate.HasValue)
|
||||||
|
{
|
||||||
|
var val = query.MinEndDate.Value;
|
||||||
|
|
||||||
|
programs = programs.Where(i => i.ProgramInfo.EndDate >= val);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (query.MinStartDate.HasValue)
|
||||||
|
{
|
||||||
|
var val = query.MinStartDate.Value;
|
||||||
|
|
||||||
|
programs = programs.Where(i => i.ProgramInfo.StartDate >= val);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (query.MaxEndDate.HasValue)
|
||||||
|
{
|
||||||
|
var val = query.MaxEndDate.Value;
|
||||||
|
|
||||||
|
programs = programs.Where(i => i.ProgramInfo.EndDate <= val);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (query.MaxStartDate.HasValue)
|
||||||
|
{
|
||||||
|
var val = query.MaxStartDate.Value;
|
||||||
|
|
||||||
|
programs = programs.Where(i => i.ProgramInfo.StartDate <= val);
|
||||||
|
}
|
||||||
|
|
||||||
if (query.ChannelIdList.Length > 0)
|
if (query.ChannelIdList.Length > 0)
|
||||||
{
|
{
|
||||||
var guids = query.ChannelIdList.Select(i => new Guid(i)).ToList();
|
var guids = query.ChannelIdList.Select(i => new Guid(i)).ToList();
|
||||||
|
@ -355,7 +383,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
programs = programs.Where(i => i.IsParentalAllowed(user));
|
// Avoid implicitly captured closure
|
||||||
|
var currentUser = user;
|
||||||
|
programs = programs.Where(i => i.IsParentalAllowed(currentUser));
|
||||||
}
|
}
|
||||||
|
|
||||||
var returnArray = programs
|
var returnArray = programs
|
||||||
|
|
|
@ -46,5 +46,10 @@ namespace MediaBrowser.ServerApplication.Native
|
||||||
return MainClass.CanSelfUpdate;
|
return MainClass.CanSelfUpdate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool SupportsAutoRunAtStartup
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Globalization;
|
using MediaBrowser.Api;
|
||||||
using MediaBrowser.Api;
|
|
||||||
using MediaBrowser.Common;
|
using MediaBrowser.Common;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Constants;
|
using MediaBrowser.Common.Constants;
|
||||||
|
@ -58,6 +57,7 @@ using MediaBrowser.ServerApplication.Networking;
|
||||||
using MediaBrowser.WebDashboard.Api;
|
using MediaBrowser.WebDashboard.Api;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -186,6 +186,11 @@ namespace MediaBrowser.ServerApplication
|
||||||
get { return NativeApp.CanSelfRestart; }
|
get { return NativeApp.CanSelfRestart; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SupportsAutoRunAtStartup
|
||||||
|
{
|
||||||
|
get { return NativeApp.SupportsAutoRunAtStartup; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs the startup tasks.
|
/// Runs the startup tasks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -629,7 +634,8 @@ namespace MediaBrowser.ServerApplication
|
||||||
CanSelfRestart = CanSelfRestart,
|
CanSelfRestart = CanSelfRestart,
|
||||||
CanSelfUpdate = CanSelfUpdate,
|
CanSelfUpdate = CanSelfUpdate,
|
||||||
WanAddress = GetWanAddress(),
|
WanAddress = GetWanAddress(),
|
||||||
HasUpdateAvailable = _hasUpdateAvailable
|
HasUpdateAvailable = _hasUpdateAvailable,
|
||||||
|
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,9 +742,16 @@ namespace MediaBrowser.ServerApplication
|
||||||
OnApplicationUpdated(package.version);
|
OnApplicationUpdated(package.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Configures the automatic run at startup.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="autorun">if set to <c>true</c> [autorun].</param>
|
||||||
protected override void ConfigureAutoRunAtStartup(bool autorun)
|
protected override void ConfigureAutoRunAtStartup(bool autorun)
|
||||||
{
|
{
|
||||||
Autorun.Configure(autorun);
|
if (SupportsAutoRunAtStartup)
|
||||||
|
{
|
||||||
|
Autorun.Configure(autorun);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,18 @@ namespace MediaBrowser.ServerApplication.Native
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether [supports automatic run at startup].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
|
||||||
|
public static bool SupportsAutoRunAtStartup
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance can self update.
|
/// Gets a value indicating whether this instance can self update.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in a new issue