diff --git a/README.md b/README.md index 71ec3cb..1a56074 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Python modules: `requests, twisted` `watch_dir` - The directory to save torrents to. `cookies_txt` - The path to where your session cookie(s) are stored. Should be in Netscape format. `tags` - Comma-delineated list of tags to look for in each announce message. The script is just performing simple string comparisons on the entire message, so the 'tag' can be any substring appearing in the announce message. Note that this is essentially an OR operation. I'm too lazy to get more complex than that. +`blacklist` - Comma-delineated list of blacklisted tags. Same as `tags`, except if any of these are found in the announce message the bot skips the entire message. This parameter is optional. ### Example config.cfg ``` @@ -31,7 +32,8 @@ tracker_bot = Udon auth_msg = BOT #oppaitime-announce iou1name SpaghettiIsAFaggot watch_dir = /home/iou1name/torrent/oppaitime/Watch/ cookies_txt = cookies.txt -tags = English,Dual Language +tags = English,Dual Language,subs +blacklist = Loose [redacted] server = irc.scratch-network.net diff --git a/oppaiBot.py b/oppaiBot.py index a4c8f3c..1000a2a 100755 --- a/oppaiBot.py +++ b/oppaiBot.py @@ -28,7 +28,7 @@ class OppaiBot(irc.IRCClient): self.watch_dir = self.config["watch_dir"] self.tags = self.config["tags"].split(",") - + self.blacklist = self.config.get("blacklist").split(",") def save_torrent(self, url, directory): """ @@ -51,6 +51,10 @@ class OppaiBot(irc.IRCClient): or users alike. """ # More advanced logic is left as an exercise to the reader. + black_in_msg = [tag in message for tag in self.blacklist] + if any(black_in_msg): + return + tags_in_msg = [tag in message for tag in self.tags] if any(tags_in_msg): url = re.findall(r"(http.+?) ", message)[1]