Skip to content

Commit 1cdcbbd

Browse files
committed
query: added is_* bool fields, and up/down (#47)
1 parent 2b7eeb5 commit 1cdcbbd

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/pyrocore/util/matching.py

+18-9
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,20 @@ class FieldFilter(Filter):
183183
throttle = "d.throttle_name=",
184184
# tracker = "=",
185185

186-
#done = "=",
187-
#down = "=",
186+
is_active = "d.is_active=",
187+
is_complete = "d.complete=",
188+
is_ignored = "d.ignore_commands=",
189+
is_multi_file = "d.is_multi_file=",
190+
is_open = "d.is_open=",
191+
192+
# done = "=",
193+
down = "d.down.rate=",
188194
# fno = "=",
189195
prio = "d.priority=",
190196
ratio = "d.ratio=",
191197
size = "d.size_bytes=",
192-
#up = "=",
193-
#uploaded = "=",
198+
up = "d.up.rate=",
199+
uploaded = "d.up.total=",
194200

195201
completed = "d.custom=tm_completed",
196202
loaded = "d.custom=tm_loaded",
@@ -204,12 +210,7 @@ class FieldFilter(Filter):
204210
#active last time a peer was connected
205211
#directory directory containing download data
206212
#files list of files in this item
207-
#is_active download active?
208-
#is_complete download complete?
209213
#is_ghost has no data file or directory?
210-
#is_ignored ignore commands?
211-
#is_multi_file single- or multi-file download?
212-
#is_open download open?
213214
#is_private private flag set (no DHT/PEX)?
214215
#leechtime time taken from start to completion
215216
#seedtime total seeding time after completion
@@ -357,6 +358,14 @@ class BoolFilter(FieldFilter):
357358
""" Filter boolean values.
358359
"""
359360

361+
def pre_filter(self):
362+
""" Return rTorrent condition to speed up data transfer.
363+
"""
364+
if self._name in self.PRE_FILTER_FIELDS:
365+
return '"equal={},value={}"'.format(
366+
self.PRE_FILTER_FIELDS[self._name], int(self._value))
367+
return ''
368+
360369
def validate(self):
361370
""" Validate filter condition (template method).
362371
"""

0 commit comments

Comments
 (0)