aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-01-19 17:44:13 +0100
committerlonkaars <loek@pipeframe.xyz>2022-01-19 17:44:13 +0100
commitffa309ed1850cb0334e219162246c1868f1d43e1 (patch)
tree135e26bc7af49f0eca719a1ee6be55f9a940311b
parent480b9b61d8066875b318afa14667ac7faa5c435a (diff)
implement match-submitter
-rwxr-xr-xautonyaa.py8
-rw-r--r--readme.md16
2 files changed, 20 insertions, 4 deletions
diff --git a/autonyaa.py b/autonyaa.py
index 841106a..8890ac9 100755
--- a/autonyaa.py
+++ b/autonyaa.py
@@ -16,8 +16,10 @@ transmission_rpc_config = json.loads(transmission_rpc_file.read())
transmission_client = transmission_rpc.Client(**transmission_rpc_config)
torrents = transmission_client.get_torrents()
-def generate_url(query):
- return "https://nyaa.si/?" + urllib.parse.urlencode({"q": query, "page": "rss"})
+def generate_url(section):
+ options = { "q": section["name"], "page": "rss" }
+ if section.get("match-submitter"): options["u"] = section["match-submitter"]
+ return "https://nyaa.si/?" + urllib.parse.urlencode(options)
def fill_format_string(format_string, variables):
return_string = format_string
@@ -115,7 +117,7 @@ def start_dl(result, section, vars):
def main():
sections = parse_config_file()
for section in sections:
- response = requests.get(generate_url(section["name"])).text
+ response = requests.get(generate_url(section)).text
root = et.fromstring(response)
results = root[0].findall("item")
for result in results:
diff --git a/readme.md b/readme.md
index 99ba4d0..66b7e90 100644
--- a/readme.md
+++ b/readme.md
@@ -65,6 +65,20 @@ match-name /\[coolgroup\] Anime name episode (\d{2}) - episode title \(1080p\)\.
> in this example, the variable e is set to the first group (`(\d{2})`), and x
> is set to (`(.+)`). for regex help, see [regexr](https://regexr.com)
+### match-submitter
+
+```
+match-submitter <string>
+```
+
+filter torrent submitter using name.
+
+example
+
+```
+match-name coolgroup
+```
+
### destination
```
@@ -76,6 +90,6 @@ destination folder
## todo
- [ ] implement episode limit
-- [ ] implement match-submitter
+- [x] implement match-submitter