mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 14:08:44 -04:00
Use GeneralCommandType enum in GeneralCommand name
This commit is contained in:
parent
7da03d67a7
commit
3459655bb4
5 changed files with 53 additions and 53 deletions
|
@ -135,6 +135,7 @@
|
|||
- [YouKnowBlom](https://github.com/YouKnowBlom)
|
||||
- [KristupasSavickas](https://github.com/KristupasSavickas)
|
||||
- [Pusta](https://github.com/pusta)
|
||||
- [nielsvanvelzen](https://github.com/nielsvanvelzen)
|
||||
|
||||
# Emby Contributors
|
||||
|
||||
|
|
|
@ -669,9 +669,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
private Task SendGeneralCommand(GeneralCommand command, CancellationToken cancellationToken)
|
||||
{
|
||||
if (Enum.TryParse(command.Name, true, out GeneralCommandType commandType))
|
||||
{
|
||||
switch (commandType)
|
||||
switch (command.Name)
|
||||
{
|
||||
case GeneralCommandType.VolumeDown:
|
||||
return _device.VolumeDown(cancellationToken);
|
||||
|
@ -724,9 +722,6 @@ namespace Emby.Dlna.PlayTo
|
|||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task SetAudioStreamIndex(int? newIndex)
|
||||
{
|
||||
var media = _device.CurrentMediaInfo;
|
||||
|
|
|
@ -1037,7 +1037,7 @@ namespace Emby.Server.Implementations.Session
|
|||
|
||||
var generalCommand = new GeneralCommand
|
||||
{
|
||||
Name = GeneralCommandType.DisplayMessage.ToString()
|
||||
Name = GeneralCommandType.DisplayMessage
|
||||
};
|
||||
|
||||
generalCommand.Arguments["Header"] = command.Header;
|
||||
|
@ -1268,7 +1268,7 @@ namespace Emby.Server.Implementations.Session
|
|||
{
|
||||
var generalCommand = new GeneralCommand
|
||||
{
|
||||
Name = GeneralCommandType.DisplayContent.ToString(),
|
||||
Name = GeneralCommandType.DisplayContent,
|
||||
Arguments =
|
||||
{
|
||||
["ItemId"] = command.ItemId,
|
||||
|
|
|
@ -217,16 +217,15 @@ namespace Jellyfin.Api.Controllers
|
|||
[FromRoute, Required] string sessionId,
|
||||
[FromRoute, Required] string command)
|
||||
{
|
||||
var name = command;
|
||||
if (Enum.TryParse(name, true, out GeneralCommandType commandType))
|
||||
if (!Enum.TryParse(command, true, out GeneralCommandType commandType))
|
||||
{
|
||||
name = commandType.ToString();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
||||
var generalCommand = new GeneralCommand
|
||||
{
|
||||
Name = name,
|
||||
Name = commandType,
|
||||
ControllingUserId = currentSession.UserId
|
||||
};
|
||||
|
||||
|
@ -249,11 +248,16 @@ namespace Jellyfin.Api.Controllers
|
|||
[FromRoute, Required] string sessionId,
|
||||
[FromRoute, Required] string command)
|
||||
{
|
||||
if (!Enum.TryParse(command, true, out GeneralCommandType commandType))
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
||||
|
||||
var generalCommand = new GeneralCommand
|
||||
{
|
||||
Name = command,
|
||||
Name = commandType,
|
||||
ControllingUserId = currentSession.UserId
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace MediaBrowser.Model.Session
|
|||
{
|
||||
public class GeneralCommand
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public GeneralCommandType Name { get; set; }
|
||||
|
||||
public Guid ControllingUserId { get; set; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue