kannibalox / pyrosimple

An overhauled fork of the pyrocore tools for rTorrent
https://kannibalox.github.io/pyrosimple/
GNU General Public License v3.0
48 stars 5 forks source link

'TimeFilter' object has no attribute 'not_null' #60

Closed ownbee closed 9 months ago

ownbee commented 9 months ago

When I use last_xfer or active filter like:

rtcontrol active=-7d

I get the following error:

Traceback (most recent call last):
  File "/home/alex/tmp/pyro/.venv/bin/rtcontrol", line 8, in <module>
    sys.exit(run())
  File "/home/alex/tmp/pyro/.venv/lib/python3.10/site-packages/pyrosimple/scripts/rtcontrol.py", line 1051, in run
    RtorrentControl().run()
  File "/home/alex/tmp/pyro/.venv/lib/python3.10/site-packages/pyrosimple/scripts/base.py", line 195, in run
    self.mainloop()
  File "/home/alex/tmp/pyro/.venv/lib/python3.10/site-packages/pyrosimple/scripts/rtcontrol.py", line 841, in mainloop
    matches = futures[url].get()
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/alex/tmp/pyro/.venv/lib/python3.10/site-packages/pyrosimple/scripts/rtcontrol.py", line 832, in fetch
    matches = list(e.items(view=view, prefetch=prefetch))
  File "/home/alex/tmp/pyro/.venv/lib/python3.10/site-packages/pyrosimple/torrent/rtorrent.py", line 890, in items
    if view.matcher.match(ritem):
  File "/home/alex/tmp/pyro/.venv/lib/python3.10/site-packages/pyrosimple/util/matching.py", line 190, in match
    return any(c.match(item) for c in self.children)
  File "/home/alex/tmp/pyro/.venv/lib/python3.10/site-packages/pyrosimple/util/matching.py", line 190, in <genexpr>
    return any(c.match(item) for c in self.children)
  File "/home/alex/tmp/pyro/.venv/lib/python3.10/site-packages/pyrosimple/util/matching.py", line 488, in match
    if self.not_null and self._value and not val:
AttributeError: 'TimeFilter' object has no attribute 'not_null'

Seem like a coding error, the validate function is not called before to define the attribute.

kannibalox commented 9 months ago

I might do some re-factoring before creating a release to make this part of the code cleaner, but I won't hold off too long.