]> git.sur5r.net Git - minitube/blobdiff - src/aggregatevideosource.cpp
New upstream version 3.9.1
[minitube] / src / aggregatevideosource.cpp
index 95300f8a4e54d092c3d526d36dc2d6cd7dd3ce28..cf9b6a89801c313592314c23c7597aa54d398611 100644 (file)
@@ -63,7 +63,18 @@ void AggregateVideoSource::loadVideos(int max, int startIndex) {
         video->setChannelId(query.value(4).toString());
         video->setDescription(query.value(5).toString());
         video->setWebpage(query.value(6).toString());
-        video->setThumbnailUrl(query.value(7).toString());
+
+        QString thumbString = query.value(7).toString();
+        if (thumbString.startsWith('[')) {
+            const auto thumbs = QJsonDocument::fromJson(thumbString.toUtf8()).array();
+            for (const auto &t : thumbs) {
+                video->addThumb(t["width"].toInt(), t["height"].toInt(), t["url"].toString());
+            }
+        } else {
+            // assume it's a URL
+            video->addThumb(0, 0, thumbString);
+        }
+
         video->setViewCount(query.value(8).toInt());
         video->setDuration(query.value(9).toInt());
         videos << video;