55import java .util .Currency ;
66import java .util .List ;
77
8- import org .apache .http .client .methods .HttpRequestBase ;
98import org .api .manapool .listener .URLCallInfo ;
109import org .api .manapool .model .EnumCondition ;
1110import org .api .manapool .model .EnumFinish ;
@@ -67,10 +66,10 @@ public void exportStock(List<MTGCardStock> stock, File f) throws IOException {
6766 var inventoryManager = new ManaPoolAPIService (getAuthenticator ().get ("EMAIL" ), getAuthenticator ().get ("TOKEN" ));
6867 inventoryManager .getClient ().setCallListener ((URLCallInfo callInfo )->{
6968 var netinfo = new NetworkInfo ();
70- netinfo .setEnd (callInfo .getEnd ());
71- netinfo .setStart (callInfo .getStart ());
72- netinfo .setRequest (( HttpRequestBase ) callInfo .getRequest ());
73- netinfo .setReponse (callInfo .getResponse ());
69+ netinfo .setStart (callInfo .getStart ());
70+ netinfo .setEnd (callInfo .getEnd ());
71+ netinfo .setRequest (callInfo .getRequest ());
72+ netinfo .setReponse (callInfo .getResponse ());
7473
7574 AbstractTechnicalServiceManager .inst ().store (netinfo );
7675
@@ -88,27 +87,33 @@ public void exportStock(List<MTGCardStock> stock, File f) throws IOException {
8887 item .setPrice (mcs .getValue ().doubleValue ());
8988
9089 try {
91- item .setCondition ( EnumCondition .valueOf (aliases .getConditionFor (this , mcs .getCondition ())));
90+ item .setCondition (EnumCondition .valueOf (aliases .getConditionFor (this , mcs .getCondition ())));
9291 }
9392 catch (IllegalArgumentException _)
9493 {
9594 logger .warn ("EnumCondition {} is not found" ,mcs .getCondition ().name () );
9695 item .setCondition (EnumCondition .NM );
9796 }
9897 item .setFinishId (mcs .isFoil ()?EnumFinish .FO :EnumFinish .NF );
99- item .setLanguage (EnumLangages .FR );
10098
99+ if (mcs .isEtched ())
100+ item .setFinishId (EnumFinish .EF );
101+
102+ var lcode = mcs .getLanguage ().toUpperCase ().substring (0 ,2 );
103+ try {
104+ item .setLanguage (EnumLangages .valueOf (lcode ));
105+ }
106+ catch (Exception e )
107+ {
108+ logger .warn ("EnumLangage not found for {}" , lcode );
109+ item .setLanguage (EnumLangages .EN );
110+ }
111+
112+ notify (mcs .getProduct ());
101113 return item ;
102114 }).toList ();
103115
104-
105-
106- inventoryManager .addInventoryItems (items ).forEach (e ->{
107- logger .info (e .getId ());
108- });;
109-
110-
111-
116+ inventoryManager .addInventoryItems (items );
112117
113118 }
114119
0 commit comments