public void Execute(IEvent @event) { var connectionId = @event.ConnectionId; var clientProtocol = _auth.ClientProtocolVersion(connectionId); SendTrackInfo(clientProtocol, connectionId); SendTrackRating(connectionId); SendLfmRating(connectionId); var statusMessage = new SocketMessage(Constants.PlayerStatus, _apiAdapter.GetStatus()); _hub.Publish(new PluginResponseAvailableEvent(statusMessage, connectionId)); if (clientProtocol >= Constants.V3) { var coverPayload = CoverPayloadGenerator.Create(_model.Cover, true); var lyricsPayload = new LyricsPayload(_model.Lyrics); var coverMessage = new SocketMessage(Constants.NowPlayingCover, coverPayload); var lyricsMessage = new SocketMessage(Constants.NowPlayingLyrics, lyricsPayload); _hub.Publish(new PluginResponseAvailableEvent(coverMessage, connectionId)); _hub.Publish(new PluginResponseAvailableEvent(lyricsMessage, connectionId)); } else { var coverMessage = new SocketMessage(Constants.NowPlayingCover, _model.Cover); var lyricsMessage = new SocketMessage(Constants.NowPlayingLyrics, _model.Lyrics); _hub.Publish(new PluginResponseAvailableEvent(coverMessage, connectionId)); _hub.Publish(new PluginResponseAvailableEvent(lyricsMessage, connectionId)); } }
public void Execute(IEvent receivedEvent) { if (receivedEvent == null) { throw new ArgumentNullException(nameof(receivedEvent)); } var statusMessage = new SocketMessage(Constants.PlayerStatus, _apiAdapter.GetStatus()); _hub.Publish(new PluginResponseAvailableEvent(statusMessage, receivedEvent.ConnectionId)); }
public void Execute(IEvent @event) { var statusMessage = new SocketMessage(Constants.PlayerStatus, _apiAdapter.GetStatus()); _hub.Publish(new PluginResponseAvailableEvent(statusMessage, @event.ConnectionId)); }