aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/WebSocketListeners
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-08-03 13:33:43 -0600
committercrobibero <cody@robibe.ro>2020-08-03 13:33:43 -0600
commit1535f363b28ab7e57354f2724f5f1900a000b5cc (patch)
treef00276764b67e48666159f6512d94e4a51140fcd /Jellyfin.Api/WebSocketListeners
parent8bb510a9f65c73c08fb692a86112e1888c8206ce (diff)
Fix some request parameters
Diffstat (limited to 'Jellyfin.Api/WebSocketListeners')
-rw-r--r--Jellyfin.Api/WebSocketListeners/SessionInfoWebSocketListener.cs60
1 files changed, 28 insertions, 32 deletions
diff --git a/Jellyfin.Api/WebSocketListeners/SessionInfoWebSocketListener.cs b/Jellyfin.Api/WebSocketListeners/SessionInfoWebSocketListener.cs
index ab9f789a1..1fb5dc412 100644
--- a/Jellyfin.Api/WebSocketListeners/SessionInfoWebSocketListener.cs
+++ b/Jellyfin.Api/WebSocketListeners/SessionInfoWebSocketListener.cs
@@ -12,20 +12,13 @@ namespace Jellyfin.Api.WebSocketListeners
/// </summary>
public class SessionInfoWebSocketListener : BasePeriodicWebSocketListener<IEnumerable<SessionInfo>, WebSocketListenerState>
{
- /// <summary>
- /// Gets the name.
- /// </summary>
- /// <value>The name.</value>
- protected override string Name => "Sessions";
-
- /// <summary>
- /// The _kernel.
- /// </summary>
private readonly ISessionManager _sessionManager;
/// <summary>
/// Initializes a new instance of the <see cref="SessionInfoWebSocketListener"/> class.
/// </summary>
+ /// <param name="logger">Instance of the <see cref="ILogger{SessionInfoWebSocketListener}"/> interface.</param>
+ /// <param name="sessionManager">Instance of the <see cref="ISessionManager"/> interface.</param>
public SessionInfoWebSocketListener(ILogger<SessionInfoWebSocketListener> logger, ISessionManager sessionManager)
: base(logger)
{
@@ -40,6 +33,32 @@ namespace Jellyfin.Api.WebSocketListeners
_sessionManager.SessionActivity += OnSessionManagerSessionActivity;
}
+ /// <inheritdoc />
+ protected override string Name => "Sessions";
+
+ /// <summary>
+ /// Gets the data to send.
+ /// </summary>
+ /// <returns>Task{SystemInfo}.</returns>
+ protected override Task<IEnumerable<SessionInfo>> GetDataToSend()
+ {
+ return Task.FromResult(_sessionManager.Sessions);
+ }
+
+ /// <inheritdoc />
+ protected override void Dispose(bool dispose)
+ {
+ _sessionManager.SessionStarted -= OnSessionManagerSessionStarted;
+ _sessionManager.SessionEnded -= OnSessionManagerSessionEnded;
+ _sessionManager.PlaybackStart -= OnSessionManagerPlaybackStart;
+ _sessionManager.PlaybackStopped -= OnSessionManagerPlaybackStopped;
+ _sessionManager.PlaybackProgress -= OnSessionManagerPlaybackProgress;
+ _sessionManager.CapabilitiesChanged -= OnSessionManagerCapabilitiesChanged;
+ _sessionManager.SessionActivity -= OnSessionManagerSessionActivity;
+
+ base.Dispose(dispose);
+ }
+
private async void OnSessionManagerSessionActivity(object sender, SessionEventArgs e)
{
await SendData(false).ConfigureAwait(false);
@@ -74,28 +93,5 @@ namespace Jellyfin.Api.WebSocketListeners
{
await SendData(true).ConfigureAwait(false);
}
-
- /// <summary>
- /// Gets the data to send.
- /// </summary>
- /// <returns>Task{SystemInfo}.</returns>
- protected override Task<IEnumerable<SessionInfo>> GetDataToSend()
- {
- return Task.FromResult(_sessionManager.Sessions);
- }
-
- /// <inheritdoc />
- protected override void Dispose(bool dispose)
- {
- _sessionManager.SessionStarted -= OnSessionManagerSessionStarted;
- _sessionManager.SessionEnded -= OnSessionManagerSessionEnded;
- _sessionManager.PlaybackStart -= OnSessionManagerPlaybackStart;
- _sessionManager.PlaybackStopped -= OnSessionManagerPlaybackStopped;
- _sessionManager.PlaybackProgress -= OnSessionManagerPlaybackProgress;
- _sessionManager.CapabilitiesChanged -= OnSessionManagerCapabilitiesChanged;
- _sessionManager.SessionActivity -= OnSessionManagerSessionActivity;
-
- base.Dispose(dispose);
- }
}
}