From 3fd1e9db7b37378fecb7de00f77e3d38c4ef7478 Mon Sep 17 00:00:00 2001 From: iou1name Date: Wed, 9 May 2018 18:25:07 -0400 Subject: [PATCH] configurable tags --- README.md | 2 ++ oppaiBot.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eef6734..29881db 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Python modules: `requests, twisted` `auth_msg` - The message to send to the `tracker_bot` to authenticate with and access the announce channel. It's up to you figure it out. `watch_dir` - The directory to save torrents to. `cookies_txt` - The path to where you session cookie is 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, so the 'tag' can be any substring appearing in the announce message. ### Example config.cfg ``` @@ -30,4 +31,5 @@ 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 ``` diff --git a/oppaiBot.py b/oppaiBot.py index c4a71cc..4b026de 100755 --- a/oppaiBot.py +++ b/oppaiBot.py @@ -26,6 +26,7 @@ class OppaiBot(irc.IRCClient): self.cj.load() self.watch_dir = self.config["watch_dir"] + self.tags = self.config["tags"].split(",") def save_torrent(self, url, directory): @@ -48,7 +49,8 @@ class OppaiBot(irc.IRCClient): or users alike. """ # More advanced logic is left as an exercise to the reader. - if "English" in message or "Dual Language" in message: + tags_in_msg = [tag in message for tag in self.tags] + if any(tags_in_msg): url = message.split(" - ")[1].split(" / ")[1] self.save_torrent(url, self.watch_dir)