aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/MessageQueue.hpp2
-rw-r--r--src/plugins/Lbry.cpp24
2 files changed, 20 insertions, 6 deletions
diff --git a/include/MessageQueue.hpp b/include/MessageQueue.hpp
index 30826f4..286739d 100644
--- a/include/MessageQueue.hpp
+++ b/include/MessageQueue.hpp
@@ -58,7 +58,7 @@ namespace QuickMedia {
running = true;
}
- // Returns true from |callback| to remove the element
+ // Return true from |callback| to remove the element
void erase_if(std::function<bool(T&)> callback) {
std::unique_lock<std::mutex> lock(mutex);
for(auto it = data_queue.begin(); it != data_queue.end();) {
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;