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

希望增加“磁盘剩余空间”小于某个值时,删除“最后活动”最大值的条件。 #42

Open
sununs opened this issue Sep 17, 2019 · 15 comments
Labels

Comments

@sununs
Copy link

sununs commented Sep 17, 2019

希望增加“磁盘剩余空间”小于某个值时,删除“最后活动”最大值的条件。
qb中两个数值都有。感觉这一个条件就够用了呢。

@sununs
Copy link
Author

sununs commented Oct 8, 2019

每天来看一次,期待作者更新~

jerrymakesjelly added a commit that referenced this issue Jan 8, 2020
@sununs
Copy link
Author

sununs commented Jan 11, 2020

感谢大佬更新,remove-inactive-seeds部分测试2天,工作正常

@jerrymakesjelly
Copy link
Owner

感谢测试 😄 有问题请随时告知

如果没问题,很快我就会把这个功能合并到主分支中

jerrymakesjelly added a commit that referenced this issue Jan 16, 2020
Reference to #21, closes #39, #42.
jerrymakesjelly added a commit that referenced this issue Jan 16, 2020
@sununs
Copy link
Author

sununs commented Jan 30, 2020

感谢测试 😄 有问题请随时告知

如果没问题,很快我就会把这个功能合并到主分支中

大佬,整理一下我的问题
①1.4.9包含last_activity吗?我使用直接报错了。
②remove-inactive-seeds是尽量删除时间最长的”最后活动“种子吗,我测试感觉好像是删除随机的非活动种子?

附上我的config:
微信截图_20200131062527

@jerrymakesjelly
Copy link
Owner

jerrymakesjelly commented Jan 31, 2020

@sununs 感谢您的支持和细心测试

①1.4.9包含last_activity吗?我使用直接报错了。

不包含,1.4.9只添加了剩余空间的这一个功能,这个分支由于涉及到架构的一点点变动所以还没合并

②remove-inactive-seeds是尽量删除时间最长的”最后活动“种子吗,我测试感觉好像是删除随机的非活动种子?

在删除的过程中,程序会按活动时间对种子进行排序,不过由于所用的删除策略的不同,AMT并不总是按照活动顺序去删除种子的

对于maximum_number,它直接取最不活跃的几个种子,这个就完全按照顺序去取了

if self._max_limit == 0:
self.remove = torrents
elif self._max_limit < len(torrents):
self.remove = set(torrents[0:len(torrents)-self._max_limit])
self.remain = set(torrents[len(torrents)-self._max_limit:])
else:
self.remain = torrents

但对于seed_size,它在删除的时候还会考虑种子的大小,具体做法是先按活跃时间从近到远排列,然后依次挑选种子,当满足 这个种子的体积+已挑选种子的体积 < 设置的大小 这个条件时,这个种子才会被挑选并保留(因为留下来的话就超过限制了);否则它就会被删除,即使它确实比后面的种子更活跃一些

for torrent in torrents:
if size_sum+torrent.size < self._limit:
size_sum += torrent.size
self.remain.add(torrent)
else:
self.remove.add(torrent)

对于后面要在 free_space 中添加的 remove-active-seedsremove-inactive-seeds 也是如此
这也是为什么在描述中会写尽量删除活跃/不活跃种子的原因

@sununs
Copy link
Author

sununs commented Jan 31, 2020

@jerrymakesjelly 感谢大佬百忙中的回复。
假如种子按活跃时间从近到远排列分别为2G,3G,1G,如果seed_size设置4G
我以为:保留2G种子,删除3G和1G的种子。
大佬的意思是:保留2G和1G的种子,删除3G的种子?

@jerrymakesjelly
Copy link
Owner

大佬的意思是:保留2G和1G的种子,删除3G的种子?

@sununs 对的,就是这个意思 🐶 毕竟留下1G的种子也没有超出限制
其实是一个贪心算法

@sununs
Copy link
Author

sununs commented Jan 31, 2020

大佬的意思是:保留2G和1G的种子,删除3G的种子?

@sununs 对的,就是这个意思 🐶 毕竟留下1G的种子也没有超出限制
其实是一个贪心算法
@jerrymakesjelly 这个算法优点很明显,每次处理后都更贴近设置的大小。
我测试中发现有个小小的问题,就是大量活跃时间很远的小种子,多次处理后仍会保留下来。

@jerrymakesjelly jerrymakesjelly mentioned this issue Feb 4, 2020
44 tasks
jerrymakesjelly added a commit that referenced this issue Feb 4, 2020
Reference to #21, closes #39, #42.
jerrymakesjelly added a commit that referenced this issue Feb 4, 2020
@sununs
Copy link
Author

sununs commented Feb 7, 2020

@jerrymakesjelly 大佬,我把种子按照“最后活动”做了一个递减排序:1#种子为4天21小时前;306#种子为1分钟前。使用“remove-inactive-seeds”动作,我理解为应该尽量删除排序靠前的种子。实际测试为:
第一次删除为 43#,298#
第二此删除为 126#,132#,218#,227#,279#
第三次删除为 39#,217#,257#,275#
回头大佬给看看,谢谢了!

jerrymakesjelly added a commit that referenced this issue Feb 10, 2020
@jerrymakesjelly
Copy link
Owner

@sunsuns 感谢你的细心测试,请问你用的是哪个条件呢?maximum_numberseed_size还是free_space?另外BT客户端的版本可不可以也提供一下

我在issue42分支中构建了一个非贪婪删除的版本,在这个版本里面的种子应该就是严格按照顺序删除的,如果可以的话你可以测试一下,不过需要手动安装:

git clone https://github.com/jerrymakesjelly/autoremove-torrents
git checkout issue42
python3 setup.py install

卸载的时候仍然可以使用pip卸载

@sununs
Copy link
Author

sununs commented Feb 10, 2020

@jerrymakesjelly 已测试issue42分支完全正常,测试环境: qbittorrent4.2.1,free_space,remove-inactive-seeds,大佬辛苦了!

@jerrymakesjelly
Copy link
Owner

@sununs 感谢测试,下一个版本我会添加一个是否启用贪婪模式的开关,满足用户的更多样化的需求

@sununs
Copy link
Author

sununs commented Feb 14, 2020

这个主意不错,等新版本。:)

jerrymakesjelly added a commit that referenced this issue Feb 28, 2020
Reference to #21, closes #39, #42.
jerrymakesjelly added a commit that referenced this issue Feb 28, 2020
@ceozero
Copy link

ceozero commented Mar 7, 2020

remove-inactive-seeds 可以判断超过多少天前的种子吗。HR不够的也不活动的种子经常被删掉。
比如 remove-inactive-seeds 只删除做种超过5天并且不活动的种子。

@jerrymakesjelly
Copy link
Owner

remove-inactive-seeds 可以判断超过多少天前的种子吗。HR不够的也不活动的种子经常被删掉。
比如 remove-inactive-seeds 只删除做种超过5天并且不活动的种子。

这个功能需要一个 if 表达式的机制,这个功能在未来会添加

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants