From 72534f9d667f2457cbe96ea870d140528e366ba2 Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Fri, 25 Sep 2020 09:25:59 +0200 Subject: Use SessionMessageType for WebSocket messages --- MediaBrowser.Model/Session/SessionMessageType.cs | 50 ++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 MediaBrowser.Model/Session/SessionMessageType.cs (limited to 'MediaBrowser.Model/Session') diff --git a/MediaBrowser.Model/Session/SessionMessageType.cs b/MediaBrowser.Model/Session/SessionMessageType.cs new file mode 100644 index 000000000..23c41026d --- /dev/null +++ b/MediaBrowser.Model/Session/SessionMessageType.cs @@ -0,0 +1,50 @@ +#pragma warning disable CS1591 + +namespace MediaBrowser.Model.Session +{ + /// + /// The different kinds of messages that are used in the WebSocket api. + /// + public enum SessionMessageType + { + // Server -> Client + ForceKeepAlive, + GeneralCommand, + UserDataChanged, + Sessions, + Play, + SyncPlayCommand, + SyncPlayGroupUpdate, + PlayState, + RestartRequired, + ServerShuttingDown, + ServerRestarting, + LibraryChanged, + UserDeleted, + UserUpdated, + SeriesTimerCreated, + TimerCreated, + SeriesTimerCancelled, + TimerCancelled, + RefreshProgress, + ScheduledTaskEnded, + PackageInstallationCancelled, + PackageInstallationFailed, + PackageInstallationCompleted, + PackageInstalling, + PackageUninstalled, + ActivityLogEntry, + ScheduledTasksInfo, + + // Client -> Server + ActivityLogEntryStart, + ActivityLogEntryStop, + SessionsStart, + SessionsStop, + ScheduledTasksInfoStart, + ScheduledTasksInfoStop, + + // Shared + KeepAlive, + } +} -- cgit v1.2.3 From dd4f3a7c5184afbada50a038564c95fa780e04f8 Mon Sep 17 00:00:00 2001 From: "github@esslinger.dev" Date: Thu, 1 Oct 2020 18:43:44 +0200 Subject: feat: convert supportedCommands strings to enums --- Emby.Dlna/PlayTo/PlayToManager.cs | 18 +++++++++--------- Jellyfin.Api/Controllers/SessionController.cs | 6 +++--- MediaBrowser.Controller/Session/SessionInfo.cs | 4 ++-- MediaBrowser.Model/Session/ClientCapabilities.cs | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'MediaBrowser.Model/Session') diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs index 21877f121..e93aef304 100644 --- a/Emby.Dlna/PlayTo/PlayToManager.cs +++ b/Emby.Dlna/PlayTo/PlayToManager.cs @@ -217,15 +217,15 @@ namespace Emby.Dlna.PlayTo SupportedCommands = new[] { - GeneralCommandType.VolumeDown.ToString(), - GeneralCommandType.VolumeUp.ToString(), - GeneralCommandType.Mute.ToString(), - GeneralCommandType.Unmute.ToString(), - GeneralCommandType.ToggleMute.ToString(), - GeneralCommandType.SetVolume.ToString(), - GeneralCommandType.SetAudioStreamIndex.ToString(), - GeneralCommandType.SetSubtitleStreamIndex.ToString(), - GeneralCommandType.PlayMediaSource.ToString() + GeneralCommandType.VolumeDown, + GeneralCommandType.VolumeUp, + GeneralCommandType.Mute, + GeneralCommandType.Unmute, + GeneralCommandType.ToggleMute, + GeneralCommandType.SetVolume, + GeneralCommandType.SetAudioStreamIndex, + GeneralCommandType.SetSubtitleStreamIndex, + GeneralCommandType.PlayMediaSource }, SupportsMediaControl = true diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index 39bf6e6dc..2ed7019e5 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -366,7 +366,7 @@ namespace Jellyfin.Api.Controllers /// /// The session id. /// A list of playable media types, comma delimited. Audio, Video, Book, Photo. - /// A list of supported remote control commands, comma delimited. + /// A list of supported remote control commands. /// Determines whether media can be played remotely.. /// Determines whether sync is supported. /// Determines whether the device supports a unique identifier. @@ -378,7 +378,7 @@ namespace Jellyfin.Api.Controllers public ActionResult PostCapabilities( [FromQuery] string? id, [FromQuery] string? playableMediaTypes, - [FromQuery] string? supportedCommands, + [FromQuery] GeneralCommandType[] supportedCommands, [FromQuery] bool supportsMediaControl = false, [FromQuery] bool supportsSync = false, [FromQuery] bool supportsPersistentIdentifier = true) @@ -391,7 +391,7 @@ namespace Jellyfin.Api.Controllers _sessionManager.ReportCapabilities(id, new ClientCapabilities { PlayableMediaTypes = RequestHelpers.Split(playableMediaTypes, ',', true), - SupportedCommands = RequestHelpers.Split(supportedCommands, ',', true), + SupportedCommands = supportedCommands == null ? Array.Empty() : supportedCommands, SupportsMediaControl = supportsMediaControl, SupportsSync = supportsSync, SupportsPersistentIdentifier = supportsPersistentIdentifier diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 55e44c19d..ce58a60b9 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -230,8 +230,8 @@ namespace MediaBrowser.Controller.Session /// Gets or sets the supported commands. /// /// The supported commands. - public string[] SupportedCommands - => Capabilities == null ? Array.Empty() : Capabilities.SupportedCommands; + public GeneralCommandType[] SupportedCommands + => Capabilities == null ? Array.Empty() : Capabilities.SupportedCommands; public Tuple EnsureController(Func factory) { diff --git a/MediaBrowser.Model/Session/ClientCapabilities.cs b/MediaBrowser.Model/Session/ClientCapabilities.cs index d3878ca30..a85e6ff2a 100644 --- a/MediaBrowser.Model/Session/ClientCapabilities.cs +++ b/MediaBrowser.Model/Session/ClientCapabilities.cs @@ -10,7 +10,7 @@ namespace MediaBrowser.Model.Session { public string[] PlayableMediaTypes { get; set; } - public string[] SupportedCommands { get; set; } + public GeneralCommandType[] SupportedCommands { get; set; } public bool SupportsMediaControl { get; set; } @@ -31,7 +31,7 @@ namespace MediaBrowser.Model.Session public ClientCapabilities() { PlayableMediaTypes = Array.Empty(); - SupportedCommands = Array.Empty(); + SupportedCommands = Array.Empty(); SupportsPersistentIdentifier = true; } } -- cgit v1.2.3 From 508b7c0a4e24d52fa8c10a29f6fb5c1cf77a65d2 Mon Sep 17 00:00:00 2001 From: crobibero Date: Wed, 7 Oct 2020 17:16:03 -0600 Subject: Add missing general commands --- MediaBrowser.Model/Session/GeneralCommandType.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Model/Session') diff --git a/MediaBrowser.Model/Session/GeneralCommandType.cs b/MediaBrowser.Model/Session/GeneralCommandType.cs index 5a9042d5f..dce33210b 100644 --- a/MediaBrowser.Model/Session/GeneralCommandType.cs +++ b/MediaBrowser.Model/Session/GeneralCommandType.cs @@ -43,6 +43,9 @@ namespace MediaBrowser.Model.Session Guide = 32, ToggleStats = 33, PlayMediaSource = 34, - PlayTrailers = 35 + PlayTrailers = 35, + SetShuffleQueue = 36, + Playstate = 37, + PlayNext = 38 } } -- cgit v1.2.3 From e9f17f3cab621929eacb6680a48246a4033d727d Mon Sep 17 00:00:00 2001 From: crobibero Date: Wed, 7 Oct 2020 17:26:02 -0600 Subject: Add missing general commands for Kodi --- MediaBrowser.Model/Session/GeneralCommandType.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Model/Session') diff --git a/MediaBrowser.Model/Session/GeneralCommandType.cs b/MediaBrowser.Model/Session/GeneralCommandType.cs index dce33210b..62fa436b5 100644 --- a/MediaBrowser.Model/Session/GeneralCommandType.cs +++ b/MediaBrowser.Model/Session/GeneralCommandType.cs @@ -46,6 +46,8 @@ namespace MediaBrowser.Model.Session PlayTrailers = 35, SetShuffleQueue = 36, Playstate = 37, - PlayNext = 38 + PlayNext = 38, + ToggleOsdMenu = 39, + Play = 40 } } -- cgit v1.2.3 From fe49ae7cb558fe86f23cb11f6f564db59828509f Mon Sep 17 00:00:00 2001 From: crobibero Date: Thu, 8 Oct 2020 07:21:55 -0600 Subject: fix casing --- MediaBrowser.Model/Session/GeneralCommandType.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Model/Session') diff --git a/MediaBrowser.Model/Session/GeneralCommandType.cs b/MediaBrowser.Model/Session/GeneralCommandType.cs index 62fa436b5..c58fa9a6b 100644 --- a/MediaBrowser.Model/Session/GeneralCommandType.cs +++ b/MediaBrowser.Model/Session/GeneralCommandType.cs @@ -45,7 +45,7 @@ namespace MediaBrowser.Model.Session PlayMediaSource = 34, PlayTrailers = 35, SetShuffleQueue = 36, - Playstate = 37, + PlayState = 37, PlayNext = 38, ToggleOsdMenu = 39, Play = 40 -- cgit v1.2.3