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

添加AcceptAnyFree选项 #60

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmd/brush/strategy/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type BrushSiteOptionStruct struct {
Excludes []string
ExcludeTags []string
AllowAddTorrents int64
AcceptAnyFree bool
}

type BrushClientOptionStruct struct {
Expand Down Expand Up @@ -521,7 +522,7 @@ func RateSiteTorrent(siteTorrent *site.Torrent, siteOption *BrushSiteOptionStruc
siteTorrent.Size > siteOption.TorrentMaxSizeLimit ||
(siteTorrent.DiscountEndTime > 0 && siteTorrent.DiscountEndTime-siteOption.Now < 3600) ||
(!siteOption.AllowZeroSeeders && siteTorrent.Seeders == 0) ||
siteTorrent.Leechers <= siteTorrent.Seeders {
((!siteOption.AcceptAnyFree || siteTorrent.DownloadMultiplier != 0) && siteTorrent.Leechers <= siteTorrent.Seeders) {
score = 0
return
}
Expand All @@ -536,7 +537,7 @@ func RateSiteTorrent(siteTorrent *site.Torrent, siteOption *BrushSiteOptionStruc
return
}
// 部分站点定期将旧种重新置顶免费。这类种子仍然可以获得很好的上传速度。
if siteOption.Now-siteTorrent.Time <= 86400*30 {
if !siteOption.AcceptAnyFree && siteOption.Now-siteTorrent.Time <= 86400*30 {
if siteOption.Now-siteTorrent.Time >= 86400 {
score = 0
return
Expand Down Expand Up @@ -598,6 +599,7 @@ func GetBrushSiteOptions(siteInstance site.Site, ts int64) *BrushSiteOptionStruc
TorrentMaxSizeLimit: siteInstance.GetSiteConfig().BrushTorrentMaxSizeLimitValue,
TorrentUploadSpeedLimit: siteInstance.GetSiteConfig().TorrentUploadSpeedLimitValue,
AllowNoneFree: siteInstance.GetSiteConfig().BrushAllowNoneFree,
AcceptAnyFree: siteInstance.GetSiteConfig().BrushAcceptAnyFree,
AllowPaid: siteInstance.GetSiteConfig().BrushAllowPaid,
AllowHr: siteInstance.GetSiteConfig().BrushAllowHr,
AllowZeroSeeders: siteInstance.GetSiteConfig().BrushAllowZeroSeeders,
Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ type SiteConfigStruct struct {
BrushAllowZeroSeeders bool `yaml:"brushAllowZeroSeeders"`
BrushExcludes []string `yaml:"brushExcludes"`
BrushExcludeTags []string `yaml:"brushExcludeTags"`
BrushAcceptAnyFree bool `yaml:"brushAcceptAnyFree"`
SelectorTorrentsListHeader string `yaml:"selectorTorrentsListHeader"`
SelectorTorrentsList string `yaml:"selectorTorrentsList"`
SelectorTorrentBlock string `yaml:"selectorTorrentBlock"` // dom block of a torrent in list
Expand Down
1 change: 1 addition & 0 deletions config/ptool.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ cookie = 'cookie_here'
#brushAllowHr = false # 是否允许使用HR种子刷流。程序不会特意保证HR种子的做种时长,所以仅当你的账户无视HR(如VIP)时开启此选项
#brushAllowZeroSeeders = false # 是否允许刷流任务添加当前0做种的种子到客户端
#brushExcludes = [] # 排除种子关键字列表。标题或副标题包含列表中任意项的种子不会被刷流任务选择
#brushAcceptAnyFree = false # 如果种子是免费的,则上传人数下载人数比和发布种子时间rtime的规则不限制
#timezone = 'Asia/Shanghai' # 网站页面显示时间的时区

# 新版 m-team (馒头) 不支持 Cookie。必须使用 token 鉴权。两种方法选择其一:
Expand Down