Exemple #1
0
        protected override async Task ExecuteAsync(CancellationToken cancellationToken)
        {
            AutomaticTorrentDownloaderConfiguration configuration = new AutomaticTorrentDownloaderConfiguration();

            while (!cancellationToken.IsCancellationRequested)
            {
                configuration.Load();

                foreach (Site site in configuration.SearchedSites.Select(id => SiteProvider.GetById(id)))
                {
                    foreach (ParsedMedia searchedMedia in configuration.SearchedMedia)
                    {
                        string query         = GetSearchQuery(searchedMedia);
                        var    searchResults = _torrentFinder.GetSearchResultsFromSite(site, query);
                        var    match         = _matchCalculator.GetBestMatch(searchedMedia, searchResults);

                        if (match == null || match.Score < 0.5)
                        {
                            continue;
                        }
                    }
                }

                await Task.Delay(TimeSpan.FromMinutes(configuration.RefreshDelayMinutes), cancellationToken);
            }
        }
        public async Task <DownloadRequestResultModel> Download(string siteId, string relativeUrl)
        {
            Site site = SiteProvider.GetById(siteId) ?? throw new ArgumentException("Unknown site: " + siteId);

            TorrentDetail detail = _torrentFinder.GetTorrentDetail(site, relativeUrl);
            Torrent       t      = await _delugedConnection.Daemon.AddTorrentMagnetAsync(detail.MagnetLinks.ElementAt(0));

            return(new DownloadRequestResultModel());
        }
Exemple #3
0
 //
 // GET: /Device/Add/<SiteId>
 public ActionResult Add(int SiteId)
 {
     try
     {
         var            provider = new SiteProvider(DomainSession.GetDataContextForUserContext(this.HttpContext));
         DeviceAddModel model    = new DeviceAddModel(provider.GetById(SiteId));
         return(View(model));
     }
     catch (Exception e)
     {
         return(View());
     }
 }