mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-23 15:30:56 -04:00
Merge pull request #4192 from nielsvanvelzen/generalcommand-sucks
Use GeneralCommandType enum in GeneralCommand
This commit is contained in:
commit
af24c43118
@ -135,6 +135,7 @@
|
|||||||
- [YouKnowBlom](https://github.com/YouKnowBlom)
|
- [YouKnowBlom](https://github.com/YouKnowBlom)
|
||||||
- [KristupasSavickas](https://github.com/KristupasSavickas)
|
- [KristupasSavickas](https://github.com/KristupasSavickas)
|
||||||
- [Pusta](https://github.com/pusta)
|
- [Pusta](https://github.com/pusta)
|
||||||
|
- [nielsvanvelzen](https://github.com/nielsvanvelzen)
|
||||||
|
|
||||||
# Emby Contributors
|
# Emby Contributors
|
||||||
|
|
||||||
|
@ -669,9 +669,7 @@ namespace Emby.Dlna.PlayTo
|
|||||||
|
|
||||||
private Task SendGeneralCommand(GeneralCommand command, CancellationToken cancellationToken)
|
private Task SendGeneralCommand(GeneralCommand command, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (Enum.TryParse(command.Name, true, out GeneralCommandType commandType))
|
switch (command.Name)
|
||||||
{
|
|
||||||
switch (commandType)
|
|
||||||
{
|
{
|
||||||
case GeneralCommandType.VolumeDown:
|
case GeneralCommandType.VolumeDown:
|
||||||
return _device.VolumeDown(cancellationToken);
|
return _device.VolumeDown(cancellationToken);
|
||||||
@ -724,9 +722,6 @@ namespace Emby.Dlna.PlayTo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SetAudioStreamIndex(int? newIndex)
|
private async Task SetAudioStreamIndex(int? newIndex)
|
||||||
{
|
{
|
||||||
var media = _device.CurrentMediaInfo;
|
var media = _device.CurrentMediaInfo;
|
||||||
|
@ -1037,7 +1037,7 @@ namespace Emby.Server.Implementations.Session
|
|||||||
|
|
||||||
var generalCommand = new GeneralCommand
|
var generalCommand = new GeneralCommand
|
||||||
{
|
{
|
||||||
Name = GeneralCommandType.DisplayMessage.ToString()
|
Name = GeneralCommandType.DisplayMessage
|
||||||
};
|
};
|
||||||
|
|
||||||
generalCommand.Arguments["Header"] = command.Header;
|
generalCommand.Arguments["Header"] = command.Header;
|
||||||
@ -1268,7 +1268,7 @@ namespace Emby.Server.Implementations.Session
|
|||||||
{
|
{
|
||||||
var generalCommand = new GeneralCommand
|
var generalCommand = new GeneralCommand
|
||||||
{
|
{
|
||||||
Name = GeneralCommandType.DisplayContent.ToString(),
|
Name = GeneralCommandType.DisplayContent,
|
||||||
Arguments =
|
Arguments =
|
||||||
{
|
{
|
||||||
["ItemId"] = command.ItemId,
|
["ItemId"] = command.ItemId,
|
||||||
|
@ -222,18 +222,12 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult SendSystemCommand(
|
public ActionResult SendSystemCommand(
|
||||||
[FromRoute, Required] string sessionId,
|
[FromRoute, Required] string sessionId,
|
||||||
[FromRoute, Required] string command)
|
[FromRoute, Required] GeneralCommandType command)
|
||||||
{
|
{
|
||||||
var name = command;
|
|
||||||
if (Enum.TryParse(name, true, out GeneralCommandType commandType))
|
|
||||||
{
|
|
||||||
name = commandType.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
||||||
var generalCommand = new GeneralCommand
|
var generalCommand = new GeneralCommand
|
||||||
{
|
{
|
||||||
Name = name,
|
Name = command,
|
||||||
ControllingUserId = currentSession.UserId
|
ControllingUserId = currentSession.UserId
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -254,7 +248,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult SendGeneralCommand(
|
public ActionResult SendGeneralCommand(
|
||||||
[FromRoute, Required] string sessionId,
|
[FromRoute, Required] string sessionId,
|
||||||
[FromRoute, Required] string command)
|
[FromRoute, Required] GeneralCommandType command)
|
||||||
{
|
{
|
||||||
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace MediaBrowser.Model.Session
|
|||||||
{
|
{
|
||||||
public class GeneralCommand
|
public class GeneralCommand
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public GeneralCommandType Name { get; set; }
|
||||||
|
|
||||||
public Guid ControllingUserId { get; set; }
|
public Guid ControllingUserId { get; set; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user