configurable tags
This commit is contained in:
parent
fbb554f198
commit
3fd1e9db7b
|
@ -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.
|
`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.
|
`watch_dir` - The directory to save torrents to.
|
||||||
`cookies_txt` - The path to where you session cookie is stored. Should be in Netscape format.
|
`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
|
### Example config.cfg
|
||||||
```
|
```
|
||||||
|
@ -30,4 +31,5 @@ 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
|
||||||
```
|
```
|
||||||
|
|
|
@ -26,6 +26,7 @@ class OppaiBot(irc.IRCClient):
|
||||||
self.cj.load()
|
self.cj.load()
|
||||||
|
|
||||||
self.watch_dir = self.config["watch_dir"]
|
self.watch_dir = self.config["watch_dir"]
|
||||||
|
self.tags = self.config["tags"].split(",")
|
||||||
|
|
||||||
|
|
||||||
def save_torrent(self, url, directory):
|
def save_torrent(self, url, directory):
|
||||||
|
@ -48,7 +49,8 @@ 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.
|
||||||
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]
|
url = message.split(" - ")[1].split(" / ")[1]
|
||||||
self.save_torrent(url, self.watch_dir)
|
self.save_torrent(url, self.watch_dir)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user