aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Fourchan.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-06-02 00:05:37 +0200
committerdec05eba <dec05eba@protonmail.com>2020-06-02 00:05:37 +0200
commitfe92e3fcf858fc71583cd1a52a25e1f62324f5b8 (patch)
tree45bc72fe600346087f2ebcf9b72e79159c7f3fb6 /src/plugins/Fourchan.cpp
parent223cdf22c5aec68d1e14bc013d8e75daa374d04e (diff)
Play all videos in thread instead of exiting after playing the first one
Diffstat (limited to 'src/plugins/Fourchan.cpp')
-rw-r--r--src/plugins/Fourchan.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp
index 1dfe681..e65835a 100644
--- a/src/plugins/Fourchan.cpp
+++ b/src/plugins/Fourchan.cpp
@@ -374,6 +374,7 @@ namespace QuickMedia {
}
PluginResult Fourchan::get_thread_comments(const std::string &list_url, const std::string &url, BodyItems &result_items) {
+ cached_media_urls.clear();
std::string server_response;
if(download_to_string(fourchan_url + list_url + "/thread/" + url + ".json", server_response, {}, use_tor) != DownloadResult::OK)
return PluginResult::NET_ERR;
@@ -509,6 +510,7 @@ namespace QuickMedia {
std::string tim_str = std::to_string(tim.asInt64());
body_item->thumbnail_url = fourchan_image_url + list_url + "/" + tim_str + "s.jpg";
body_item->attached_content_url = fourchan_image_url + list_url + "/" + tim_str + ext_str;
+ cached_media_urls.push_back(body_item->attached_content_url);
}
++body_item_index;
@@ -547,4 +549,19 @@ namespace QuickMedia {
return PostResult::TRY_AGAIN;
return PostResult::ERR;
}
+
+ BodyItems Fourchan::get_related_media(const std::string &url) {
+ BodyItems body_items;
+ auto it = cached_media_urls.begin();
+ for(; it != cached_media_urls.end(); ++it) {
+ if(url == *it)
+ break;
+ }
+ for(; it != cached_media_urls.end(); ++it) {
+ auto body_item = std::make_unique<BodyItem>("");
+ body_item->url = *it;
+ body_items.push_back(std::move(body_item));
+ }
+ return body_items;
+ }
} \ No newline at end of file