mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Removed MtgatheringRuImageSource
This commit is contained in:
parent
6b895d90cf
commit
9b10053e11
2 changed files with 1 additions and 94 deletions
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.mage.plugins.card.dl.sources;
|
||||
|
||||
import org.mage.plugins.card.utils.CardImageUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class MtgatheringRuImageSource implements CardImageSource {
|
||||
|
||||
private static CardImageSource hqInstance;
|
||||
private static CardImageSource mqInstance;
|
||||
private static CardImageSource lqInstance;
|
||||
private static final Map setsAliases;
|
||||
|
||||
static {
|
||||
setsAliases = new HashMap();
|
||||
setsAliases.put("M11", "magic2011");
|
||||
}
|
||||
private String quality;
|
||||
|
||||
public static CardImageSource getHqInstance() {
|
||||
if (hqInstance == null) {
|
||||
hqInstance = new MtgatheringRuImageSource("hq");
|
||||
}
|
||||
return hqInstance;
|
||||
}
|
||||
|
||||
public static CardImageSource getMqInstance() {
|
||||
if (mqInstance == null) {
|
||||
mqInstance = new MtgatheringRuImageSource("md");
|
||||
}
|
||||
return mqInstance;
|
||||
}
|
||||
|
||||
public static CardImageSource getLqInstance() {
|
||||
if (lqInstance == null) {
|
||||
lqInstance = new MtgatheringRuImageSource("lq");
|
||||
}
|
||||
return lqInstance;
|
||||
}
|
||||
|
||||
public MtgatheringRuImageSource(String quality) {
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateURL(Integer collectorId, String cardName, String cardSet, boolean twoFacedCard, boolean secondSide, boolean isFlipCard) throws Exception {
|
||||
if (collectorId == null || cardSet == null) {
|
||||
throw new Exception("Wrong parameters for image: collector id: " + collectorId + ",card set: " + cardSet);
|
||||
}
|
||||
if (setsAliases.get(cardSet) != null) {
|
||||
String set = CardImageUtils.updateSet(cardSet, true);
|
||||
String url = "http://mtgathering.ru/scans/en/";
|
||||
url += set.toLowerCase() + "/" + quality + "/" + collectorId + ".jpg";
|
||||
return url;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateTokenUrl(String name, String set) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float getAverageSize() {
|
||||
if(quality.equalsIgnoreCase("hq"))
|
||||
return 80.0f;
|
||||
if(quality.equalsIgnoreCase("md"))
|
||||
return 30.0f;
|
||||
if(quality.equalsIgnoreCase("lq"))
|
||||
return 9.0f;
|
||||
return 0f;
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,6 @@ import org.apache.log4j.Logger;
|
|||
import org.mage.plugins.card.constants.Constants;
|
||||
import org.mage.plugins.card.dl.sources.CardImageSource;
|
||||
import org.mage.plugins.card.dl.sources.MagicCardsImageSource;
|
||||
import org.mage.plugins.card.dl.sources.MtgatheringRuImageSource;
|
||||
import org.mage.plugins.card.dl.sources.WizardCardsImageSource;
|
||||
import org.mage.plugins.card.properties.SettingsManager;
|
||||
import org.mage.plugins.card.utils.CardImageUtils;
|
||||
|
|
@ -147,15 +146,6 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
case 1:
|
||||
cardImageSource = WizardCardsImageSource.getInstance();
|
||||
break;
|
||||
case 2:
|
||||
cardImageSource = MtgatheringRuImageSource.getHqInstance();
|
||||
break;
|
||||
case 3:
|
||||
cardImageSource = MtgatheringRuImageSource.getMqInstance();
|
||||
break;
|
||||
case 4:
|
||||
cardImageSource = MtgatheringRuImageSource.getLqInstance();
|
||||
break;
|
||||
}
|
||||
int count = DownloadPictures.this.cards.size();
|
||||
float mb = (count * cardImageSource.getAverageSize()) / 1024;
|
||||
|
|
@ -574,4 +564,4 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
private static final Logger log = Logger.getLogger(DownloadPictures.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue