new autodownloader partially done
This commit is contained in:
parent
c20ca2d1e6
commit
3a5fce9613
5 changed files with 110 additions and 37 deletions
|
@ -94,9 +94,9 @@ void PictureLoadingThread::run()
|
||||||
break;
|
break;
|
||||||
if (image.load(QString("%1/%2/%3%4.full.jpg").arg(picsPath).arg(sortedSets[i]->getShortName()).arg(correctedName).arg(1)))
|
if (image.load(QString("%1/%2/%3%4.full.jpg").arg(picsPath).arg(sortedSets[i]->getShortName()).arg(correctedName).arg(1)))
|
||||||
break;
|
break;
|
||||||
|
if (image.load(QString("%1/%2/%3/%4.full.jpg").arg(picsPath).arg("downloadedPics").arg(sortedSets[i]->getShortName()).arg(correctedName)))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (image.isNull())
|
|
||||||
image.load(QString("%1/%2/%3.full.jpg").arg(picsPath).arg("downloadedPics").arg(correctedName));
|
|
||||||
|
|
||||||
emit imageLoaded(card, image);
|
emit imageLoaded(card, image);
|
||||||
}
|
}
|
||||||
|
@ -117,8 +117,8 @@ void PictureLoadingThread::setPicsPath(const QString &path)
|
||||||
_picsPath = path;
|
_picsPath = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardInfo::CardInfo(CardDatabase *_db, const QString &_name, const QString &_manacost, const QString &_cardtype, const QString &_powtough, const QString &_text, const QStringList &_colors, bool _cipt, int _tableRow, const SetList &_sets, const QMap<QString, QString> &_picURLs)
|
CardInfo::CardInfo(CardDatabase *_db, const QString &_name, const QString &_manacost, const QString &_cardtype, const QString &_powtough, const QString &_text, const QStringList &_colors, bool _cipt, int _tableRow, const SetList &_sets, const QMap<QString, QString> &_picURLs, const QMap<QString, QString> &_picURLsHq, const QMap<QString, QString> &_picURLsSt)
|
||||||
: db(_db), name(_name), sets(_sets), manacost(_manacost), cardtype(_cardtype), powtough(_powtough), text(_text), colors(_colors), picURLs(_picURLs), cipt(_cipt), tableRow(_tableRow), pixmap(NULL)
|
: db(_db), name(_name), sets(_sets), manacost(_manacost), cardtype(_cardtype), powtough(_powtough), text(_text), colors(_colors), picURLs(_picURLs), picURLsHq(_picURLsHq), picURLsSt(_picURLsSt), cipt(_cipt), tableRow(_tableRow), pixmap(NULL)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < sets.size(); i++)
|
for (int i = 0; i < sets.size(); i++)
|
||||||
sets[i]->append(this);
|
sets[i]->append(this);
|
||||||
|
@ -198,7 +198,7 @@ void CardInfo::imageLoaded(const QImage &image)
|
||||||
*pixmap = QPixmap::fromImage(image);
|
*pixmap = QPixmap::fromImage(image);
|
||||||
emit pixmapUpdated();
|
emit pixmapUpdated();
|
||||||
} else if (settingsCache->getPicDownload())
|
} else if (settingsCache->getPicDownload())
|
||||||
db->startPicDownload(this);
|
db->startPicDownload(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap *CardInfo::getPixmap(QSize size)
|
QPixmap *CardInfo::getPixmap(QSize size)
|
||||||
|
@ -267,6 +267,8 @@ QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
|
||||||
for (int i = 0; i < sets.size(); i++) {
|
for (int i = 0; i < sets.size(); i++) {
|
||||||
xml.writeStartElement("set");
|
xml.writeStartElement("set");
|
||||||
xml.writeAttribute("picURL", info->getPicURL(sets[i]->getShortName()));
|
xml.writeAttribute("picURL", info->getPicURL(sets[i]->getShortName()));
|
||||||
|
xml.writeAttribute("picURLHq", info->getPicURLHq(sets[i]->getShortName()));
|
||||||
|
xml.writeAttribute("picURLSt", info->getPicURLSt(sets[i]->getShortName()));
|
||||||
xml.writeCharacters(sets[i]->getShortName());
|
xml.writeCharacters(sets[i]->getShortName());
|
||||||
xml.writeEndElement();
|
xml.writeEndElement();
|
||||||
}
|
}
|
||||||
|
@ -379,12 +381,16 @@ void CardDatabase::clearPixmapCache()
|
||||||
noCard->clearPixmapCache();
|
noCard->clearPixmapCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardDatabase::startPicDownload(CardInfo *card)
|
void CardDatabase::startPicDownload(CardInfo *card, bool stripped)
|
||||||
{
|
{
|
||||||
if (card->getPicURLs().isEmpty())
|
SetList sortedSets = card->getSets();
|
||||||
|
if (sortedSets.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
sortedSets.sortByKey();
|
||||||
|
for (int i = 0; i < sortedSets.size(); ++i)
|
||||||
|
qDebug() << sortedSets[i]->getShortName();
|
||||||
|
|
||||||
cardsToDownload.append(card);
|
cardsToDownload.append(PictureToDownload(card, stripped, sortedSets.first()->getShortName()));
|
||||||
if (!downloadRunning)
|
if (!downloadRunning)
|
||||||
startNextPicDownload();
|
startNextPicDownload();
|
||||||
}
|
}
|
||||||
|
@ -400,7 +406,17 @@ void CardDatabase::startNextPicDownload()
|
||||||
downloadRunning = true;
|
downloadRunning = true;
|
||||||
|
|
||||||
cardBeingDownloaded = cardsToDownload.takeFirst();
|
cardBeingDownloaded = cardsToDownload.takeFirst();
|
||||||
QNetworkRequest req(QUrl(cardBeingDownloaded->getPicURL()));
|
QString picUrl;
|
||||||
|
if (cardBeingDownloaded.getStripped())
|
||||||
|
picUrl = cardBeingDownloaded.getCard()->getPicURLSt(cardBeingDownloaded.getSetName());
|
||||||
|
else if (cardBeingDownloaded.getHq())
|
||||||
|
picUrl = cardBeingDownloaded.getCard()->getPicURLHq(cardBeingDownloaded.getSetName());
|
||||||
|
else
|
||||||
|
picUrl = cardBeingDownloaded.getCard()->getPicURL(cardBeingDownloaded.getSetName());
|
||||||
|
QUrl url(picUrl);
|
||||||
|
|
||||||
|
QNetworkRequest req(url);
|
||||||
|
qDebug() << "starting picture download:" << req.url();
|
||||||
networkManager->get(req);
|
networkManager->get(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,13 +432,26 @@ void CardDatabase::picDownloadFinished(QNetworkReply *reply)
|
||||||
return;
|
return;
|
||||||
dir.mkdir("downloadedPics");
|
dir.mkdir("downloadedPics");
|
||||||
}
|
}
|
||||||
QFile newPic(picsPath + "/downloadedPics/" + cardBeingDownloaded->getCorrectedName() + ".full.jpg");
|
if (!QDir(QString(picsPath + "/downloadedPics/" + cardBeingDownloaded.getSetName())).exists()) {
|
||||||
|
QDir dir(QString(picsPath + "/downloadedPics"));
|
||||||
|
dir.mkdir(cardBeingDownloaded.getSetName());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString suffix;
|
||||||
|
if (!cardBeingDownloaded.getStripped())
|
||||||
|
suffix = ".full";
|
||||||
|
|
||||||
|
QFile newPic(picsPath + "/downloadedPics/" + cardBeingDownloaded.getSetName() + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + suffix + ".jpg");
|
||||||
if (!newPic.open(QIODevice::WriteOnly))
|
if (!newPic.open(QIODevice::WriteOnly))
|
||||||
return;
|
return;
|
||||||
newPic.write(picData);
|
newPic.write(picData);
|
||||||
newPic.close();
|
newPic.close();
|
||||||
|
|
||||||
cardBeingDownloaded->updatePixmapCache();
|
cardBeingDownloaded.getCard()->updatePixmapCache();
|
||||||
|
} else {
|
||||||
|
qDebug() << "Download finished, received invalid picture. URL:" << reply->request().url();
|
||||||
|
cardBeingDownloaded.setHq(false);
|
||||||
|
cardsToDownload.prepend(cardBeingDownloaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
@ -457,7 +486,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml)
|
||||||
if (xml.name() == "card") {
|
if (xml.name() == "card") {
|
||||||
QString name, manacost, type, pt, text;
|
QString name, manacost, type, pt, text;
|
||||||
QStringList colors;
|
QStringList colors;
|
||||||
QMap<QString, QString> picURLs;
|
QMap<QString, QString> picURLs, picURLsHq, picURLsSt;
|
||||||
SetList sets;
|
SetList sets;
|
||||||
int tableRow = 0;
|
int tableRow = 0;
|
||||||
bool cipt = false;
|
bool cipt = false;
|
||||||
|
@ -475,10 +504,14 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml)
|
||||||
else if (xml.name() == "text")
|
else if (xml.name() == "text")
|
||||||
text = xml.readElementText();
|
text = xml.readElementText();
|
||||||
else if (xml.name() == "set") {
|
else if (xml.name() == "set") {
|
||||||
QString url = xml.attributes().value("picURL").toString();
|
QString picURL = xml.attributes().value("picURL").toString();
|
||||||
|
QString picURLHq = xml.attributes().value("picURLHq").toString();
|
||||||
|
QString picURLSt = xml.attributes().value("picURLSt").toString();
|
||||||
QString setName = xml.readElementText();
|
QString setName = xml.readElementText();
|
||||||
sets.append(getSet(setName));
|
sets.append(getSet(setName));
|
||||||
picURLs.insert(setName, url);
|
picURLs.insert(setName, picURL);
|
||||||
|
picURLsHq.insert(setName, picURLHq);
|
||||||
|
picURLsSt.insert(setName, picURLSt);
|
||||||
} else if (xml.name() == "color")
|
} else if (xml.name() == "color")
|
||||||
colors << xml.readElementText();
|
colors << xml.readElementText();
|
||||||
else if (xml.name() == "tablerow")
|
else if (xml.name() == "tablerow")
|
||||||
|
@ -486,7 +519,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml)
|
||||||
else if (xml.name() == "cipt")
|
else if (xml.name() == "cipt")
|
||||||
cipt = (xml.readElementText() == "1");
|
cipt = (xml.readElementText() == "1");
|
||||||
}
|
}
|
||||||
cardHash.insert(name, new CardInfo(this, name, manacost, type, pt, text, colors, cipt, tableRow, sets, picURLs));
|
cardHash.insert(name, new CardInfo(this, name, manacost, type, pt, text, colors, cipt, tableRow, sets, picURLs, picURLsHq, picURLsSt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -561,6 +594,17 @@ bool CardDatabase::loadCardDatabase(const QString &path)
|
||||||
if (!path.isEmpty())
|
if (!path.isEmpty())
|
||||||
loadSuccess = loadFromFile(path);
|
loadSuccess = loadFromFile(path);
|
||||||
else loadSuccess = false;
|
else loadSuccess = false;
|
||||||
|
|
||||||
|
if (loadSuccess) {
|
||||||
|
SetList allSets;
|
||||||
|
QHashIterator<QString, CardSet *> setsIterator(setHash);
|
||||||
|
while (setsIterator.hasNext())
|
||||||
|
allSets.append(setsIterator.next().value());
|
||||||
|
allSets.sortByKey();
|
||||||
|
for (int i = 0; i < allSets.size(); ++i)
|
||||||
|
allSets[i]->setSortKey(i);
|
||||||
|
}
|
||||||
|
|
||||||
return loadSuccess;
|
return loadSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ private:
|
||||||
QString powtough;
|
QString powtough;
|
||||||
QString text;
|
QString text;
|
||||||
QStringList colors;
|
QStringList colors;
|
||||||
QMap<QString, QString> picURLs;
|
QMap<QString, QString> picURLs, picURLsHq, picURLsSt;
|
||||||
bool cipt;
|
bool cipt;
|
||||||
int tableRow;
|
int tableRow;
|
||||||
QPixmap *pixmap;
|
QPixmap *pixmap;
|
||||||
|
@ -82,7 +82,9 @@ public:
|
||||||
bool cipt = false,
|
bool cipt = false,
|
||||||
int _tableRow = 0,
|
int _tableRow = 0,
|
||||||
const SetList &_sets = SetList(),
|
const SetList &_sets = SetList(),
|
||||||
const QMap<QString, QString> &_picURLs = QMap<QString, QString>());
|
const QMap<QString, QString> &_picURLs = QMap<QString, QString>(),
|
||||||
|
const QMap<QString, QString> &_picURLsHq = QMap<QString, QString>(),
|
||||||
|
const QMap<QString, QString> &_picURLsSt = QMap<QString, QString>());
|
||||||
~CardInfo();
|
~CardInfo();
|
||||||
const QString &getName() const { return name; }
|
const QString &getName() const { return name; }
|
||||||
const SetList &getSets() const { return sets; }
|
const SetList &getSets() const { return sets; }
|
||||||
|
@ -94,6 +96,8 @@ public:
|
||||||
void setText(const QString &_text) { text = _text; }
|
void setText(const QString &_text) { text = _text; }
|
||||||
const QStringList &getColors() const { return colors; }
|
const QStringList &getColors() const { return colors; }
|
||||||
QString getPicURL(const QString &set) const { return picURLs.value(set); }
|
QString getPicURL(const QString &set) const { return picURLs.value(set); }
|
||||||
|
QString getPicURLHq(const QString &set) const { return picURLsHq.value(set); }
|
||||||
|
QString getPicURLSt(const QString &set) const { return picURLsSt.value(set); }
|
||||||
QString getPicURL() const;
|
QString getPicURL() const;
|
||||||
const QMap<QString, QString> &getPicURLs() const { return picURLs; }
|
const QMap<QString, QString> &getPicURLs() const { return picURLs; }
|
||||||
QString getMainCardType() const;
|
QString getMainCardType() const;
|
||||||
|
@ -101,6 +105,8 @@ public:
|
||||||
int getTableRow() const { return tableRow; }
|
int getTableRow() const { return tableRow; }
|
||||||
void setTableRow(int _tableRow) { tableRow = _tableRow; }
|
void setTableRow(int _tableRow) { tableRow = _tableRow; }
|
||||||
void setPicURL(const QString &_set, const QString &_picURL) { picURLs.insert(_set, _picURL); }
|
void setPicURL(const QString &_set, const QString &_picURL) { picURLs.insert(_set, _picURL); }
|
||||||
|
void setPicURLHq(const QString &_set, const QString &_picURL) { picURLsHq.insert(_set, _picURL); }
|
||||||
|
void setPicURLSt(const QString &_set, const QString &_picURL) { picURLsSt.insert(_set, _picURL); }
|
||||||
void addToSet(CardSet *set);
|
void addToSet(CardSet *set);
|
||||||
QPixmap *loadPixmap();
|
QPixmap *loadPixmap();
|
||||||
QPixmap *getPixmap(QSize size);
|
QPixmap *getPixmap(QSize size);
|
||||||
|
@ -113,14 +119,30 @@ signals:
|
||||||
void pixmapUpdated();
|
void pixmapUpdated();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PictureToDownload {
|
||||||
|
private:
|
||||||
|
CardInfo *card;
|
||||||
|
bool stripped;
|
||||||
|
QString setName;
|
||||||
|
bool hq;
|
||||||
|
public:
|
||||||
|
PictureToDownload(CardInfo *_card = 0, bool _stripped = false, const QString &_setName = QString(), bool _hq = true)
|
||||||
|
: card(_card), stripped(_stripped), setName(_setName), hq(_hq) { }
|
||||||
|
CardInfo *getCard() const { return card; }
|
||||||
|
bool getStripped() const { return stripped; }
|
||||||
|
QString getSetName() const { return setName; }
|
||||||
|
bool getHq() const { return hq; }
|
||||||
|
void setHq(bool _hq) { hq = _hq; }
|
||||||
|
};
|
||||||
|
|
||||||
class CardDatabase : public QObject {
|
class CardDatabase : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
protected:
|
protected:
|
||||||
QHash<QString, CardInfo *> cardHash;
|
QHash<QString, CardInfo *> cardHash;
|
||||||
QHash<QString, CardSet *> setHash;
|
QHash<QString, CardSet *> setHash;
|
||||||
QNetworkAccessManager *networkManager;
|
QNetworkAccessManager *networkManager;
|
||||||
QList<CardInfo *> cardsToDownload;
|
QList<PictureToDownload> cardsToDownload;
|
||||||
CardInfo *cardBeingDownloaded;
|
PictureToDownload cardBeingDownloaded;
|
||||||
bool downloadRunning;
|
bool downloadRunning;
|
||||||
bool loadSuccess;
|
bool loadSuccess;
|
||||||
CardInfo *noCard;
|
CardInfo *noCard;
|
||||||
|
@ -139,7 +161,7 @@ public:
|
||||||
SetList getSetList() const;
|
SetList getSetList() const;
|
||||||
bool loadFromFile(const QString &fileName);
|
bool loadFromFile(const QString &fileName);
|
||||||
bool saveToFile(const QString &fileName);
|
bool saveToFile(const QString &fileName);
|
||||||
void startPicDownload(CardInfo *card);
|
void startPicDownload(CardInfo *card, bool stripped);
|
||||||
QStringList getAllColors() const;
|
QStringList getAllColors() const;
|
||||||
QStringList getAllMainCardTypes() const;
|
QStringList getAllMainCardTypes() const;
|
||||||
bool getLoadSuccess() const { return loadSuccess; }
|
bool getLoadSuccess() const { return loadSuccess; }
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<cockatrice_setdatabase version="20110126">
|
<cockatrice_setdatabase version="20110126">
|
||||||
<picture_url>http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=%1&type=card</picture_url>
|
<picture_url>http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!cardid!&type=card</picture_url>
|
||||||
|
<picture_url_hq>http://mtgpics.chutography.com/!set!/!name!.full.jpg</picture_url_hq>
|
||||||
|
<picture_url_st>http://mtgpics.chutography.com/!set!/!name!.jpg</picture_url_st>
|
||||||
<set_url>http://gatherer.wizards.com/Pages/Search/Default.aspx?output=spoiler&method=text&set=["!longname!"]</set_url>
|
<set_url>http://gatherer.wizards.com/Pages/Search/Default.aspx?output=spoiler&method=text&set=["!longname!"]</set_url>
|
||||||
<set import="1">
|
<set import="1">
|
||||||
<name>ARB</name>
|
<name>ARB</name>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
OracleImporter::OracleImporter(const QString &_dataDir, QObject *parent)
|
OracleImporter::OracleImporter(const QString &_dataDir, QObject *parent)
|
||||||
: CardDatabase(parent), dataDir(_dataDir), setIndex(-1)
|
: CardDatabase(parent), dataDir(_dataDir), setIndex(-1)
|
||||||
|
@ -59,6 +60,10 @@ void OracleImporter::readSetsFromXml(QXmlStreamReader &xml)
|
||||||
edition = editionLong = editionURL = QString();
|
edition = editionLong = editionURL = QString();
|
||||||
} else if (xml.name() == "picture_url")
|
} else if (xml.name() == "picture_url")
|
||||||
pictureUrl = xml.readElementText();
|
pictureUrl = xml.readElementText();
|
||||||
|
else if (xml.name() == "picture_url_hq")
|
||||||
|
pictureUrlHq = xml.readElementText();
|
||||||
|
else if (xml.name() == "picture_url_st")
|
||||||
|
pictureUrlSt = xml.readElementText();
|
||||||
else if (xml.name() == "set_url")
|
else if (xml.name() == "set_url")
|
||||||
setUrl = xml.readElementText();
|
setUrl = xml.readElementText();
|
||||||
}
|
}
|
||||||
|
@ -82,7 +87,7 @@ CardInfo *OracleImporter::addCard(const QString &setName, QString cardName, int
|
||||||
// Workaround for card name weirdness
|
// Workaround for card name weirdness
|
||||||
if (cardName.contains("XX"))
|
if (cardName.contains("XX"))
|
||||||
cardName.remove("XX");
|
cardName.remove("XX");
|
||||||
cardName = cardName.replace("Æ", "Ae");
|
cardName = cardName.replace("Æ", "AE");
|
||||||
|
|
||||||
bool mArtifact = false;
|
bool mArtifact = false;
|
||||||
if (cardType.endsWith("Artifact"))
|
if (cardType.endsWith("Artifact"))
|
||||||
|
@ -122,7 +127,9 @@ CardInfo *OracleImporter::addCard(const QString &setName, QString cardName, int
|
||||||
|
|
||||||
cardHash.insert(cardName, card);
|
cardHash.insert(cardName, card);
|
||||||
}
|
}
|
||||||
card->setPicURL(setName, pictureUrl.arg(cardId));
|
card->setPicURL(setName, getPictureUrl(pictureUrl, cardId, cardName, setName));
|
||||||
|
card->setPicURLHq(setName, getPictureUrl(pictureUrlHq, cardId, cardName, setName));
|
||||||
|
card->setPicURLSt(setName, getPictureUrl(pictureUrlSt, cardId, cardName, setName));
|
||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +152,7 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QByteArray &data)
|
||||||
QString errorMsg;
|
QString errorMsg;
|
||||||
int errorLine, errorColumn;
|
int errorLine, errorColumn;
|
||||||
if (!doc.setContent(bufferContents, &errorMsg, &errorLine, &errorColumn))
|
if (!doc.setContent(bufferContents, &errorMsg, &errorLine, &errorColumn))
|
||||||
qDebug(QString("error: %1, line=%2, column=%3").arg(errorMsg).arg(errorLine).arg(errorColumn).toLatin1());
|
qDebug() << "error:" << errorMsg << "line:" << errorLine << "column:" << errorColumn;
|
||||||
|
|
||||||
QDomNodeList divs = doc.elementsByTagName("div");
|
QDomNodeList divs = doc.elementsByTagName("div");
|
||||||
for (int i = 0; i < divs.size(); ++i) {
|
for (int i = 0; i < divs.size(); ++i) {
|
||||||
|
@ -195,21 +202,19 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QByteArray &data)
|
||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString OracleImporter::getURLFromName(QString name) const
|
QString OracleImporter::getPictureUrl(QString url, int cardId, QString name, const QString &setName) const
|
||||||
{
|
{
|
||||||
return pictureUrl.arg(
|
return url.replace("!cardid!", QString::number(cardId)).replace("!set!", setName).replace("!name!", name
|
||||||
name
|
|
||||||
.replace("Æther", "Aether")
|
|
||||||
.replace("ö", "o")
|
.replace("ö", "o")
|
||||||
.remove('\'')
|
// .remove('\'')
|
||||||
.remove("//")
|
.remove(" // ")
|
||||||
.remove(',')
|
// .remove(',')
|
||||||
.remove(':')
|
// .remove(':')
|
||||||
.remove('.')
|
// .remove('.')
|
||||||
.remove(QRegExp("\\(.*\\)"))
|
.remove(QRegExp("\\(.*\\)"))
|
||||||
.simplified()
|
.simplified()
|
||||||
.replace(' ', '_')
|
// .replace(' ', '_')
|
||||||
.replace('-', '_')
|
// .replace('-', '_')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,13 +25,13 @@ class OracleImporter : public CardDatabase {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
QList<SetToDownload> allSets, setsToDownload;
|
QList<SetToDownload> allSets, setsToDownload;
|
||||||
QString pictureUrl, setUrl;
|
QString pictureUrl, pictureUrlHq, pictureUrlSt, setUrl;
|
||||||
QString dataDir;
|
QString dataDir;
|
||||||
int setIndex;
|
int setIndex;
|
||||||
int reqId;
|
int reqId;
|
||||||
QBuffer *buffer;
|
QBuffer *buffer;
|
||||||
QHttp *http;
|
QHttp *http;
|
||||||
QString getURLFromName(QString name) const;
|
QString getPictureUrl(QString url, int cardId, QString name, const QString &setName) const;
|
||||||
|
|
||||||
void downloadNextFile();
|
void downloadNextFile();
|
||||||
void readSetsFromXml(QXmlStreamReader &xml);
|
void readSetsFromXml(QXmlStreamReader &xml);
|
||||||
|
|
Loading…
Reference in a new issue