mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-29 23:12:39 +01:00
Inherit trigger from pushed command models
This commit is contained in:
parent
10b55bbee6
commit
0bc4903954
@ -106,6 +106,8 @@ namespace NzbDrone.Core.Messaging.Commands
|
|||||||
_logger.Trace("Publishing {0}", command.Name);
|
_logger.Trace("Publishing {0}", command.Name);
|
||||||
_logger.Trace("Checking if command is queued or started: {0}", command.Name);
|
_logger.Trace("Checking if command is queued or started: {0}", command.Name);
|
||||||
|
|
||||||
|
command.Trigger = trigger;
|
||||||
|
|
||||||
lock (_commandQueue)
|
lock (_commandQueue)
|
||||||
{
|
{
|
||||||
var existingCommands = QueuedOrStarted(command.Name);
|
var existingCommands = QueuedOrStarted(command.Name);
|
||||||
@ -142,7 +144,6 @@ namespace NzbDrone.Core.Messaging.Commands
|
|||||||
var command = GetCommand(commandName);
|
var command = GetCommand(commandName);
|
||||||
command.LastExecutionTime = lastExecutionTime;
|
command.LastExecutionTime = lastExecutionTime;
|
||||||
command.LastStartTime = lastStartTime;
|
command.LastStartTime = lastStartTime;
|
||||||
command.Trigger = trigger;
|
|
||||||
|
|
||||||
return Push(command, priority, trigger);
|
return Push(command, priority, trigger);
|
||||||
}
|
}
|
||||||
@ -244,13 +245,13 @@ namespace NzbDrone.Core.Messaging.Commands
|
|||||||
_repo.Trim();
|
_repo.Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
private dynamic GetCommand(string commandName)
|
private Command GetCommand(string commandName)
|
||||||
{
|
{
|
||||||
commandName = commandName.Split('.').Last();
|
commandName = commandName.Split('.').Last();
|
||||||
var commands = _knownTypes.GetImplementations(typeof(Command));
|
var commands = _knownTypes.GetImplementations(typeof(Command));
|
||||||
var commandType = commands.Single(c => c.Name.Equals(commandName, StringComparison.InvariantCultureIgnoreCase));
|
var commandType = commands.Single(c => c.Name.Equals(commandName, StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
|
||||||
return Json.Deserialize("{}", commandType);
|
return Json.Deserialize("{}", commandType) as Command;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update(CommandModel command, CommandStatus status, string message)
|
private void Update(CommandModel command, CommandStatus status, string message)
|
||||||
|
@ -66,9 +66,8 @@ namespace Sonarr.Api.V3.Commands
|
|||||||
? CommandPriority.High
|
? CommandPriority.High
|
||||||
: CommandPriority.Normal;
|
: CommandPriority.Normal;
|
||||||
|
|
||||||
dynamic command = STJson.Deserialize(body, commandType);
|
var command = STJson.Deserialize(body, commandType) as Command;
|
||||||
|
|
||||||
command.Trigger = CommandTrigger.Manual;
|
|
||||||
command.SuppressMessages = !command.SendUpdatesToClient;
|
command.SuppressMessages = !command.SendUpdatesToClient;
|
||||||
command.SendUpdatesToClient = true;
|
command.SendUpdatesToClient = true;
|
||||||
command.ClientUserAgent = Request.Headers["UserAgent"];
|
command.ClientUserAgent = Request.Headers["UserAgent"];
|
||||||
|
@ -190,9 +190,8 @@ namespace Sonarr.Api.V3.Series
|
|||||||
{
|
{
|
||||||
SeriesId = series.Id,
|
SeriesId = series.Id,
|
||||||
SourcePath = sourcePath,
|
SourcePath = sourcePath,
|
||||||
DestinationPath = destinationPath,
|
DestinationPath = destinationPath
|
||||||
Trigger = CommandTrigger.Manual
|
}, trigger: CommandTrigger.Manual);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var model = seriesResource.ToModel(series);
|
var model = seriesResource.ToModel(series);
|
||||||
|
Loading…
Reference in New Issue
Block a user