Exemple #1
0
        public void Check(Feed feed)
        {
            if (feed == null) throw new ArgumentNullException("feed");

            var filters = _rssRepository.GetFiltersByFeedId(feed.Id).ToList();
            if (!filters.Any()) return;

            var syndicationFeed = _syndicationFeedService.GetFeed(feed.Url);
            var items = syndicationFeed.Items.Where(item => item.PublishDate.ToUniversalTime() > feed.LastUpdatedTime).ToList();

            foreach (var filter in filters)
            {
                var f = filter;

                foreach (var item in items.Where(item => _filterMatcher.IsMatch(item.Title.Text, f)))
                {
                    _logger.Debug("Downloading torrent from {Url}.", item.Links.First().Uri);
                    Download(filter, item);
                }
            }

            _rssRepository.UpdateFeedLastUpdatedTime(feed.Id, DateTime.UtcNow);
        }
Exemple #2
0
 public void UpdateFeed(Feed feed)
 {
     _rssRepository.UpdateFeed(feed);
 }
Exemple #3
0
 public void UpdateFeed(Feed feed)
 {
     var query = @"update Rss_Feed set Name = @Name, Url = @Url, PollInterval = @PollInterval where Id = @Id";
     _connection.Execute(query, feed);
 }
Exemple #4
0
 public Feed CreateFeed(Feed feed)
 {
     _rssRepository.CreateFeed(feed);
     return feed;
 }
Exemple #5
0
 public void CreateFeed(Feed feed)
 {
     var query = @"insert into Rss_Feed (Name, Url, PollInterval, LastUpdatedTime) values(@Name, @Url, @PollInterval, @LastUpdatedTime); select last_insert_rowid();";
     feed.Id = _connection.Query<int>(query, feed).First();
 }