From 5c72463c029804c85479d2c4426397d932c88ee1 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 20 Sep 2020 18:59:04 +0200 Subject: Add comments and trusted/remake colors to nyaa.si torrents --- src/plugins/NyaaSi.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/plugins/NyaaSi.cpp') 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 = ""; const std::string size_tag_begin = ""; const std::string size_tag_end = ""; + const std::string comments_tag_begin = ""; + const std::string comments_tag_end = ""; + const std::string trusted_tag_begin = ""; + const std::string trusted_tag_end = ""; + const std::string remake_tag_begin = ""; + const std::string remake_tag_end = ""; 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(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; -- cgit v1.2.3