Beispiel #1
0
 private Torrent GetTorrent(TorrentLink link)
 {
     using (HttpClient client = new HttpClient())
     {
         var task = client.GetByteArrayAsync(link.Url);
         task.ConfigureAwait(false);
         var     data    = task.Result;
         Torrent torrent = Torrent.Load(data);
         return(torrent);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Analyses and retrieve informations of a torrent
        /// </summary>
        /// <param name="torrent"></param>
        public void Analyze(TorrentLink link)
        {
            Torrent torrent = this.GetTorrent(link);

            foreach (TorrentFile file in torrent.Files)
            {
                var f = new File
                {
                    Filename = file.FullPath
                };

                Episode ep = Extractor.Extract(f.Filename);
                if (ep != null)
                {
                    f.Episode = ep;
                }

                link.Files.Add(f);
            }
        }