Ejemplo n.º 1
0
        public void CheckNewTorrents()
        {
            LoadProviders();
            LoadNotifiers();
            HashSet <string> lastTorrents     = ReadLastTorrents();
            HashSet <string> providedTorrents = ReadTorrentsFromProviders();
            HashSet <string> newTorrents      = new HashSet <string>();

            foreach (string torrent in providedTorrents)
            {
                if (!lastTorrents.Contains(torrent))
                {
                    newTorrents.Add(torrent);
                }
            }

            // Notify
            NotificationResult result = new NotificationResult();

            result.providedTorrents = providedTorrents;
            result.newTorrents      = newTorrents;
            foreach (INotifier notifier in notifiers)
            {
                try
                {
                    notifier.NotifyCheckOk(result);
                }catch (Exception ex)
                {
                    Console.WriteLine("Error notifying: " + ex.Message);
                }
            }
        }
Ejemplo n.º 2
0
        public void NotifyCheckOk(NotificationResult result)
        {
            MailMessage mail = new MailMessage(from, to);

            mail.Subject                 = "Web Tracker";
            mail.Body                    = "[" + result.newTorrents.Count + "] new torrents found";
            client.EnableSsl             = true;
            client.DeliveryMethod        = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Credentials           = credentials;
            client.Send(mail);
        }
Ejemplo n.º 3
0
 public void NotifyCheckOk(NotificationResult result)
 {
     WriteTorrentsToFile(providedFile, result.providedTorrents);
     WriteTorrentsToFile(newsFile, result.newTorrents);
 }