use of org.magic.api.beans.MagicPrice in project MtgDesktopCompanion by nicho92.
the class CardKingdomPricer method getPrice.
public List<MagicPrice> getPrice(MagicEdition me, MagicCard card) throws IOException {
list.clear();
String html = getString("URL");
if (me == null)
me = card.getEditions().get(0);
String url = html + format(findGoodEds(me.getSet())) + "/" + format(card.getName());
Elements prices = null;
Elements qualities = null;
logger.info(getName() + " looking for prices " + url);
try {
doc = Jsoup.connect(url).userAgent(getString("USER_AGENT")).timeout(0).get();
qualities = doc.select(".cardTypeList li");
prices = doc.select(".stylePrice");
} catch (Exception e) {
logger.info(getName() + " no item : " + e.getMessage());
return list;
}
List<MagicPrice> lstPrices = new ArrayList<>();
for (int i = 0; i < qualities.size(); i++) {
MagicPrice mp = new MagicPrice();
String price = prices.get(i).html().replaceAll("\\$", "");
mp.setValue(Double.parseDouble(price));
mp.setCurrency("$");
mp.setSeller("Card Kingdom");
mp.setSite(getName());
mp.setUrl(url);
mp.setQuality(qualities.get(i).html());
mp.setLanguage("English");
if (!qualities.get(i).hasClass("disabled"))
lstPrices.add(mp);
}
logger.info(getName() + " found " + lstPrices.size() + " item(s)");
return lstPrices;
}
use of org.magic.api.beans.MagicPrice in project MtgDesktopCompanion by nicho92.
the class DeckTutorPricer method alertDetected.
@Override
public void alertDetected(List<MagicPrice> p) {
if (getString("AUTOMATIC_ADD_CARD_ALERT").equals("true")) {
for (MagicPrice mtgprice : p) {
String code = "";
String price = "";
String quantity = "";
HttpPost reqSearch = new HttpPost(getString("URL") + "/carts/updateInsertion");
}
}
}
Aggregations