added blacklist
This commit is contained in:
parent
cb68972816
commit
233579e765
|
@ -19,6 +19,7 @@ Python modules: `requests, twisted`
|
||||||
`watch_dir` - The directory to save torrents to.
|
`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.
|
`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.
|
`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
|
### Example config.cfg
|
||||||
```
|
```
|
||||||
|
@ -31,7 +32,8 @@ tracker_bot = Udon
|
||||||
auth_msg = BOT #oppaitime-announce iou1name SpaghettiIsAFaggot
|
auth_msg = BOT #oppaitime-announce iou1name SpaghettiIsAFaggot
|
||||||
watch_dir = /home/iou1name/torrent/oppaitime/Watch/
|
watch_dir = /home/iou1name/torrent/oppaitime/Watch/
|
||||||
cookies_txt = cookies.txt
|
cookies_txt = cookies.txt
|
||||||
tags = English,Dual Language
|
tags = English,Dual Language,subs
|
||||||
|
blacklist = Loose
|
||||||
|
|
||||||
[redacted]
|
[redacted]
|
||||||
server = irc.scratch-network.net
|
server = irc.scratch-network.net
|
||||||
|
|
|
@ -28,7 +28,7 @@ class OppaiBot(irc.IRCClient):
|
||||||
|
|
||||||
self.watch_dir = self.config["watch_dir"]
|
self.watch_dir = self.config["watch_dir"]
|
||||||
self.tags = self.config["tags"].split(",")
|
self.tags = self.config["tags"].split(",")
|
||||||
|
self.blacklist = self.config.get("blacklist").split(",")
|
||||||
|
|
||||||
def save_torrent(self, url, directory):
|
def save_torrent(self, url, directory):
|
||||||
"""
|
"""
|
||||||
|
@ -51,6 +51,10 @@ class OppaiBot(irc.IRCClient):
|
||||||
or users alike.
|
or users alike.
|
||||||
"""
|
"""
|
||||||
# More advanced logic is left as an exercise to the reader.
|
# 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]
|
tags_in_msg = [tag in message for tag in self.tags]
|
||||||
if any(tags_in_msg):
|
if any(tags_in_msg):
|
||||||
url = re.findall(r"(http.+?) ", message)[1]
|
url = re.findall(r"(http.+?) ", message)[1]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user