aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Lbry.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-13 07:57:03 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-13 07:57:03 +0200
commita2a49eee1985ec13e52e477060a50da2fcbdb894 (patch)
treeec7686182e2507ac1855f94668686c76af250bc6 /src/plugins/Lbry.cpp
parent522285b55556b954c786d254388c4b0e45f05a14 (diff)
Lbry: fix missing search match for channels with no title (but with a name) and reposts
Diffstat (limited to 'src/plugins/Lbry.cpp')
-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;