|
@@ -74,6 +74,8 @@ public class BgServiceImpl implements BgService {
|
|
|
@Value("${spring.profiles.active}")
|
|
@Value("${spring.profiles.active}")
|
|
|
private String env;
|
|
private String env;
|
|
|
|
|
|
|
|
|
|
+ private String ignoreFileTypeSuffix = "";
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* findDicCode
|
|
* findDicCode
|
|
|
*
|
|
*
|
|
@@ -495,6 +497,10 @@ public class BgServiceImpl implements BgService {
|
|
|
videoInfoCastMapper.deleteAll();
|
|
videoInfoCastMapper.deleteAll();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ ignoreFileTypeSuffix = dicCodeMapper.findByCodeKey("ignore_filetype_suffix", null).stream()
|
|
|
|
|
+ .filter(x -> x.getEnv().contains(env)).findFirst().get().getCodeValue();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
List<String> allIcode = videoInfoMapper.findAllIcode();
|
|
List<String> allIcode = videoInfoMapper.findAllIcode();
|
|
|
getAllFilePaths(picPath, javAllInfo, allIcode);
|
|
getAllFilePaths(picPath, javAllInfo, allIcode);
|
|
|
|
|
|
|
@@ -941,10 +947,7 @@ public class BgServiceImpl implements BgService {
|
|
|
StringBuffer picTime = new StringBuffer("{cover:");
|
|
StringBuffer picTime = new StringBuffer("{cover:");
|
|
|
|
|
|
|
|
// 图片URL bigImage
|
|
// 图片URL bigImage
|
|
|
- String href = container.select("a.bigImage").first().attr("abs:href");
|
|
|
|
|
-
|
|
|
|
|
- long start = System.currentTimeMillis();
|
|
|
|
|
- Connection.Response response = Jsoup.connect(href).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
|
|
|
|
|
|
|
+ String qibingCover = qibings.concat("/cover/");
|
|
|
|
|
|
|
|
String fileName = issueDate.concat(" ").concat(h3);
|
|
String fileName = issueDate.concat(" ").concat(h3);
|
|
|
byte[] imgUrlBytes = fileName.getBytes(StandardCharsets.UTF_8);
|
|
byte[] imgUrlBytes = fileName.getBytes(StandardCharsets.UTF_8);
|
|
@@ -955,32 +958,43 @@ public class BgServiceImpl implements BgService {
|
|
|
}
|
|
}
|
|
|
fileName = fileName.concat(".jpg");
|
|
fileName = fileName.concat(".jpg");
|
|
|
|
|
|
|
|
- String qibingCover = qibings.concat("/cover/");
|
|
|
|
|
- saveFile2(response.bodyStream(), qibingPath.concat(qibingCover), fileName);
|
|
|
|
|
- picTime.append(System.currentTimeMillis() - start).append(",");
|
|
|
|
|
|
|
+ if (!new File(qibingPath.concat(qibingCover), fileName).exists()) {
|
|
|
|
|
+ String href = container.select("a.bigImage").first().attr("abs:href");
|
|
|
|
|
+
|
|
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
|
|
+ Connection.Response response = Jsoup.connect(href).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
|
|
|
|
|
+
|
|
|
|
|
+ saveFile2(response.bodyStream(), qibingPath.concat(qibingCover), fileName);
|
|
|
|
|
+ picTime.append(System.currentTimeMillis() - start).append(",");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
videoInfo.setImgUrl(qibingCover.concat(fileName));
|
|
videoInfo.setImgUrl(qibingCover.concat(fileName));
|
|
|
|
|
|
|
|
// 图片URL img_gf
|
|
// 图片URL img_gf
|
|
|
- Elements sampleBoxEles = container.select("div#sample-waterfall").select("a");
|
|
|
|
|
- long start2 = System.currentTimeMillis();
|
|
|
|
|
- if (sampleBoxEles.size() > 0) {
|
|
|
|
|
- Connection.Response responseImg;
|
|
|
|
|
- String qibingImgGF = qibings.concat("/img_gf/");
|
|
|
|
|
- for (Element sampleBoxEle : sampleBoxEles) {
|
|
|
|
|
- String sampleBoxHref = sampleBoxEle.attr("href");
|
|
|
|
|
- if (!sampleBoxHref.contains("http")) {
|
|
|
|
|
- sampleBoxHref = sampleBoxEle.attr("abs:href");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ String qibingImgGF = qibings.concat("/img_gf/");
|
|
|
|
|
+
|
|
|
|
|
+ File qibingImgGFFile = new File(qibingPath.concat(qibingImgGF));
|
|
|
|
|
+ if (!qibingImgGFFile.exists() || qibingImgGFFile.listFiles().length == 0) {
|
|
|
|
|
+ Elements sampleBoxEles = container.select("div#sample-waterfall").select("a");
|
|
|
|
|
+ long start2 = System.currentTimeMillis();
|
|
|
|
|
+ if (sampleBoxEles.size() > 0) {
|
|
|
|
|
+ Connection.Response responseImg;
|
|
|
|
|
+
|
|
|
|
|
+ for (Element sampleBoxEle : sampleBoxEles) {
|
|
|
|
|
+ String sampleBoxHref = sampleBoxEle.attr("href");
|
|
|
|
|
+ if (!sampleBoxHref.contains("http")) {
|
|
|
|
|
+ sampleBoxHref = sampleBoxEle.attr("abs:href");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- responseImg = Jsoup.connect(sampleBoxHref).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
|
|
|
|
|
- String sampleBoxFileName = sampleBoxHref.substring(sampleBoxHref.lastIndexOf("/") + 1);
|
|
|
|
|
- saveFile2(responseImg.bodyStream(), qibingPath.concat(qibingImgGF), sampleBoxFileName);
|
|
|
|
|
|
|
+ responseImg = Jsoup.connect(sampleBoxHref).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
|
|
|
|
|
+ String sampleBoxFileName = sampleBoxHref.substring(sampleBoxHref.lastIndexOf("/") + 1);
|
|
|
|
|
+ saveFile2(responseImg.bodyStream(), qibingPath.concat(qibingImgGF), sampleBoxFileName);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.error("jsoupVideoInfo img_gf null,identificationCode={}", identificationCode);
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- log.error("jsoupVideoInfo img_gf null,identificationCode={}", identificationCode);
|
|
|
|
|
|
|
+ picTime.append("img_gf:").append(System.currentTimeMillis() - start2).append("}");
|
|
|
}
|
|
}
|
|
|
- picTime.append("img_gf:").append(System.currentTimeMillis() - start2).append("}");
|
|
|
|
|
|
|
|
|
|
return picTime.toString();
|
|
return picTime.toString();
|
|
|
}
|
|
}
|
|
@@ -1059,7 +1073,8 @@ public class BgServiceImpl implements BgService {
|
|
|
getAllFilePaths(file.getAbsolutePath(), javAllInfo, allIcode);
|
|
getAllFilePaths(file.getAbsolutePath(), javAllInfo, allIcode);
|
|
|
} else {
|
|
} else {
|
|
|
String fileName = file.getName();
|
|
String fileName = file.getName();
|
|
|
- if (!fileName.endsWith(".jpg") && !fileName.endsWith(".txt")) {
|
|
|
|
|
|
|
+ String fileSuffix = fileName.substring(fileName.lastIndexOf(".") + 1);
|
|
|
|
|
+ if (!ignoreFileTypeSuffix.contains(fileSuffix)) {
|
|
|
String parentName = file.getParentFile().getName();
|
|
String parentName = file.getParentFile().getName();
|
|
|
// 识别码
|
|
// 识别码
|
|
|
String name = fileName.substring(10, fileName.lastIndexOf(".")).trim();
|
|
String name = fileName.substring(10, fileName.lastIndexOf(".")).trim();
|