Skip to content

Commit

Permalink
Merge pull request #60 from fjh1997/master
Browse files Browse the repository at this point in the history
添加AcceptAnyFree选项
  • Loading branch information
sagan authored Jan 21, 2025
2 parents ec1b814 + ef64e58 commit 672c23f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
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

0 comments on commit 672c23f

Please sign in to comment.