コード例 #1
0
ファイル: SyncPlayService.cs プロジェクト: gut5/jellyfin
        /// <summary>
        /// Handles the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public void Post(SyncPlayJoin request)
        {
            var currentSession = GetSession(_sessionContext);

            Guid groupId;
            Guid playingItemId = Guid.Empty;

            if (!Guid.TryParse(request.GroupId, out groupId))
            {
                Logger.LogError("JoinGroup: {0} is not a valid format for GroupId. Ignoring request.", request.GroupId);
                return;
            }

            // Both null and empty strings mean that client isn't playing anything
            if (!string.IsNullOrEmpty(request.PlayingItemId) && !Guid.TryParse(request.PlayingItemId, out playingItemId))
            {
                Logger.LogError("JoinGroup: {0} is not a valid format for PlayingItemId. Ignoring request.", request.PlayingItemId);
                return;
            }

            var joinRequest = new JoinGroupRequest()
            {
                GroupId       = groupId,
                PlayingItemId = playingItemId
            };

            _syncPlayManager.JoinGroup(currentSession, groupId, joinRequest, CancellationToken.None);
        }
コード例 #2
0
        public ActionResult SyncPlayJoinGroup(
            [FromBody, Required] JoinGroupRequestDto requestData)
        {
            var currentSession  = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
            var syncPlayRequest = new JoinGroupRequest(requestData.GroupId);

            _syncPlayManager.JoinGroup(currentSession, syncPlayRequest, CancellationToken.None);
            return(NoContent());
        }
コード例 #3
0
        public ActionResult SyncPlayJoinGroup([FromQuery, Required] Guid groupId)
        {
            var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);

            var joinRequest = new JoinGroupRequest()
            {
                GroupId = groupId
            };

            _syncPlayManager.JoinGroup(currentSession, groupId, joinRequest, CancellationToken.None);
            return(NoContent());
        }
コード例 #4
0
        /// <summary>
        /// Handles the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public void Post(SyncPlayJoin request)
        {
            var currentSession = GetSession(_sessionContext);

            Guid groupId;

            if (!Guid.TryParse(request.GroupId, out groupId))
            {
                Logger.LogError("JoinGroup: {0} is not a valid format for GroupId. Ignoring request.", request.GroupId);
                return;
            }

            var joinRequest = new JoinGroupRequest()
            {
                GroupId = groupId
            };

            _syncPlayManager.JoinGroup(currentSession, groupId, joinRequest, CancellationToken.None);
        }