aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/Lbry.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/plugins/Lbry.cpp b/src/plugins/Lbry.cpp
index c35e430..239a269 100644
--- a/src/plugins/Lbry.cpp
+++ b/src/plugins/Lbry.cpp
@@ -25,7 +25,7 @@ namespace QuickMedia {
return true;
}
- static std::shared_ptr<BodyItem> resolve_claim_parse_result(const Json::Value &result_json, time_t time_now) {
+ static std::shared_ptr<BodyItem> resolve_claim(const Json::Value &result_json, time_t time_now) {
if(!result_json.isObject())
return nullptr;
@@ -39,11 +39,15 @@ namespace QuickMedia {
if(!value_json.isObject())
return nullptr;
+ std::string name;
const Json::Value &title_json = value_json["title"];
- if(!title_json.isString())
- return nullptr;
+ const Json::Value &name_json = result_json["name"];
+ if(title_json.isString())
+ name = title_json.asString();
+ else if(name_json.isString())
+ name = name_json.asString();
- auto body_item = BodyItem::create(title_json.asString());
+ auto body_item = BodyItem::create(std::move(name));
bool is_channel = false;
// TODO: Support other types than stream and channel
@@ -88,7 +92,6 @@ namespace QuickMedia {
}
}
- const Json::Value &name_json = result_json["name"];
if(name_json.isString()) {
if(!description.empty())
description += '\n';
@@ -128,6 +131,17 @@ namespace QuickMedia {
return body_item;
}
+ static std::shared_ptr<BodyItem> resolve_claim_parse_result(const Json::Value &result_json, time_t time_now) {
+ if(!result_json.isObject())
+ return nullptr;
+
+ const Json::Value &resposted_claim_json = result_json["reposted_claim"];
+ if(resposted_claim_json.isObject())
+ return resolve_claim(resposted_claim_json, time_now);
+ else
+ return resolve_claim(result_json, time_now);
+ }
+
static PluginResult resolve_claims(Page *page, const Json::Value &request_json, BodyItems &result_items) {
if(!request_json.isObject())
return PluginResult::ERR;