[Add] PixivURL 为RankingContentType增加isSupportedMode以检查指定的RankingMode是否支持;

[Update] 对CQProcess, PixivDownload, RankingUpdateTimer添加对RankingContentType.isSupportedMode的支持以消除无效请求带来的资源浪费;
This commit is contained in:
2020-04-01 09:50:45 +08:00
parent 3e4874b67c
commit ae3f52532c
4 changed files with 86 additions and 8 deletions

View File

@ -293,6 +293,10 @@ public class PixivDownload {
throw new IllegalArgumentException("range cannot be less than or equal to zero");
}
if(!contentType.isSupportedMode(mode)) {
throw new IllegalArgumentException("ContentType不支持指定的RankingMode: ContentType: " + contentType.name() + ", Mode: " + mode.name());
}
int startPage = (int) Math.ceil(rankStart / 50F);
int requestFrequency = (int) Math.ceil((rankStart + (range - 1)) / 50F);
int surplusQuantity = range;