Ejemplo n.º 1
0
        private async Task SendMovieCollectionRemoves(
            TraktUser traktUser,
            List <TraktMovieCollected> movies,
            ISplittableProgress <double> progress,
            CancellationToken cancellationToken)
        {
            _logger.Info("Movies to remove from collection: " + movies.Count);
            if (movies.Count > 0)
            {
                try
                {
                    var dataContracts =
                        await
                        _traktApi.SendCollectionRemovalsAsync(
                            movies.Select(m => m.movie).ToList(),
                            traktUser,
                            cancellationToken).ConfigureAwait(false);

                    if (dataContracts != null)
                    {
                        foreach (var traktSyncResponse in dataContracts)
                        {
                            LogTraktResponseDataContract(traktSyncResponse);
                        }
                    }
                }
                catch (ArgumentNullException argNullEx)
                {
                    _logger.ErrorException("ArgumentNullException handled sending movies to trakt.tv", argNullEx);
                }
                catch (Exception e)
                {
                    _logger.ErrorException("Exception handled sending movies to trakt.tv", e);
                }

                progress.Report(100);
            }
        }