mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
download: reworked scryfall images support:
- download: fixed unmount zip errors on cancel download in some use cases (closes #12536); - download: significant download speed improvements (now it depends on user's network speed, not api limitations); - download: added additional error dialogs on bad use cases; - scryfall: added cards and bulk data api support; - scryfall: added bulk data download (updates once per week, contains all scryfall cards and store in images\downloading folder, 2 GB size); - scryfall: added optimized images download without api usage (use direct images links from bulk data, closes #11576); - scryfall: improved image source searching for some use cases (miss or wrong images problems, closes #12511); - scryfall: tokens don't use bulk data; - scryfall: 75k small images downloads 40 minutes and takes 1 GB and 2100 api calls (most of it from tokens); - scryfall: how-to disable bulk data, e.g. for api testing: -Dxmage.scryfallEnableBulkData=false
This commit is contained in:
parent
46f7304692
commit
0a55e37c8c
19 changed files with 884 additions and 216 deletions
|
|
@ -9,13 +9,14 @@ import net.xeoh.plugins.base.annotations.meta.Author;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
|
||||
/**
|
||||
* Implementation of {@link CounterPlugin}.<br/>
|
||||
* Stores data in data folder.
|
||||
*
|
||||
* @version 0.1 14.11.2010 Initial Version
|
||||
* Stores data in data folder.
|
||||
*
|
||||
* @author nantuko
|
||||
* @version 0.1 14.11.2010 Initial Version
|
||||
*/
|
||||
@PluginImplementation
|
||||
@Author(name = "nantuko")
|
||||
|
|
@ -69,11 +70,11 @@ public class CounterPluginImpl implements CounterPlugin {
|
|||
if (data.exists()) {
|
||||
int prev = 0;
|
||||
|
||||
try(ObjectInputStream ois = new ObjectInputStream(new FileInputStream(data))) {
|
||||
try (ObjectInputStream ois = new ObjectInputStream(Files.newInputStream(data.toPath()))) {
|
||||
Object o = ois.readObject();
|
||||
CounterBean c;
|
||||
if (o instanceof CounterBean) {
|
||||
c = (CounterBean)o;
|
||||
c = (CounterBean) o;
|
||||
prev = c.getGamesPlayed();
|
||||
}
|
||||
} catch (EOFException e) {
|
||||
|
|
@ -84,10 +85,10 @@ public class CounterPluginImpl implements CounterPlugin {
|
|||
throw new PluginException(e);
|
||||
}
|
||||
|
||||
try(ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(data))) {
|
||||
try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(data))) {
|
||||
synchronized (this) {
|
||||
CounterBean c = new CounterBean();
|
||||
c.setGamesPlayed(prev+1);
|
||||
c.setGamesPlayed(prev + 1);
|
||||
oos.writeObject(c);
|
||||
oos.close();
|
||||
}
|
||||
|
|
@ -107,12 +108,12 @@ public class CounterPluginImpl implements CounterPlugin {
|
|||
return 0;
|
||||
}
|
||||
if (data.exists()) {
|
||||
try(ObjectInputStream ois = new ObjectInputStream(new FileInputStream(data))) {
|
||||
try (ObjectInputStream ois = new ObjectInputStream(Files.newInputStream(data.toPath()))) {
|
||||
synchronized (this) {
|
||||
Object o = ois.readObject();
|
||||
CounterBean c = null;
|
||||
if (o instanceof CounterBean) {
|
||||
c = (CounterBean)o;
|
||||
c = (CounterBean) o;
|
||||
}
|
||||
ois.close();
|
||||
return c == null ? 0 : c.getGamesPlayed();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue