From ffa309ed1850cb0334e219162246c1868f1d43e1 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 19 Jan 2022 17:44:13 +0100 Subject: implement match-submitter --- autonyaa.py | 8 +++++--- readme.md | 16 +++++++++++++++- 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 +``` + +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 -- cgit v1.2.3