Commits

ubershmekel  committed c889bd9

Avoid acadiana from southern Louisiana. They don't use metric in them parts.

  • Participants
  • Parent commits 1d65484

Comments (0)

Files changed (2)

File metricbot.py

 globthrot = Throttle()
 
 class MetricBot(RedditBot):
+    avoid_subreddits = ['acadiana']
+    
     def handle_comment(self, comm):
         self.log('body: %s' % comm.body)
         response = metric_response(comm.body)

File redditbot.py

 
 
 class RedditBot:
+    avoid_subreddits = []
+
     def __init__(self, user, pw):
         self.user = user
         self.pw = pw
         self.db = shelve.open(self.user + '.py.db')
+        
+        self.avoid_subreddits = [i.lower() for i in self.avoid_subreddits]
     
     def log(self, text):
         # print text # caused unicode bugs
         times = [obj.created_utc for obj in obj_list]
         span = max(times) - min(times)
         rate = len(times) / span
-        log_line = 'handled %d %s, replied to %d. Reddit rate = %s per second' % (len(times), type_name, responded, rate)
+        log_line = 'scanned %d %s, replied to %d. Reddit rate = %s per second' % (len(times), type_name, responded, rate)
         self.log(log_line)
         print log_line
     
             if self.handled_in_past(self.comment_place_holder):
                 continue
             
+            if comm.subreddit.title.lower() in self.avoid_subreddits:
+                continue
+
             # handle
             comments.append(comm)
             res = False
             if self.handled_in_past(self.link_place_holder):
                 continue
             
+            if link.subreddit.title.lower() in self.avoid_subreddits:
+                continue
+            
             # handle
             links.append(link)
             res = False