aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp1
-rw-r--r--src/plugins/Fourchan.cpp17
2 files changed, 17 insertions, 1 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 197425f..e2922c7 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1598,7 +1598,6 @@ namespace QuickMedia {
body->reset_selected();
search_bar->clear();
} else if(event.key.code == sf::Keyboard::P) {
- // TODO: Make this work when thumbnail is preview for a video/gif instead of a static image
BodyItem *selected_item = body->get_selected();
if(selected_item && !selected_item->attached_content_url.empty()) {
if(is_url_video(selected_item->attached_content_url)) {
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