]> git.sur5r.net Git - minitube/blobdiff - src/channelaggregator.cpp
New upstream version 3.9.1
[minitube] / src / channelaggregator.cpp
index d13779202f50cf714ca63689e96ec0c053931ab1..8097af180e51fe03d44ed32383b50b61cc8e42f9 100644 (file)
@@ -132,7 +132,7 @@ void ChannelAggregator::parseWebPage(const QByteArray &bytes) {
     } else {
         currentChannel->updateChecked();
         currentChannel = 0;
-        processNextChannel();
+        QTimer::singleShot(5000, this, &ChannelAggregator::processNextChannel);
     }
 }
 
@@ -273,7 +273,18 @@ void ChannelAggregator::addVideo(Video *video) {
     query.bindValue(7, video->getChannelId());
     query.bindValue(8, video->getDescription());
     query.bindValue(9, video->getWebpage());
-    query.bindValue(10, video->getThumbnailUrl());
+
+    QJsonDocument thumbsDoc;
+    auto thumbsArray = thumbsDoc.array();
+    for (const auto &t : video->getThumbs()) {
+        thumbsArray.append(QJsonObject{
+                {"url", t.getUrl()},
+                {"width", t.getWidth()},
+                {"height", t.getHeight()},
+        });
+    }
+    thumbsDoc.setArray(thumbsArray);
+    query.bindValue(10, thumbsDoc.toJson(QJsonDocument::Compact));
     query.bindValue(11, video->getViewCount());
     query.bindValue(12, video->getDuration());
     success = query.exec();