mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-26 20:47:57 +08:00
feat: add defaukt min size, 80M for tv, 200M for movie
This commit is contained in:
@@ -108,6 +108,11 @@ func imdbIDMatchExact(id1, id2 string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func torrentSizeOk(detail *db.MediaDetails, torrentSize int, param *SearchParam) bool {
|
func torrentSizeOk(detail *db.MediaDetails, torrentSize int, param *SearchParam) bool {
|
||||||
|
defaultMinSize := 80 * 1000 * 1000 //tv, 80M min
|
||||||
|
if detail.MediaType == media.MediaTypeMovie {
|
||||||
|
defaultMinSize = 200 * 1000 * 1000 // movie, 200M min
|
||||||
|
}
|
||||||
|
|
||||||
if param.CheckFileSize {
|
if param.CheckFileSize {
|
||||||
multiplier := 1 //大小倍数,正常为1,如果是季包则为季内集数
|
multiplier := 1 //大小倍数,正常为1,如果是季包则为季内集数
|
||||||
if detail.MediaType == media.MediaTypeTv && len(param.Episodes) == 0 { //tv season pack
|
if detail.MediaType == media.MediaTypeTv && len(param.Episodes) == 0 { //tv season pack
|
||||||
@@ -119,7 +124,13 @@ func torrentSizeOk(detail *db.MediaDetails, torrentSize int, param *SearchParam)
|
|||||||
if torrentSize < sizeMin { //比最小要求的大小还要小
|
if torrentSize < sizeMin { //比最小要求的大小还要小
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
sizeMin := defaultMinSize * multiplier
|
||||||
|
if torrentSize < sizeMin { //比最小要求的大小还要小
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if detail.Limiter.SizeMax > 0 { //max size
|
if detail.Limiter.SizeMax > 0 { //max size
|
||||||
sizeMax := detail.Limiter.SizeMax * multiplier
|
sizeMax := detail.Limiter.SizeMax * multiplier
|
||||||
if torrentSize > sizeMax { //larger than max size wanted
|
if torrentSize > sizeMax { //larger than max size wanted
|
||||||
|
|||||||
Reference in New Issue
Block a user