MCPcopy
hub / github.com/ChineseSubFinder/ChineseSubFinder / Check

Method Check

pkg/settings/settings.go:155–174  ·  view source on GitHub ↗

Check 检测,某些参数有范围限制

()

Source from the content-addressed store, hash-verified

153
154// Check 检测,某些参数有范围限制
155func (s *Settings) Check() {
156
157 // 每个网站最多找 Top 几的字幕结果,评价系统成熟后,才有设计的意义
158 if s.AdvancedSettings.Topic < 0 || s.AdvancedSettings.Topic > 3 {
159 s.AdvancedSettings.Topic = 1
160 }
161 // 如果 Debug 模式开启了,强制设置线程数为1,方便定位问题
162 if s.AdvancedSettings.DebugMode == true {
163 s.CommonSettings.Threads = 1
164 } else {
165 // 并发线程的范围控制
166 if s.CommonSettings.Threads <= 0 || s.CommonSettings.Threads > 6 {
167 s.CommonSettings.Threads = 6
168 }
169 }
170 // 这里需要做一次 Default 的检查,因为有设置会被改写低于预期,至少要在 Default 之上
171 s.AdvancedSettings.TaskQueue.Check()
172 s.AdvancedSettings.DownloadFileCache.Check()
173
174}
175
176// isDir 存在且是文件夹
177func isDir(path string) bool {

Callers 4

NewDownloaderFunction · 0.45
SupplierCheckMethod · 0.45
NewEmbyApiFunction · 0.45
mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected