I want to filter the size of torrent before download #3801
-
I have a private tracker, and its RSS offer the size of a torrent in its tittle. Example:
I want to write a regex that will accept the size above 10GB and not bigger then 20GB. I tried content_size with min and max, it works but it will require to download the .torrent file so It can do the match. But this also break the rule of request the torrent too much will block my download any other torrent for a day in this tracker. I wonder any trick for regex to accept the xx GB like: 10 GB < xx < 20GB? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
We have the content_size plugin which can be used to filter based on size. It relies on other plugins to get that size from either a torrent or nzb file. content_size:
min: 10240
max: 20480
set:
# The content_size plugin expects the 'content_size' field to be in mebibytes, but the parse_size filter returns in bytes
content_size: "{{ title|parse_size / 1024 / 1024 }}" |
Beta Was this translation helpful? Give feedback.
-
Looking at our code, it prompted me to standardize all of our file size handling. If/when #3802 goes in, the following will be possible (And my above example will no longer be valid without removing the set:
content_size: "{{ title|parse_size }}"
content_size:
min: 10 GiB
max: 20 GiB |
Beta Was this translation helpful? Give feedback.
We have the content_size plugin which can be used to filter based on size. It relies on other plugins to get that size from either a torrent or nzb file.
If you have a reliable size in the title, you can rely on that instead by filling in the 'content_size' field with the set plugin. There is a jinja filter we provide (which I noticed wasn't documented until I added it a couple minutes ago) that can help.