feat: convert supportedCommands strings to enums

This commit is contained in:
github@esslinger.dev 2020-10-01 18:43:44 +02:00
parent c7b3d4a90c
commit dd4f3a7c51
4 changed files with 16 additions and 16 deletions

View File

@ -217,15 +217,15 @@ namespace Emby.Dlna.PlayTo
SupportedCommands = new[] SupportedCommands = new[]
{ {
GeneralCommandType.VolumeDown.ToString(), GeneralCommandType.VolumeDown,
GeneralCommandType.VolumeUp.ToString(), GeneralCommandType.VolumeUp,
GeneralCommandType.Mute.ToString(), GeneralCommandType.Mute,
GeneralCommandType.Unmute.ToString(), GeneralCommandType.Unmute,
GeneralCommandType.ToggleMute.ToString(), GeneralCommandType.ToggleMute,
GeneralCommandType.SetVolume.ToString(), GeneralCommandType.SetVolume,
GeneralCommandType.SetAudioStreamIndex.ToString(), GeneralCommandType.SetAudioStreamIndex,
GeneralCommandType.SetSubtitleStreamIndex.ToString(), GeneralCommandType.SetSubtitleStreamIndex,
GeneralCommandType.PlayMediaSource.ToString() GeneralCommandType.PlayMediaSource
}, },
SupportsMediaControl = true SupportsMediaControl = true

View File

@ -366,7 +366,7 @@ namespace Jellyfin.Api.Controllers
/// </summary> /// </summary>
/// <param name="id">The session id.</param> /// <param name="id">The session id.</param>
/// <param name="playableMediaTypes">A list of playable media types, comma delimited. Audio, Video, Book, Photo.</param> /// <param name="playableMediaTypes">A list of playable media types, comma delimited. Audio, Video, Book, Photo.</param>
/// <param name="supportedCommands">A list of supported remote control commands, comma delimited.</param> /// <param name="supportedCommands">A list of supported remote control commands.</param>
/// <param name="supportsMediaControl">Determines whether media can be played remotely..</param> /// <param name="supportsMediaControl">Determines whether media can be played remotely..</param>
/// <param name="supportsSync">Determines whether sync is supported.</param> /// <param name="supportsSync">Determines whether sync is supported.</param>
/// <param name="supportsPersistentIdentifier">Determines whether the device supports a unique identifier.</param> /// <param name="supportsPersistentIdentifier">Determines whether the device supports a unique identifier.</param>
@ -378,7 +378,7 @@ namespace Jellyfin.Api.Controllers
public ActionResult PostCapabilities( public ActionResult PostCapabilities(
[FromQuery] string? id, [FromQuery] string? id,
[FromQuery] string? playableMediaTypes, [FromQuery] string? playableMediaTypes,
[FromQuery] string? supportedCommands, [FromQuery] GeneralCommandType[] supportedCommands,
[FromQuery] bool supportsMediaControl = false, [FromQuery] bool supportsMediaControl = false,
[FromQuery] bool supportsSync = false, [FromQuery] bool supportsSync = false,
[FromQuery] bool supportsPersistentIdentifier = true) [FromQuery] bool supportsPersistentIdentifier = true)
@ -391,7 +391,7 @@ namespace Jellyfin.Api.Controllers
_sessionManager.ReportCapabilities(id, new ClientCapabilities _sessionManager.ReportCapabilities(id, new ClientCapabilities
{ {
PlayableMediaTypes = RequestHelpers.Split(playableMediaTypes, ',', true), PlayableMediaTypes = RequestHelpers.Split(playableMediaTypes, ',', true),
SupportedCommands = RequestHelpers.Split(supportedCommands, ',', true), SupportedCommands = supportedCommands == null ? Array.Empty<GeneralCommandType>() : supportedCommands,
SupportsMediaControl = supportsMediaControl, SupportsMediaControl = supportsMediaControl,
SupportsSync = supportsSync, SupportsSync = supportsSync,
SupportsPersistentIdentifier = supportsPersistentIdentifier SupportsPersistentIdentifier = supportsPersistentIdentifier

View File

@ -230,8 +230,8 @@ namespace MediaBrowser.Controller.Session
/// Gets or sets the supported commands. /// Gets or sets the supported commands.
/// </summary> /// </summary>
/// <value>The supported commands.</value> /// <value>The supported commands.</value>
public string[] SupportedCommands public GeneralCommandType[] SupportedCommands
=> Capabilities == null ? Array.Empty<string>() : Capabilities.SupportedCommands; => Capabilities == null ? Array.Empty<GeneralCommandType>() : Capabilities.SupportedCommands;
public Tuple<ISessionController, bool> EnsureController<T>(Func<SessionInfo, ISessionController> factory) public Tuple<ISessionController, bool> EnsureController<T>(Func<SessionInfo, ISessionController> factory)
{ {

View File

@ -10,7 +10,7 @@ namespace MediaBrowser.Model.Session
{ {
public string[] PlayableMediaTypes { get; set; } public string[] PlayableMediaTypes { get; set; }
public string[] SupportedCommands { get; set; } public GeneralCommandType[] SupportedCommands { get; set; }
public bool SupportsMediaControl { get; set; } public bool SupportsMediaControl { get; set; }
@ -31,7 +31,7 @@ namespace MediaBrowser.Model.Session
public ClientCapabilities() public ClientCapabilities()
{ {
PlayableMediaTypes = Array.Empty<string>(); PlayableMediaTypes = Array.Empty<string>();
SupportedCommands = Array.Empty<string>(); SupportedCommands = Array.Empty<GeneralCommandType>();
SupportsPersistentIdentifier = true; SupportsPersistentIdentifier = true;
} }
} }