Fix names of Tokens in Android Image downloader.

This commit is contained in:
valfieri
2019-09-01 00:50:13 +02:00
parent dd785a872e
commit 0c4deea3ed
@@ -135,9 +135,13 @@ public class ImgDownloader {
return false; return false;
try { try {
URL url = new URL(imageurl); URL url = new URL(imageurl);
if (url == null) {
System.out.println("Warning: Problem fetching card: " + name + " (" + id + ".jpg) from " + imageurl + ", i will try with slow method...");
return false;
}
HttpURLConnection httpcon = (HttpURLConnection) url.openConnection(); HttpURLConnection httpcon = (HttpURLConnection) url.openConnection();
if (httpcon == null) { if (httpcon == null) {
System.err.println("Error: Problem fetching card: " + name + " (" + id + ".jpg) from " + imageurl + ", i will not download it..."); System.out.println("Warning: Problem fetching card: " + name + " (" + id + ".jpg) from " + imageurl + ", i will try with slow method...");
return false; return false;
} }
httpcon.addRequestProperty("User-Agent", "Mozilla/4.76"); httpcon.addRequestProperty("User-Agent", "Mozilla/4.76");
@@ -145,15 +149,15 @@ public class ImgDownloader {
try { try {
in = new BufferedInputStream(httpcon.getInputStream()); in = new BufferedInputStream(httpcon.getInputStream());
} catch (Exception ex) { } catch (Exception ex) {
System.err.println("Warning: Problem downloading card: " + name + " (" + id + ".jpg) from " + imageurl + ", i will retry 2 times more..."); System.out.println("Warning: Problem downloading card: " + name + " (" + id + ".jpg) from " + imageurl + ", i will retry 2 times more...");
try { try {
in = new BufferedInputStream(httpcon.getInputStream()); in = new BufferedInputStream(httpcon.getInputStream());
} catch (Exception ex2) { } catch (Exception ex2) {
System.err.println("Warning: Problem downloading card: " + name + " (" + id + ".jpg) from " + imageurl + ", i will retry 1 time more..."); System.out.println("Warning: Problem downloading card: " + name + " (" + id + ".jpg) from " + imageurl + ", i will retry 1 time more...");
try { try {
in = new BufferedInputStream(httpcon.getInputStream()); in = new BufferedInputStream(httpcon.getInputStream());
} catch (Exception ex3) { } catch (Exception ex3) {
System.err.println("Error: Problem downloading card: " + name + " (" + id + ".jpg) from " + imageurl + ", i will not retry anymore..."); System.out.println("Warning: Problem downloading card: " + name + " (" + id + ".jpg) from " + imageurl + ", i will try with slow method...");
return false; return false;
} }
} }
@@ -161,23 +165,49 @@ public class ImgDownloader {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buf = new byte[1024]; byte[] buf = new byte[1024];
int n = 0; int n = 0;
while (-1 != (n = in.read(buf))) { long millis = System.currentTimeMillis();
boolean timeout = false;
while (-1 != (n = in.read(buf)) && !timeout) {
out.write(buf, 0, n); out.write(buf, 0, n);
if (System.currentTimeMillis() - millis > 10000)
timeout = true;
}
if (timeout) {
System.out.println("Warning: Timeout downloading token: " + id + "t.jpg from " + imageurl + ", i will retry 2 times more...");
buf = new byte[1024];
n = 0;
millis = System.currentTimeMillis();
timeout = false;
while (-1 != (n = in.read(buf)) && !timeout) {
out.write(buf, 0, n);
if (System.currentTimeMillis() - millis > 10000)
timeout = true;
}
if (timeout) {
System.out.println("Warning: Timeout downloading token: " + id + "t.jpg from " + imageurl + ", i will retry 1 time more...");
buf = new byte[1024];
n = 0;
millis = System.currentTimeMillis();
timeout = false;
while (-1 != (n = in.read(buf)) && !timeout) {
out.write(buf, 0, n);
if (System.currentTimeMillis() - millis > 10000)
timeout = true;
}
if (timeout) {
System.out.println("Warning: Timeout downloading token: " + id + "t.jpg from " + imageurl + ", i will try with slow method...");
return false;
}
}
} }
out.close(); out.close();
in.close(); in.close();
byte[] response = out.toByteArray(); byte[] response = out.toByteArray();
String cardimage = imgPath + File.separator + id + ".jpg"; String cardimage = imgPath + File.separator + id + ".jpg";
String thumbcardimage = thumbPath + File.separator + id + ".jpg"; String thumbcardimage = thumbPath + File.separator + id + ".jpg";
if (id.equals("11492111") || id.equals("11492112") || id.equals("11492113") ||
id.equals("11492114") || id.equals("11492115")) {
cardimage = imgPath + File.separator + id + "t.jpg";
thumbcardimage = thumbPath + File.separator + id + "t.jpg";
}
FileOutputStream fos = new FileOutputStream(cardimage); FileOutputStream fos = new FileOutputStream(cardimage);
fos.write(response); fos.write(response);
fos.close(); fos.close();
Bitmap yourBitmap = BitmapFactory.decodeFile(cardimage); Bitmap yourBitmap = BitmapFactory.decodeFile(cardimage);
Bitmap resized = Bitmap.createScaledBitmap(yourBitmap, ImgX, ImgY, true); Bitmap resized = Bitmap.createScaledBitmap(yourBitmap, ImgX, ImgY, true);
try { try {
@@ -194,7 +224,7 @@ public class ImgDownloader {
e.printStackTrace(); e.printStackTrace();
} }
} catch (Exception e) { } catch (Exception e) {
System.err.println("Error: Problem fetching card: " + name + " (" + id + ".jpg) from " + imageurl + ", i will not download it..."); System.out.println("Warning: Problem fetching card: " + name + " (" + id + ".jpg) from " + imageurl + ", i will try with slow method...");
return false; return false;
} }
imageurl = subdb.get(id + "t"); imageurl = subdb.get(id + "t");
@@ -202,9 +232,13 @@ public class ImgDownloader {
System.err.println("The card: " + name + " (" + id + ".jpg) can create a token, i will try to download that image too as " + id + "t.jpg"); System.err.println("The card: " + name + " (" + id + ".jpg) can create a token, i will try to download that image too as " + id + "t.jpg");
try { try {
URL url = new URL(imageurl); URL url = new URL(imageurl);
if (url == null) {
System.out.println("Warning: Problem fetching token: " + id + "t.jpg from " + imageurl + ", i will try with slow method...");
return false;
}
HttpURLConnection httpcon = (HttpURLConnection) url.openConnection(); HttpURLConnection httpcon = (HttpURLConnection) url.openConnection();
if (httpcon == null) { if (httpcon == null) {
System.err.println("Error: Problem fetching token: " + id + "t.jpg from " + imageurl + ", i will not download it..."); System.out.println("Warning: Problem fetching token: " + id + "t.jpg from " + imageurl + ", i will try with slow method...");
return false; return false;
} }
httpcon.addRequestProperty("User-Agent", "Mozilla/4.76"); httpcon.addRequestProperty("User-Agent", "Mozilla/4.76");
@@ -212,15 +246,15 @@ public class ImgDownloader {
try { try {
intoken = new BufferedInputStream(httpcon.getInputStream()); intoken = new BufferedInputStream(httpcon.getInputStream());
} catch (Exception ex) { } catch (Exception ex) {
System.err.println("Warning: Problem downloading token: " + id + "t.jpg from " + imageurl + ", i will retry 2 times more..."); System.out.println("Warning: Problem downloading token: " + id + "t.jpg from " + imageurl + ", i will retry 2 times more...");
try { try {
intoken = new BufferedInputStream(httpcon.getInputStream()); intoken = new BufferedInputStream(httpcon.getInputStream());
} catch (Exception ex2) { } catch (Exception ex2) {
System.err.println("Warning: Problem downloading token: " + id + "t.jpg from " + imageurl + ", i will retry 1 time more..."); System.out.println("Warning: Problem downloading token: " + id + "t.jpg from " + imageurl + ", i will retry 1 time more...");
try { try {
intoken = new BufferedInputStream(httpcon.getInputStream()); intoken = new BufferedInputStream(httpcon.getInputStream());
} catch (Exception ex3) { } catch (Exception ex3) {
System.err.println("Error: Problem downloading token: " + id + "t.jpg from " + imageurl + ", i will not retry anymore..."); System.out.println("Warning: Problem downloading token: " + id + "t.jpg from " + imageurl + ", i will try with slow method...");
return false; return false;
} }
} }
@@ -255,7 +289,7 @@ public class ImgDownloader {
e.printStackTrace(); e.printStackTrace();
} }
} catch (Exception e) { } catch (Exception e) {
System.err.println("Error: Problem fetching token: " + id + "t.jpg from " + imageurl + ", i will not download it..."); System.out.println("Warning: Problem fetching token: " + id + "t.jpg from " + imageurl + ", i will try with slow method...");
return false; return false;
} }
} }
@@ -350,25 +384,25 @@ public class ImgDownloader {
cardurl = "https://img.scryfall.com/cards/large/front/1/8/18b9c83d-4422-4b95-9fc2-070ed6b5bdf6.jpg?1562701921"; cardurl = "https://img.scryfall.com/cards/large/front/1/8/18b9c83d-4422-4b95-9fc2-070ed6b5bdf6.jpg?1562701921";
else if(id.equals("22010012t")) else if(id.equals("22010012t"))
cardurl = "https://img.scryfall.com/cards/large/front/8/4/84dc847c-7a37-4c7f-b02c-30b3e4c91fb6.jpg?1561757490"; cardurl = "https://img.scryfall.com/cards/large/front/8/4/84dc847c-7a37-4c7f-b02c-30b3e4c91fb6.jpg?1561757490";
else if(id.equals("8759611t")) else if(id.equals("8759611"))
cardurl = "https://img.scryfall.com/cards/large/front/4/1/41004bdf-8e09-4b2c-9e9c-26c25eac9854.jpg?1562493483"; cardurl = "https://img.scryfall.com/cards/large/front/4/1/41004bdf-8e09-4b2c-9e9c-26c25eac9854.jpg?1562493483";
else if(id.equals("8759911t")) else if(id.equals("8759911"))
cardurl = "https://img.scryfall.com/cards/large/front/0/b/0b61d772-2d8b-4acf-9dd2-b2e8b03538c8.jpg?1562492461"; cardurl = "https://img.scryfall.com/cards/large/front/0/b/0b61d772-2d8b-4acf-9dd2-b2e8b03538c8.jpg?1562492461";
else if(id.equals("8759511t")) else if(id.equals("8759511"))
cardurl = "https://img.scryfall.com/cards/large/front/d/2/d224c50f-8146-4c91-9401-04e5bd306d02.jpg?1562496100"; cardurl = "https://img.scryfall.com/cards/large/front/d/2/d224c50f-8146-4c91-9401-04e5bd306d02.jpg?1562496100";
else if(id.equals("8471611t")) else if(id.equals("8471611"))
cardurl = "https://img.scryfall.com/cards/large/front/8/4/84920a21-ee2a-41ac-a369-347633d10371.jpg?1562494702"; cardurl = "https://img.scryfall.com/cards/large/front/8/4/84920a21-ee2a-41ac-a369-347633d10371.jpg?1562494702";
else if(id.equals("8760011t")) else if(id.equals("8760011"))
cardurl = "https://img.scryfall.com/cards/large/front/4/2/42ba0e13-d20f-47f9-9c86-2b0b13c39ada.jpg?1562493487"; cardurl = "https://img.scryfall.com/cards/large/front/4/2/42ba0e13-d20f-47f9-9c86-2b0b13c39ada.jpg?1562493487";
else if(id.equals("7448911t")) else if(id.equals("7448911"))
cardurl = "https://img.scryfall.com/cards/large/front/c/a/ca03131a-9bd4-4fba-b95c-90f1831e86e7.jpg?1562879774"; cardurl = "https://img.scryfall.com/cards/large/front/c/a/ca03131a-9bd4-4fba-b95c-90f1831e86e7.jpg?1562879774";
else if(id.equals("7453611t")) else if(id.equals("7453611"))
cardurl = "https://img.scryfall.com/cards/large/front/7/3/73636ca0-2309-4bb3-9300-8bd0c0bb5b31.jpg?1562877808"; cardurl = "https://img.scryfall.com/cards/large/front/7/3/73636ca0-2309-4bb3-9300-8bd0c0bb5b31.jpg?1562877808";
else if(id.equals("7447611t")) else if(id.equals("7447611"))
cardurl = "https://img.scryfall.com/cards/large/front/2/8/28f72260-c8f9-4c44-92b5-23cef6690fdd.jpg?1562876119"; cardurl = "https://img.scryfall.com/cards/large/front/2/8/28f72260-c8f9-4c44-92b5-23cef6690fdd.jpg?1562876119";
else if(id.equals("7467111t")) else if(id.equals("7467111"))
cardurl = "https://img.scryfall.com/cards/large/front/1/f/1fe2b76f-ddb7-49d5-933b-ccb06be5d46f.jpg?1562875903"; cardurl = "https://img.scryfall.com/cards/large/front/1/f/1fe2b76f-ddb7-49d5-933b-ccb06be5d46f.jpg?1562875903";
else if(id.equals("7409311t")) else if(id.equals("7409311"))
cardurl = "https://img.scryfall.com/cards/large/front/7/5/758abd53-6ad2-406e-8615-8e48678405b4.jpg?1562877848"; cardurl = "https://img.scryfall.com/cards/large/front/7/5/758abd53-6ad2-406e-8615-8e48678405b4.jpg?1562877848";
else if(id.equals("3896122t")) else if(id.equals("3896122t"))
cardurl = "https://img.scryfall.com/cards/large/front/5/9/59a00cac-53ae-46ad-8468-e6d1db40b266.jpg?1562542382"; cardurl = "https://img.scryfall.com/cards/large/front/5/9/59a00cac-53ae-46ad-8468-e6d1db40b266.jpg?1562542382";
@@ -376,28 +410,30 @@ public class ImgDownloader {
cardurl = "https://img.scryfall.com/cards/large/front/5/b/5b9f471a-1822-4981-95a9-8923d83ddcbf.jpg?1562702075"; cardurl = "https://img.scryfall.com/cards/large/front/5/b/5b9f471a-1822-4981-95a9-8923d83ddcbf.jpg?1562702075";
else if(id.equals("3896523t")) else if(id.equals("3896523t"))
cardurl = "https://img.scryfall.com/cards/large/front/d/0/d0cd85cc-ad22-446b-8378-5eb69fee1959.jpg?1562840712"; cardurl = "https://img.scryfall.com/cards/large/front/d/0/d0cd85cc-ad22-446b-8378-5eb69fee1959.jpg?1562840712";
else if(id.equals("7897511t")) else if(id.equals("7897511"))
cardurl = "https://img.scryfall.com/cards/large/front/a/4/a4f4aa3b-c64a-4430-b1a2-a7fca87d0a22.jpg?1562763433"; cardurl = "https://img.scryfall.com/cards/large/front/a/4/a4f4aa3b-c64a-4430-b1a2-a7fca87d0a22.jpg?1562763433";
else if(id.equals("7868811t")) else if(id.equals("7868811"))
cardurl = "https://img.scryfall.com/cards/large/front/b/3/b3523b8e-065f-427c-8d5b-eb731ca91ede.jpg?1562763691"; cardurl = "https://img.scryfall.com/cards/large/front/b/3/b3523b8e-065f-427c-8d5b-eb731ca91ede.jpg?1562763691";
else if(id.equals("7868711t")) else if(id.equals("7868711"))
cardurl = "https://img.scryfall.com/cards/large/front/5/8/58164521-aeec-43fc-9db9-d595432dea6f.jpg?1564694999"; cardurl = "https://img.scryfall.com/cards/large/front/5/8/58164521-aeec-43fc-9db9-d595432dea6f.jpg?1564694999";
else if(id.equals("7868611t")) else if(id.equals("7868611"))
cardurl = "https://img.scryfall.com/cards/large/front/3/3/33a8e5b9-6bfb-4ff2-a16d-3168a5412807.jpg?1562758927"; cardurl = "https://img.scryfall.com/cards/large/front/3/3/33a8e5b9-6bfb-4ff2-a16d-3168a5412807.jpg?1562758927";
else if(id.equals("7869111t")) else if(id.equals("7869111"))
cardurl = "https://img.scryfall.com/cards/large/front/9/d/9de1eebf-5725-438c-bcf0-f3a4d8a89fb0.jpg?1562762993"; cardurl = "https://img.scryfall.com/cards/large/front/9/d/9de1eebf-5725-438c-bcf0-f3a4d8a89fb0.jpg?1562762993";
else if(id.equals("7860011t")) else if(id.equals("7860011"))
cardurl = "https://img.scryfall.com/cards/large/front/8/6/864ad989-19a6-4930-8efc-bbc077a18c32.jpg?1562762069"; cardurl = "https://img.scryfall.com/cards/large/front/8/6/864ad989-19a6-4930-8efc-bbc077a18c32.jpg?1562762069";
else if(id.equals("7867911t")) else if(id.equals("7867911"))
cardurl = "https://img.scryfall.com/cards/large/front/c/8/c8265c39-d287-4c5a-baba-f2f09dd80a1c.jpg?1562764226"; cardurl = "https://img.scryfall.com/cards/large/front/c/8/c8265c39-d287-4c5a-baba-f2f09dd80a1c.jpg?1562764226";
else if(id.equals("7867811t")) else if(id.equals("7867811"))
cardurl = "https://img.scryfall.com/cards/large/front/a/0/a00a7180-49bd-4ead-852a-67b6b5e4b933.jpg?1564694995"; cardurl = "https://img.scryfall.com/cards/large/front/a/0/a00a7180-49bd-4ead-852a-67b6b5e4b933.jpg?1564694995";
else if(id.equals("7869511t")) else if(id.equals("7869511"))
cardurl = "https://img.scryfall.com/cards/large/front/f/2/f2ddf1a3-e6fa-4dd0-b80d-1a585b51b934.jpg?1562765664"; cardurl = "https://img.scryfall.com/cards/large/front/f/2/f2ddf1a3-e6fa-4dd0-b80d-1a585b51b934.jpg?1562765664";
else if(id.equals("7869411t")) else if(id.equals("7869411"))
cardurl = "https://img.scryfall.com/cards/large/front/6/e/6ee6cd34-c117-4d7e-97d1-8f8464bfaac8.jpg?1562761096"; cardurl = "https://img.scryfall.com/cards/large/front/6/e/6ee6cd34-c117-4d7e-97d1-8f8464bfaac8.jpg?1562761096";
else if (id.equals("209163t")) else if (id.equals("209163t"))
cardurl = "https://img.scryfall.com/cards/large/front/a/3/a3ea39a8-48d1-4a58-8662-88841eabec92.jpg?1562925559"; cardurl = "https://img.scryfall.com/cards/large/front/a/3/a3ea39a8-48d1-4a58-8662-88841eabec92.jpg?1562925559";
else if (id.equals("111066t"))
cardurl = "https://img.scryfall.com/cards/large/front/a/7/a77c1ac0-5548-42b0-aa46-d532b3518632.jpg?1562578875";
else if (id.equals("2050322t")) else if (id.equals("2050322t"))
cardurl = "https://deckmaster.info/images/cards/M11/-239-hr.jpg"; cardurl = "https://deckmaster.info/images/cards/M11/-239-hr.jpg";
else if (id.equals("401721t")) else if (id.equals("401721t"))
@@ -440,6 +476,14 @@ public class ImgDownloader {
cardurl = "https://deckmaster.info/images/cards/DST/-2819-hr.jpg"; cardurl = "https://deckmaster.info/images/cards/DST/-2819-hr.jpg";
else if (id.equals("4977512t")) else if (id.equals("4977512t"))
cardurl = "https://deckmaster.info/images/cards/DST/-2818-hr.jpg"; cardurl = "https://deckmaster.info/images/cards/DST/-2818-hr.jpg";
else if (id.equals("111220t"))
cardurl = "https://deckmaster.info/images/cards/DIS/111220-hr.jpg";
else if (id.equals("383257t"))
cardurl = "https://deckmaster.info/images/cards/M15/-109-hr.jpg";
else if (id.equals("383290t"))
cardurl = "https://deckmaster.info/images/cards/M15/-108-hr.jpg";
else if (id.equals("74272"))
cardurl = "https://img.scryfall.com/cards/large/front/4/5/45af7f55-9a69-43dd-969f-65411711b13e.jpg?1562487939";
else if (id.equals("687701")) else if (id.equals("687701"))
cardurl = "https://deckmaster.info/images/cards/DKM/-2437-hr.jpg"; cardurl = "https://deckmaster.info/images/cards/DKM/-2437-hr.jpg";
else if (id.equals("687702")) else if (id.equals("687702"))
@@ -552,8 +596,122 @@ public class ImgDownloader {
cardurl = "https://deckmaster.info/images/cards/DKM/-3176-hr.jpg"; cardurl = "https://deckmaster.info/images/cards/DKM/-3176-hr.jpg";
else if (id.equals("687754")) else if (id.equals("687754"))
cardurl = "https://deckmaster.info/images/cards/DKM/-3184-hr.jpg"; cardurl = "https://deckmaster.info/images/cards/DKM/-3184-hr.jpg";
else if (id.equals("242498"))
cardurl = "https://deckmaster.info/images/cards/DKA/242498-hr.jpg";
else if (id.equals("253431"))
cardurl = "https://deckmaster.info/images/cards/DKA/253431-hr.jpg";
else if (id.equals("262659"))
cardurl = "https://deckmaster.info/images/cards/DKA/262659-hr.jpg";
else if (id.equals("262698"))
cardurl = "https://deckmaster.info/images/cards/DKA/262698-hr.jpg";
else if (id.equals("244734"))
cardurl = "https://deckmaster.info/images/cards/DKA/244734-hr.jpg";
else if (id.equals("244712"))
cardurl = "https://deckmaster.info/images/cards/DKA/244712-hr.jpg";
else if (id.equals("227405"))
cardurl = "https://deckmaster.info/images/cards/DKA/227405-hr.jpg";
else if (id.equals("247122"))
cardurl = "https://deckmaster.info/images/cards/DKA/247122-hr.jpg";
else if (id.equals("244738"))
cardurl = "https://deckmaster.info/images/cards/DKA/244738-hr.jpg";
else if (id.equals("253429"))
cardurl = "https://deckmaster.info/images/cards/DKA/253429-hr.jpg";
else if (id.equals("242509"))
cardurl = "https://deckmaster.info/images/cards/DKA/242509-hr.jpg";
else if (id.equals("414422"))
cardurl = "https://deckmaster.info/images/cards/EMN/414422-hr.jpg";
else if (id.equals("414325"))
cardurl = "https://deckmaster.info/images/cards/EMN/414325-hr.jpg";
else if (id.equals("414347"))
cardurl = "https://deckmaster.info/images/cards/EMN/414347-hr.jpg";
else if (id.equals("414392"))
cardurl = "https://deckmaster.info/images/cards/EMN/414392-hr.jpg";
else if (id.equals("414305"))
cardurl = "https://deckmaster.info/images/cards/EMN/414305-hr.jpg";
else if (id.equals("414500"))
cardurl = "https://deckmaster.info/images/cards/EMN/414500-hr.jpg";
else if (id.equals("414471"))
cardurl = "https://deckmaster.info/images/cards/EMN/414471-hr.jpg";
else if (id.equals("414480"))
cardurl = "https://deckmaster.info/images/cards/EMN/414480-hr.jpg";
else if (id.equals("414449"))
cardurl = "https://deckmaster.info/images/cards/EMN/414449-hr.jpg";
else if (id.equals("414514"))
cardurl = "https://deckmaster.info/images/cards/EMN/414514-hr.jpg";
else if (id.equals("414497"))
cardurl = "https://deckmaster.info/images/cards/EMN/414497-hr.jpg";
else if (id.equals("414478"))
cardurl = "https://deckmaster.info/images/cards/EMN/414478-hr.jpg";
else if (id.equals("414442"))
cardurl = "https://deckmaster.info/images/cards/EMN/414442-hr.jpg";
else if (id.equals("414358"))
cardurl = "https://deckmaster.info/images/cards/EMN/414358-hr.jpg";
else if (id.equals("414408"))
cardurl = "https://deckmaster.info/images/cards/EMN/414408-hr.jpg";
else if (id.equals("414465"))
cardurl = "https://deckmaster.info/images/cards/EMN/414465-hr.jpg";
else if (id.equals("227290"))
cardurl = "https://deckmaster.info/images/cards/ISD/227290-hr.jpg";
else if (id.equals("244687"))
cardurl = "https://deckmaster.info/images/cards/ISD/244687-hr.jpg";
else if (id.equals("222123"))
cardurl = "https://deckmaster.info/images/cards/ISD/222123-hr.jpg";
else if (id.equals("222906"))
cardurl = "https://deckmaster.info/images/cards/ISD/222906-hr.jpg";
else if (id.equals("227419"))
cardurl = "https://deckmaster.info/images/cards/ISD/227419-hr.jpg";
else if (id.equals("226755"))
cardurl = "https://deckmaster.info/images/cards/ISD/226755-hr.jpg";
else if (id.equals("221190"))
cardurl = "https://deckmaster.info/images/cards/ISD/221190-hr.jpg";
else if (id.equals("222115"))
cardurl = "https://deckmaster.info/images/cards/ISD/222115-hr.jpg";
else if (id.equals("222183"))
cardurl = "https://deckmaster.info/images/cards/ISD/222183-hr.jpg";
else if (id.equals("222114"))
cardurl = "https://deckmaster.info/images/cards/ISD/222114-hr.jpg";
else if (id.equals("222117"))
cardurl = "https://deckmaster.info/images/cards/ISD/222117-hr.jpg";
else if (id.equals("221222"))
cardurl = "https://deckmaster.info/images/cards/ISD/221222-hr.jpg";
else if (id.equals("222107"))
cardurl = "https://deckmaster.info/images/cards/ISD/222107-hr.jpg";
else if (id.equals("221185"))
cardurl = "https://deckmaster.info/images/cards/ISD/221185-hr.jpg";
else if (id.equals("221173"))
cardurl = "https://deckmaster.info/images/cards/ISD/221173-hr.jpg";
else if (id.equals("222108"))
cardurl = "https://deckmaster.info/images/cards/ISD/222108-hr.jpg";
else if (id.equals("221215"))
cardurl = "https://deckmaster.info/images/cards/ISD/221215-hr.jpg";
else if (id.equals("227090"))
cardurl = "https://deckmaster.info/images/cards/ISD/227090-hr.jpg";
else if (id.equals("398442"))
cardurl = "https://deckmaster.info/images/cards/ORI/398442-hr.jpg";
else if (id.equals("398423"))
cardurl = "https://deckmaster.info/images/cards/ORI/398423-hr.jpg";
else if (id.equals("398435"))
cardurl = "https://deckmaster.info/images/cards/ORI/398435-hr.jpg";
else if (id.equals("398429"))
cardurl = "https://deckmaster.info/images/cards/ORI/398429-hr.jpg";
else if (id.equals("439843"))
cardurl = "https://deckmaster.info/images/cards/RIX/439843-hr.jpg";
else if (id.equals("439835"))
cardurl = "https://deckmaster.info/images/cards/RIX/439835-hr.jpg";
else if (id.equals("439825"))
cardurl = "https://deckmaster.info/images/cards/RIX/439825-hr.jpg";
else if (id.equals("439839"))
cardurl = "https://deckmaster.info/images/cards/RIX/439839-hr.jpg";
else if (id.equals("439827"))
cardurl = "https://deckmaster.info/images/cards/RIX/439827-hr.jpg";
else if (id.equals("439816"))
cardurl = "https://deckmaster.info/images/cards/RIX/439816-hr.jpg";
else if (id.equals("439819"))
cardurl = "https://deckmaster.info/images/cards/RIX/439819-hr.jpg";
else if (id.equals("439454")) else if (id.equals("439454"))
cardurl = "https://deckmaster.info/images/cards/UST/439454-hr.jpg"; cardurl = "https://deckmaster.info/images/cards/UST/439454-hr.jpg";
else if (id.equals("435451"))
cardurl = "https://deckmaster.info/images/cards/XLN/-5173-hr.jpg";
return cardurl; return cardurl;
} }
@@ -687,6 +845,8 @@ public class ImgDownloader {
tokenurl = "https://deckmaster.info/images/cards/XLN/-5173-hr.jpg"; tokenurl = "https://deckmaster.info/images/cards/XLN/-5173-hr.jpg";
else if (id.equals("1686t") || id.equals("2881t") || id.equals("201231t")) else if (id.equals("1686t") || id.equals("2881t") || id.equals("201231t"))
tokenurl = "https://deckmaster.info/images/cards/A25/-5648-hr.jpg"; tokenurl = "https://deckmaster.info/images/cards/A25/-5648-hr.jpg";
else if (id.equals("439843t"))
tokenurl = "https://deckmaster.info/images/cards/RIX/-5473-hr.jpg";
else if (id.equals("452760t")) else if (id.equals("452760t"))
tokenurl = "https://deckmaster.info/images/cards/M19/-6036.jpg"; tokenurl = "https://deckmaster.info/images/cards/M19/-6036.jpg";
else if (id.equals("89110t")) else if (id.equals("89110t"))
@@ -794,6 +954,8 @@ public class ImgDownloader {
tokenurl = "https://static.cardmarket.com/img/5a0199344cad68eebeefca6fa24e52c3/items/1/MH1/376905.jpg"; tokenurl = "https://static.cardmarket.com/img/5a0199344cad68eebeefca6fa24e52c3/items/1/MH1/376905.jpg";
else if (id.equals("430686t")) else if (id.equals("430686t"))
tokenurl = "https://cdn.shopify.com/s/files/1/1601/3103/products/Token_45_2000x.jpg?v=1528922847"; tokenurl = "https://cdn.shopify.com/s/files/1/1601/3103/products/Token_45_2000x.jpg?v=1528922847";
else if (id.equals("405191t"))
tokenurl = "https://6d4be195623157e28848-7697ece4918e0a73861de0eb37d08968.ssl.cf1.rackcdn.com/108181_200w.jpg";
return tokenurl; return tokenurl;
} }
@@ -1111,17 +1273,27 @@ public class ImgDownloader {
String rarity = null; String rarity = null;
String primitive = null; String primitive = null;
int a = lines.indexOf("primitive=", lastIndex); int a = lines.indexOf("primitive=", lastIndex);
if (a > 0) if (a > 0) {
if (lines.substring(a, lines.indexOf("\n", a)).replace("//", "-").split("=").length > 1)
primitive = lines.substring(a, lines.indexOf("\n", a)).replace("//", "-").split("=")[1]; primitive = lines.substring(a, lines.indexOf("\n", a)).replace("//", "-").split("=")[1];
}
int b = lines.indexOf("id=", lastIndex); int b = lines.indexOf("id=", lastIndex);
if (b > 0) if (b > 0) {
if (lines.substring(b, lines.indexOf("\n", b)).replace("-", "").split("=").length > 1)
id = lines.substring(b, lines.indexOf("\n", b)).replace("-", "").split("=")[1]; id = lines.substring(b, lines.indexOf("\n", b)).replace("-", "").split("=")[1];
}
int d = lines.indexOf("rarity=", lastIndex); int d = lines.indexOf("rarity=", lastIndex);
if(d > 0) if (d > 0) {
if (lines.substring(d, lines.indexOf("\n", d)).split("=").length > 1)
rarity = lines.substring(d, lines.indexOf("\n", d)).split("=")[1].toLowerCase(); rarity = lines.substring(d, lines.indexOf("\n", d)).split("=")[1].toLowerCase();
if(rarity == null || !rarity.equals("t")) }
if (rarity == null || !rarity.equals("t") || set.equals("DKA") || set.equals("EMN") ||
set.equals("ISD") || set.equals("ORI") || set.equals("RIX") || set.equals("V17") ||
set.equals("UNH") || set.equals("XLN") || set.equals("SOI") || set.equals("SOK") ||
set.equals("BOK") || set.equals("CHK"))
rarity = ""; rarity = "";
if(id != null && (id.equals("209162") || id.equals("209163") || id.equals("401721") || id.equals("401722"))) if(id != null && (id.equals("262857") || id.equals("209162") || id.equals("209163") || id.equals("401721") ||
id.equals("401722") || id.equals("75291")))
rarity = "t"; rarity = "t";
int c = lines.indexOf("[/card]", lastIndex); int c = lines.indexOf("[/card]", lastIndex);
if (c > 0) if (c > 0)
@@ -1267,15 +1439,9 @@ public class ImgDownloader {
byte[] response = out.toByteArray(); byte[] response = out.toByteArray();
String cardimage = imgPath + File.separator + id + ".jpg"; String cardimage = imgPath + File.separator + id + ".jpg";
String thumbcardimage = thumbPath + File.separator + id + ".jpg"; String thumbcardimage = thumbPath + File.separator + id + ".jpg";
if (id.equals("11492111") || id.equals("11492112") || id.equals("11492113") ||
id.equals("11492114") || id.equals("11492115")) {
cardimage = imgPath + File.separator + id + "t.jpg";
thumbcardimage = thumbPath + File.separator + id + "t.jpg";
}
FileOutputStream fos = new FileOutputStream(cardimage); FileOutputStream fos = new FileOutputStream(cardimage);
fos.write(response); fos.write(response);
fos.close(); fos.close();
Bitmap yourBitmap = BitmapFactory.decodeFile(cardimage); Bitmap yourBitmap = BitmapFactory.decodeFile(cardimage);
Bitmap resized = Bitmap.createScaledBitmap(yourBitmap, ImgX, ImgY, true); Bitmap resized = Bitmap.createScaledBitmap(yourBitmap, ImgX, ImgY, true);
try { try {
@@ -1339,7 +1505,7 @@ public class ImgDownloader {
if (!parent.downloadInProgress) if (!parent.downloadInProgress)
break; break;
if (scryset.equals("UST") || scryset.equals("S00")) { if (scryset.equals("UST") || scryset.equals("S00") || scryset.equals("V17") || scryset.equals("XLN") || scryset.equals("SOI")) {
cardname = cardname.replace(" (a)", ""); cardname = cardname.replace(" (a)", "");
cardname = cardname.replace(" (b)", ""); cardname = cardname.replace(" (b)", "");
cardname = cardname.replace(" (c)", ""); cardname = cardname.replace(" (c)", "");