예제 #1
0
        public async Task <RequestEngineResult> RequestTv([FromBody] TvRequestViewModelV2 tv)
        {
            tv.RequestedByAlias = GetApiAlias();
            var result = await _tvRequestEngine.RequestTvShow(tv);

            if (result.Result)
            {
                var voteResult = await _voteEngine.UpVote(result.RequestId, RequestType.TvShow);

                if (voteResult.IsError)
                {
                    _logger.LogError("Couldn't automatically add the vote for the tv {0} because {1}", tv.TheMovieDbId, voteResult.ErrorMessage);
                }
            }

            return(result);
        }
예제 #2
0
        private async Task ProcessShow(int theMovieDbId, OmbiUser user)
        {
            _tvRequestEngine.SetUser(user);
            var response = await _tvRequestEngine.RequestTvShow(new TvRequestViewModelV2 { LatestSeason = true, TheMovieDbId = theMovieDbId, Source = RequestSource.PlexWatchlist });

            if (response.IsError)
            {
                if (response.ErrorCode == ErrorCode.AlreadyRequested)
                {
                    _logger.LogDebug($"Show already requested for user '{user.UserName}'");
                    await AddToHistory(theMovieDbId);

                    return;
                }
                _logger.LogInformation($"Error adding title from PlexWatchlist for user '{user.UserName}'. Message: '{response.ErrorMessage}'");
            }
            else
            {
                await AddToHistory(theMovieDbId);

                _logger.LogInformation($"Added title from PlexWatchlist for user '{user.UserName}'. {response.Message}");
            }
        }