Beispiel #1
0
        public async Task RelocateTorrentsAsync(RelocateTorrentsRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            foreach (var relocateTorrentCommand in request.RelocateTorrentCommands)
            {
                _logger.LogDebug("Relocating torrent with ID {0} to '{1}'", relocateTorrentCommand.TorrentID, relocateTorrentCommand.NewLocation);
                await _torrentClient.RelocateTorrentAsync(relocateTorrentCommand.TorrentID, relocateTorrentCommand.NewLocation).ConfigureAwait(false);

                _logger.LogDebug("Torrent {0} is relocated", relocateTorrentCommand.TorrentID);
            }

            if (request.VerifyAfterMoving)
            {
                await _torrentClient.VerifyTorrentsAsync(request.RelocateTorrentCommands.Select(c => c.TorrentID).ToArray());
            }
        }