Exemple #1
0
        public async Task AddTorrentAsync(MovieMagnet magnet)
        {
            _logger?.LogInformation("Add Torrent for movie {movieNumber}: {hash}", magnet.MovieNumber, magnet.Hash);
            await EnsureLoggedInAsync();

            AddTorrentUrlsRequest request = new AddTorrentUrlsRequest(new Uri(magnet.MagnetUrl));
            await _client.AddTorrentsAsync(request);

            string savePath = Path.Combine(_qbittorrentSetting.DownloadRootPath, magnet.MovieNumber.ToUpper() + "_" + magnet.IdMovieMag);
            await _client.SetLocationAsync(magnet.Hash, savePath);

            await _client.SetTorrentCategoryAsync(magnet.Hash, _qbittorrentSetting.Category);

            magnet.IdStatus = MagnetStatus.Downloading;
            magnet.SavePath = savePath;
            magnet.DtStart  = DateTime.Now;
            _logger?.LogInformation("Add Torrent for movie {movieNumber} ended", magnet.MovieNumber);
        }
            protected override async Task <int> OnExecuteTorrentSpecificAsync(QBittorrentClient client, CommandLineApplication app, IConsole console)
            {
                await client.SetTorrentCategoryAsync(Hash, CategoryName);

                return(ExitCodes.Success);
            }