[Change] PixivURL 调整RankingContentType.ALL名称(ALL -> TYPE_ALL);

[Add] PixivDownload 增加调试日志信息;
[Fix] RandomIntervalSendTimer 修复cancel方法无法停止定时器的问题;
This commit is contained in:
LamGC 2020-04-24 23:54:26 +08:00
parent 16522155e1
commit a1e54e70d9
3 changed files with 4 additions and 2 deletions

View File

@ -133,6 +133,7 @@ public class RandomIntervalSendTimer extends TimerTask {
@Override
public boolean cancel() {
start.set(false);
loop.set(false);
return super.cancel();
}

View File

@ -317,6 +317,7 @@ public class PixivDownload {
ArrayList<JsonObject> results = new ArrayList<>(range);
for (int pageIndex = startPages; pageIndex <= endPages && count < range; pageIndex++) {
HttpGet request = createHttpGetRequest(PixivURL.getRankingLink(contentType, mode, time, pageIndex, true));
log.debug("RequestUri: {}", request.getURI());
HttpResponse response = httpClient.execute(request);
if(response.getStatusLine().getStatusCode() != 200) {

View File

@ -186,7 +186,7 @@ public class PixivURL {
public static String getRankingLink(RankingContentType contentType, RankingMode mode, Date time, int pageIndex, boolean json){
StringBuilder linkBuilder = new StringBuilder(PIXIV_RANKING_LINK);
linkBuilder.append("mode=").append(mode == null ? RankingMode.MODE_DAILY.modeParam : mode.modeParam);
if(contentType != null && !contentType.equals(RankingContentType.ALL)){
if(contentType != null && !contentType.equals(RankingContentType.TYPE_ALL)){
linkBuilder.append("&content=").append(contentType.typeName);
}
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
@ -278,7 +278,7 @@ public class PixivURL {
* 排名榜类型
*/
public enum RankingContentType{
ALL("", RankingMode.values()),
TYPE_ALL("", RankingMode.values()),
/**
* 插画
* 支持的时间类型: 每天, 每周, 每月, 新人