Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For deluge 2.0.3 here, the time_since_transfer field returns the interval from the last activity to the current #119

Closed
Nuevo009 opened this issue Dec 28, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@Nuevo009
Copy link

Nuevo009 commented Dec 28, 2021

对于 deluge 2.0.3,time_since_transfer 这条属性返回的是上次活动到目前的间隔时间

So it will lead to
所以会导致,在

if self.compare(time.time() - torrent.last_activity, self._last_activity, self._comparer):

is comparing a time close to 1970-01-01 08:00:00 with the time set in last_activity. . .Basically, the last_activity parameter can’t be used anymore.
是在拿一个接近于 1970-01-01 08:00:00 的时间和 config 里面设置的时间去比。。。基本上 last_activity 这条就不能用了

I made some changes to make it work on deluge.
我做了一些更改,让它可以在 deluge 上工作。

commit e476bb6c4796dc4c314f7ca04aca33a6946c7846
Author: Nuevo009 <73752701+Nuevo009@users.noreply.github.com>
Date:   Tue Dec 28 16:13:23 2021 +0800

    fix last_activity, only for deluge 2.0.3

diff --git a/autoremovetorrents/condition/lastactivity.py b/autoremovetorrents/condition/lastactivity.py
index 897ff74..72a9f18 100644
--- a/autoremovetorrents/condition/lastactivity.py
+++ b/autoremovetorrents/condition/lastactivity.py
@@ -10,7 +10,7 @@ class LastActivityCondition(Condition):
 
     def apply(self, client_status, torrents):
         for torrent in torrents:
-            if self.compare(time.time() - torrent.last_activity, self._last_activity, self._comparer):
+            if self.compare(torrent.last_activity, self._last_activity, self._comparer):
                 self.remove.add(torrent)
             else:
                 self.remain.add(torrent)
\ No newline at end of file
diff --git a/autoremovetorrents/torrent.py b/autoremovetorrents/torrent.py
index cd4250a..00c1ecc 100644
--- a/autoremovetorrents/torrent.py
+++ b/autoremovetorrents/torrent.py
@@ -46,7 +46,7 @@ class Torrent(object):
                 disp('average_upload_speed', convert_speed),
                 disp('create_time', convert_timestamp),
                 disp('seeding_time', convert_seconds),
-                disp('last_activity', convert_timestamp),
+                disp('last_activity', convert_seconds),
                 disp('category', ','.join),
                 disp('tracker', lambda t: \
                     ','.join(

But this should be incompatible with other clients. There were similar problems before, such as #98 and #109, so maybe it is better to unify the format returned by the last_activity in the .client? The time returned by each client is unified into an interval instead of being calculated when comparing. . .
但这应该和其他客户端不兼容,之前也有相似的问题,比如 #98#109 ,所以或许统一一下这个 last_activity.client 里面返回的格式更好?针对各个客户端返回的时间,统一成间隔,而不是在比较的时候再算。。。

@jerrymakesjelly
Copy link
Owner

还有这种事情。。。感谢反馈,我会在下一个版本留意并修复此问题。

@jerrymakesjelly jerrymakesjelly added the bug Something isn't working label Apr 20, 2022
@jerrymakesjelly jerrymakesjelly mentioned this issue Apr 22, 2022
44 tasks
jerrymakesjelly added a commit that referenced this issue Apr 25, 2022
Set 'last_activity' attribute as time interval since last activity

Closes #119.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants