mirror of
https://github.com/LamGC/ContentGrabbingJi.git
synced 2025-07-01 21:07:25 +00:00
[Add] 增加Ranking带图作品限制的配置项;
[Add] 增加image.downloadAllPages配置项以指定下载作品中某一Pages的时候是否下载其他Pages;
This commit is contained in:
@ -112,16 +112,23 @@ public class CQProcess {
|
|||||||
StringBuilder resultBuilder = new StringBuilder(mode.name() + " - 以下是 ").append(new SimpleDateFormat("yyyy-MM-dd").format(queryDate)).append(" 的Pixiv插画排名榜前十名:\n");
|
StringBuilder resultBuilder = new StringBuilder(mode.name() + " - 以下是 ").append(new SimpleDateFormat("yyyy-MM-dd").format(queryDate)).append(" 的Pixiv插画排名榜前十名:\n");
|
||||||
try {
|
try {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int limit = 10;
|
int itemLimit = 10;
|
||||||
String propertyKey = "ranking.ItemCountLimit";
|
String itemLimitPropertyKey = "ranking.ItemCountLimit";
|
||||||
try {
|
try {
|
||||||
|
itemLimit = Integer.parseInt(CQPluginMain.globalProp.getProperty(itemLimitPropertyKey, "10"));
|
||||||
limit = Integer.parseInt(CQPluginMain.globalProp.getProperty(propertyKey, "10"));
|
|
||||||
} catch(NumberFormatException e) {
|
} catch(NumberFormatException e) {
|
||||||
log.warn("配置项 {} 的参数值格式有误!", propertyKey);
|
log.warn("配置项 {} 的参数值格式有误!", itemLimitPropertyKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (JsonObject rankInfo : getRankingInfoByCache(PixivURL.RankingContentType.TYPE_ILLUST, mode, queryDate, 0, limit)) {
|
int imageLimit = 3;
|
||||||
|
String imageLimitPropertyKey = "ranking.imageCountLimit";
|
||||||
|
try {
|
||||||
|
imageLimit = Integer.parseInt(CQPluginMain.globalProp.getProperty(imageLimitPropertyKey, "3"));
|
||||||
|
} catch(NumberFormatException e) {
|
||||||
|
log.warn("配置项 {} 的参数值格式有误!", imageLimitPropertyKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (JsonObject rankInfo : getRankingInfoByCache(PixivURL.RankingContentType.TYPE_ILLUST, mode, queryDate, 0, itemLimit)) {
|
||||||
index++;
|
index++;
|
||||||
int rank = rankInfo.get("rank").getAsInt();
|
int rank = rankInfo.get("rank").getAsInt();
|
||||||
int illustId = rankInfo.get("illust_id").getAsInt();
|
int illustId = rankInfo.get("illust_id").getAsInt();
|
||||||
@ -130,7 +137,7 @@ public class CQProcess {
|
|||||||
String title = rankInfo.get("title").getAsString();
|
String title = rankInfo.get("title").getAsString();
|
||||||
resultBuilder.append(rank).append(". (id: ").append(illustId).append(") ").append(title)
|
resultBuilder.append(rank).append(". (id: ").append(illustId).append(") ").append(title)
|
||||||
.append("(Author: ").append(authorName).append(",").append(authorId).append(")\n");
|
.append("(Author: ").append(authorName).append(",").append(authorId).append(")\n");
|
||||||
if (index < 4) {
|
if (index <= imageLimit) {
|
||||||
resultBuilder.append(getImageById(illustId, PixivDownload.PageQuality.REGULAR, 1)).append("\n");
|
resultBuilder.append(getImageById(illustId, PixivDownload.PageQuality.REGULAR, 1)).append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -399,7 +406,8 @@ public class CQProcess {
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
log.warn("图片下载遭到中断!", e);
|
log.warn("图片下载遭到中断!", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else if(CQPluginMain.globalProp.getProperty("image.downloadAllPages", "false")
|
||||||
|
.equalsIgnoreCase("true")) {
|
||||||
imageCacheExecutor.executor(
|
imageCacheExecutor.executor(
|
||||||
new ImageCacheObject(imageCache, illustId, link, currentImageFile));
|
new ImageCacheObject(imageCache, illustId, link, currentImageFile));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user