aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/NyaaSi.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-09-20 18:59:04 +0200
committerdec05eba <dec05eba@protonmail.com>2020-09-20 18:59:04 +0200
commit5c72463c029804c85479d2c4426397d932c88ee1 (patch)
tree17d40e579cdc68d07e51233033cfa9db9b534c1d /src/plugins/NyaaSi.cpp
parentf41a28fe3ec5042849583081ca0e1aa6c38a7187 (diff)
Add comments and trusted/remake colors to nyaa.si torrents
Diffstat (limited to 'src/plugins/NyaaSi.cpp')
-rw-r--r--src/plugins/NyaaSi.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/NyaaSi.cpp b/src/plugins/NyaaSi.cpp
index 0d43810..2ecf0d3 100644
--- a/src/plugins/NyaaSi.cpp
+++ b/src/plugins/NyaaSi.cpp
@@ -84,6 +84,12 @@ namespace QuickMedia {
const std::string category_id_tag_end = "</nyaa:categoryId>";
const std::string size_tag_begin = "<nyaa:size>";
const std::string size_tag_end = "</nyaa:size>";
+ const std::string comments_tag_begin = "<nyaa:comments>";
+ const std::string comments_tag_end = "</nyaa:comments>";
+ const std::string trusted_tag_begin = "<nyaa:trusted>";
+ const std::string trusted_tag_end = "</nyaa:trusted>";
+ const std::string remake_tag_begin = "<nyaa:remake>";
+ const std::string remake_tag_end = "</nyaa:remake>";
size_t index = 0;
while(index < website_data.size()) {
@@ -105,6 +111,9 @@ namespace QuickMedia {
std::string downloads = get_rss_item_text(website_data, index, item_end, downloads_tag_begin, downloads_tag_end);
std::string category_id = get_rss_item_text(website_data, index, item_end, category_id_tag_begin, category_id_tag_end);
std::string size = get_rss_item_text(website_data, index, item_end, size_tag_begin, size_tag_end);
+ std::string comments = get_rss_item_text(website_data, index, item_end, comments_tag_begin, comments_tag_end);
+ std::string trusted = get_rss_item_text(website_data, index, item_end, trusted_tag_begin, trusted_tag_end);
+ std::string remake = get_rss_item_text(website_data, index, item_end, remake_tag_begin, remake_tag_end);
if(title.empty() || link.empty() || pub_date.empty() || seeders.empty() || leechers.empty() || downloads.empty() || category_id.empty() || size.empty()) {
fprintf(stderr, "Error: failed to parse nyaa.si rss items\n");
@@ -114,7 +123,11 @@ namespace QuickMedia {
auto body_item = std::make_unique<BodyItem>(std::move(title));
body_item->url = std::move(link);
body_item->thumbnail_url = "https://nyaa.si/static/img/icons/nyaa/" + category_id + ".png";
- body_item->set_description("Published: " + pub_date + "\nSeeders: " + seeders + "\nLeechers: " + leechers + "\nDownloads: " + downloads + "\nSize: " + size);
+ body_item->set_description("Published: " + pub_date + "\nSeeders: " + seeders + "\nLeechers: " + leechers + "\nDownloads: " + downloads + "\nSize: " + size + "\nComments: " + comments);
+ if(trusted == "Yes")
+ body_item->background_color = sf::Color(43, 95, 47);
+ else if(remake == "Yes")
+ body_item->background_color = sf::Color(93, 45, 47);
result_items.push_back(std::move(body_item));
index = item_end + 7;