aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------depends/mglpp0
-rw-r--r--src/plugins/ImageBoard.cpp2
-rw-r--r--src/plugins/Youtube.cpp24
3 files changed, 23 insertions, 3 deletions
diff --git a/depends/mglpp b/depends/mglpp
-Subproject a2ac8b537a61fb7a7be1a3e08635ffc88e17d96
+Subproject 8b020f5be8fbd3741085849fccd5c958cf260d2
diff --git a/src/plugins/ImageBoard.cpp b/src/plugins/ImageBoard.cpp
index 3b7850b..b027b9e 100644
--- a/src/plugins/ImageBoard.cpp
+++ b/src/plugins/ImageBoard.cpp
@@ -2,7 +2,7 @@
namespace QuickMedia {
void ImageBoardThreadPage::copy_to_clipboard(const BodyItem *body_item) {
- set_clipboard(body_item->get_description());
+ set_clipboard(body_item->get_title());
}
PluginResult ImageBoardThreadPage::login(const std::string &token, const std::string &pin, std::string &response_msg) {
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp
index 8dabd2d..8e08062 100644
--- a/src/plugins/Youtube.cpp
+++ b/src/plugins/Youtube.cpp
@@ -2167,18 +2167,38 @@ namespace QuickMedia {
return result_items;
}
+ static std::string views_separate_with_commas(const std::string &views) {
+ const int num_commas = ((int)views.size() - 1) / 3;
+ std::string result;
+ result.resize(views.size() + num_commas);
+ int result_index = (int)views.size() + num_commas - 1;
+ int inc = 0;
+
+ for(int i = (int)views.size() - 1; i >= 0; --i, ++inc) {
+ if(inc > 0 && inc % 3 == 0) {
+ result[result_index] = ',';
+ --result_index;
+ }
+
+ result[result_index] = views[i];
+ --result_index;
+ }
+
+ return result;
+ }
+
static std::shared_ptr<BodyItem> video_details_to_body_item(const YoutubeVideoDetails &video_details) {
auto body_item = BodyItem::create(video_details.title);
std::string description;
if(!video_details.views.empty()) {
- description = video_details.views + " view" + (video_details.views == "1" ? "" : "s");
+ description = views_separate_with_commas(video_details.views) + " view" + (video_details.views == "1" ? "" : "s");
}
if(!video_details.rating.empty()) {
if(!description.empty())
description += " • ";
- description += "rated " + video_details.rating + "/5";
+ description += "rated " + video_details.rating.substr(0, 4) + "/5";
}
if(!video_details.author.empty()) {