package com.ranfa.lib;
+import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import javax.swing.JOptionPane;
+import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+
public class EstimateAlbumTypeCycle {
private final static String CYCLEPATH = "generated/albumCycle.json";
AlbumCycleDefinitionProperty property = new AlbumCycleDefinitionProperty();
String inputType = JOptionPane.showInputDialog("現在のMASTER+のALBUMを入力してください。(A,B,C)");
if(!inputType.equals("A") || !inputType.equals("B") || !inputType.equals("C")) {
+
LimitedLog.println(EstimateAlbumTypeCycle.class + ":[FATAL]; " + "inputType has invaild.Canceling initiate...");
return;
}
property.setDaysLeft(Integer.parseInt(inputDaysLeft));
property.setType(inputType.equals("A") ? ALBUM_A : inputType.equals("B") ? ALBUM_B : ALBUM_C);
write(property);
-
+ return;
+ }
+
+ private static void write(AlbumCycleDefinitionProperty property) {
+ ObjectWriter writer = new ObjectMapper().writer(new DefaultPrettyPrinter());
+ try {
+ writer.writeValue(Paths.get(CYCLEPATH).toFile(), writer);
+ } catch (IOException e) {
+ // TODO 自動生成された catch ブロック
+ e.printStackTrace();
+ }
}
}
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import javax.swing.JOptionPane;
.timeout(0)
.get();
Elements rows = document.getElementsByTag("tbody").get(0).select("tr");
- ArrayList<ArrayList<Album>> typeLists = AlbumTypeEstimate.getAlbumType();
+ ArrayList<ArrayList<Album>> typeLists = typeFetchFuture.get();
for(int i = 0; i < rows.size(); i++) {
String attribute = rows.get(i).select("td").get(0).text();
String name = rows.get(i).select("td").get(1).text();
}
res.add(tmp);
}
- } catch (IOException e) {
+ } catch (IOException | InterruptedException | ExecutionException e) {
e.printStackTrace();
}
LimitedLog.println(Scraping.class + ":[INFO]: scraping compeleted in " + (System.currentTimeMillis() - time)+ "ms");