Exemple #1
0
        /// <summary>
        /// Notifies the media processor that files are ready to process
        /// which are not being tracked by the torrent service.
        /// </summary>
        public async Task CompleteUntrackedDownloads()
        {
            IEnumerable <DirectoryInfo> files = Directory.GetFiles(_downloadTorrentPath).Select(x => new DirectoryInfo(x));

            IEnumerable <string> torrentNames = (await _torrentClient.GetTorrentsAsync()).Select(x => x.Name.ToLower());
            var untracked = files.Where(x => !torrentNames.Contains(x.Name.ToLower()));

            TryNotifyToProcessFiles(untracked.Select(x => x.Name));
        }
Exemple #2
0
        public async Task <List <TorrentInfo> > GetTorrentsAsync(CancellationToken cancellationToken)
        {
            try
            {
                var result = await client.GetTorrentsAsync(cancellationToken).ConfigureAwait(false);

                UpdateStatus(true);

                return(result);
            }
            catch (Exception ex) when(!(ex is TaskCanceledException))
            {
                UpdateStatus(false);
                throw;
            }
        }