private JButton findMarket = null;
private JLabel resultSummary = null;
private JLabel arbitrageResult = null;
+ private int unknownPCTBcommods = 0;
private long startTime = 0;
private final static String PCTB_LIVE_HOST_URL = "http://pctb.crabdance.com/";
strm.close();
}
+ private void debug_write_bytes(String what, byte[] data) throws FileNotFoundException,IOException {
+ if (dtxt==null) return;
+ FileOutputStream strm = new FileOutputStream(new File("jarrg-debug-"+what));
+ strm.write(data);
+ strm.close();
+ }
+
private void progressNote(ProgressMonitor pm, String s) {
String arb = null;
if (arbitrageResult != null)
startTime = new Date().getTime();
resultSummary.setText("");
arbitrageResult.setText("");
+ unknownPCTBcommods = 0;
try {
runUpload();
} catch(Exception e) {
progressNote(pm, "Yarrg: Uploading");
progresslog("yarrg upload...");
- debug_write_stringdata("yarrg-deduped.tsv", yarrgdata);
-
doneyarrg = runYarrg(yarrgts, oceanName, islandName, yarrgdata);
progresslog("yarrg done.");
}
progresslog("pctb send...");
byte[] ba = outStream.toByteArray();
- if (dtxt!=null) {
- FileOutputStream dbgdata = new FileOutputStream(new File("jarrg-debug-pctb-marketdata.gz"));
- dbgdata.write(ba);
- dbgdata.close();
- }
+ debug_write_bytes("pctb-marketdata.gz", ba);
InputStream in = sendInitialData(new ByteArrayInputStream(ba));
progresslog("pctb sent.");
if ((uploadToPCTB && !donepctb) ||
(uploadToYarrg && !doneyarrg)) {
resultSummary.setText("trouble");
+ } else if (unknownPCTBcommods != 0) {
+ resultSummary.setText("PCTB lacks "+unknownPCTBcommods+" commod");
} else if (donepctb || doneyarrg) {
resultSummary.setText("Done " + islandName);
} else {
buySellCount[1]++;
}
} catch(IllegalArgumentException e) {
+ unknownPCTBcommods++;
if (dtxt!=null) dtxt.println("Error: Unsupported Commodity \"" + offer.get(0) + "\"");
}
}
BufferedOutputStream bufos = new BufferedOutputStream(new GZIPOutputStream(bos));
bufos.write(yarrgdata.getBytes() );
bufos.close();
- ByteArrayInputStream file = new ByteArrayInputStream(bos.toByteArray());
+ byte[] compressed = bos.toByteArray();
+ debug_write_bytes("yarrg-deduped.tsv.gz", compressed);
+ ByteArrayInputStream file = new ByteArrayInputStream(compressed);
ClientHttpRequest http = new ClientHttpRequest (YARRG_URL);
http.setParameter("clientname", YARRG_CLIENTNAME);