mirror of
https://github.com/LamGC/ContentGrabbingJi.git
synced 2025-04-30 06:37:36 +00:00
[Change] BotCommandProcess 优化Tag过滤表达式;
[Change] ImageCacheHandler 调整日志输出级别;
This commit is contained in:
parent
97d06c4fc3
commit
87f2535b48
@ -23,6 +23,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@SuppressWarnings({"SameParameterValue"})
|
||||
public class BotCommandProcess {
|
||||
@ -522,6 +523,10 @@ public class BotCommandProcess {
|
||||
return reportStore.exists(String.valueOf(illustId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag过滤表达式
|
||||
*/
|
||||
private final static Pattern tagPattern = Pattern.compile(".*R-*18.*");
|
||||
/**
|
||||
* 检查指定作品是否为r18
|
||||
* @param illustId 作品Id
|
||||
@ -538,7 +543,7 @@ public class BotCommandProcess {
|
||||
boolean rawValue = illustInfo.get("xRestrict").getAsInt() != 0;
|
||||
if(!rawValue) {
|
||||
for(JsonElement tag : tags) {
|
||||
boolean current = tag.getAsString().matches("R-*18") || tag.getAsString().contains("R18");
|
||||
boolean current = tagPattern.matcher(tag.getAsString()).matches();
|
||||
if (current) {
|
||||
rawValue = true;
|
||||
break;
|
||||
|
@ -38,7 +38,7 @@ public class ImageCacheHandler implements EventHandler {
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("图片 {} Event正在进行...({})", event.getStoreFile().getName(), Integer.toHexString(event.hashCode()));
|
||||
log.debug("图片 {} Event正在进行...({})", event.getStoreFile().getName(), Integer.toHexString(event.hashCode()));
|
||||
File storeFile = event.getStoreFile();
|
||||
log.debug("正在缓存图片 {} (Path: {})", storeFile.getName(), storeFile.getAbsolutePath());
|
||||
try {
|
||||
@ -87,7 +87,7 @@ public class ImageCacheHandler implements EventHandler {
|
||||
}
|
||||
event.getImageCache().put(URLs.getResourceName(event.getDownloadLink()), storeFile);
|
||||
} finally {
|
||||
log.info("图片 {} Event结束({})", event.getStoreFile().getName(), Integer.toHexString(event.hashCode()));
|
||||
log.debug("图片 {} Event结束({})", event.getStoreFile().getName(), Integer.toHexString(event.hashCode()));
|
||||
cacheQueue.remove(event);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user