Workaround more Danbooru brokenness

image-width vs image_width... and so on
This commit is contained in:
Luca Beltrame 2015-08-27 22:28:05 +02:00
parent a103cce1be
commit 6fc03fe504
2 changed files with 13 additions and 5 deletions

View file

@ -214,7 +214,7 @@ void TestDanbooruPost::testPostLoadingXml_data()
QTest::newRow("danbooru") << "donmai.xml"
<< Danbooru::ApiType::OriginalDanbooru
<< 2106872
<< 2107611
<< 1200
<< 993
<< 514370

View file

@ -39,8 +39,17 @@ void DanbooruPost::parseDanbooruDonmai(const QVariantMap &postData) {
m_tags = QSet<QString>::fromList(postData.value("tag_string").toString().split(' '));
m_id = postData.value("id").toString().toInt();
m_height = postData.value("image_height").toString().toInt();
m_width = postData.value("image_width").toString().toInt();
if (postData.contains("image_width")) {
m_width = postData.value("image_width").toString().toInt();
} else if (postData.contains("image-width")) {
m_width = postData.value("image-width").toString().toInt();
}
if (postData.contains("image_height")) {
m_height = postData.value("image_height").toString().toInt();
} else if (postData.contains("image-height")) {
m_height = postData.value("image-height").toString().toInt();
}
m_url = postData.value("file_url").toUrl();
m_thumbnailUrl = postData.value("preview_file_url").toUrl();
m_size = postData.value("file_size").toInt();
@ -87,9 +96,8 @@ void DanbooruPost::parseDanbooruKonachan(const QVariantMap &postData) {
m_tags = QSet<QString>::fromList(postData.value("tags").toString().split(' '));
m_id = postData.value("id").toString().toInt();
m_width = postData.value("width").toString().toInt();
m_height = postData.value("height").toString().toInt();
m_width = postData.value("width").toString().toInt();
m_url = postData.value("file_url").toUrl();
m_thumbnailUrl = postData.value("preview_url").toUrl();
m_size = postData.value("file_size").toInt();