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

希望“seed_size:”里“action:“下的参数能添加一对是按照“完成时间”来计算的参数 #6

Open
Se7enMuting opened this issue Aug 17, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@Se7enMuting
Copy link

Se7enMuting commented Aug 17, 2018

用了下参数remove-old-seeds,这个应该是按照创建时间来计算的吧?但是有的种子下载时间会很长,我希望能否再添加一对类似“remove-old-seeds”和“remove-new-seeds”的参数,但是是以完成时间来排序计算的,这样可以避免出现刚下载完,或甚至没有下载完就被删除的情况。

@Se7enMuting
Copy link
Author

再提一点建议,能不能再输出个log,只记录删除种子的日志?或者加个参数,可以选择全部log输出或者只输出删除种子log?
问下参数remove-old-seeds删除逻辑是什么,发现好像不是删除最旧的种子,好像是尽可能少删除种子and最旧的种子?

@jerrymakesjelly
Copy link
Owner

jerrymakesjelly commented Aug 26, 2018

remove-old-seeds的确是按照创建时间来算的。目前还没有按照完成时间删除的功能,后续可以添加。

log的确很冗长,这是个问题,需要改进。

您对remove-old-seeds的猜测是对的。具体逻辑基于贪心法,程序将所有种子按添加时间从新到旧排列,同时内部创建一个保留列表,然后依次选取种子,如果该种子的大小加上保留列表的种子总大小仍在限制大小内,该种子即可被保留,否则种子将会被删除。

def apply(self, torrents):
ConditionWithSort.sort_torrents(self, torrents)
size_sum = 0
for torrent in torrents:
if size_sum+torrent.size < self._limit:
size_sum += torrent.size
self.remain.append(torrent)
else:
self.remove.append(torrent)

@monokoo
Copy link

monokoo commented Jan 25, 2019

同求

@jerrymakesjelly jerrymakesjelly added the enhancement New feature or request label Apr 4, 2019
@jerrymakesjelly jerrymakesjelly mentioned this issue Feb 4, 2020
44 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants