mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Already downloaded image files are moved to the zip file.
This commit is contained in:
parent
6a5b656419
commit
ff77767098
1 changed files with 15 additions and 1 deletions
|
@ -440,6 +440,21 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
public void run() {
|
||||
try {
|
||||
File temporaryFile = new File(Constants.IO.imageBaseDir + File.separator + card.hashCode() + "." + card.getName() + ".jpg");
|
||||
String imagePath = CardImageUtils.getImagePath(card, imagesPath);
|
||||
TFile outputFile = new TFile(imagePath);
|
||||
File existingFile = new File(imagePath.replaceFirst("\\w{3}.zip", ""));
|
||||
if (existingFile.exists()) {
|
||||
new TFile(existingFile).cp_rp(outputFile);
|
||||
synchronized (sync) {
|
||||
update(cardIndex + 1);
|
||||
}
|
||||
existingFile.delete();
|
||||
File parent = existingFile.getParentFile();
|
||||
if (parent != null && parent.isDirectory() && parent.list().length == 0) {
|
||||
parent.delete();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
BufferedInputStream in = new BufferedInputStream(url.openConnection(p).getInputStream());
|
||||
BufferedOutputStream out = new BufferedOutputStream(new TFileOutputStream(temporaryFile));
|
||||
|
@ -462,7 +477,6 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
out.flush();
|
||||
out.close();
|
||||
|
||||
TFile outputFile = new TFile(CardImageUtils.getImagePath(card, imagesPath));
|
||||
if (card.isTwoFacedCard()) {
|
||||
BufferedImage image = ImageIO.read(temporaryFile);
|
||||
if (image.getHeight() == 470) {
|
||||
|
|
Loading…
Reference in a new issue