mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
buildfix for VerifyCardDataTest. mtgjson file was moved, added a few fields, and requires adding a User-Agent to the request.
This commit is contained in:
parent
ad7ca19b56
commit
3d15325448
3 changed files with 8 additions and 1 deletions
|
@ -47,4 +47,7 @@ class JsonCard {
|
|||
public List<String> variations;
|
||||
public String watermark;
|
||||
public String tcgplayerProductId;
|
||||
public String scryfallId;
|
||||
public boolean isAlternative;
|
||||
public String frameEffect;
|
||||
}
|
||||
|
|
|
@ -20,4 +20,5 @@ public class JsonToken {
|
|||
public String uuid;
|
||||
public String watermark;
|
||||
public boolean isOnlineOnly;
|
||||
public String scryfallId;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.io.FileInputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.text.Normalizer;
|
||||
|
@ -120,7 +121,9 @@ public final class MtgJson {
|
|||
if (stream == null) {
|
||||
File file = new File(filename);
|
||||
if (!file.exists()) {
|
||||
InputStream download = new URL("http://mtgjson.com/v4/json/" + filename).openStream();
|
||||
URLConnection connection = new URL("https://mtgjson.com/json/" + filename).openConnection();
|
||||
connection.setRequestProperty("user-agent", "xmage");
|
||||
InputStream download = connection.getInputStream();
|
||||
Files.copy(download, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
System.out.println("Downloaded " + filename + " to " + file.getAbsolutePath());
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue