mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-30 09:04:52 +01:00
Now downloading feeds.
This commit is contained in:
parent
eef67ccba0
commit
c3a914af1b
@ -28,6 +28,7 @@
|
||||
#include "network-web/webfactory.h"
|
||||
#include "services/abstract/category.h"
|
||||
#include "services/inoreader/definitions.h"
|
||||
#include "services/inoreader/inoreaderfeed.h"
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
@ -143,5 +144,37 @@ RootItem* InoreaderNetworkFactory::decodeFeedCategoriesData(const QString& categ
|
||||
}
|
||||
}
|
||||
|
||||
json = QJsonDocument::fromJson(feeds.toUtf8()).object()["subscriptions"].toArray();
|
||||
|
||||
foreach (const QJsonValue& obj, json) {
|
||||
auto subscription = obj.toObject();
|
||||
QString id = subscription["id"].toString();
|
||||
QString title = subscription["title"].toString();
|
||||
QString url = subscription["htmlUrl"].toString();
|
||||
QString parent_label;
|
||||
QJsonArray categories = subscription["categories"].toArray();
|
||||
|
||||
foreach (const QJsonValue& cat, categories) {
|
||||
QString potential_id = cat.toObject()["id"].toString();
|
||||
|
||||
if (potential_id.contains(QSL("/label/"))) {
|
||||
parent_label = potential_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// We have label (not "state").
|
||||
InoreaderFeed* feed = new InoreaderFeed();
|
||||
|
||||
feed->setDescription(url);
|
||||
feed->setUrl(url);
|
||||
feed->setTitle(title);
|
||||
feed->setCustomId(id);
|
||||
|
||||
if (cats.contains(parent_label)) {
|
||||
cats[parent_label]->appendChild(feed);
|
||||
}
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user