aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Fourchan.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-12-07 18:10:12 +0100
committerdec05eba <dec05eba@protonmail.com>2019-12-07 18:10:12 +0100
commit3364e8c6291907ea88e45314c5add9624b81c110 (patch)
treef832ea211c8c4fc7f132ba68c8c0c32bfce3e3bb /src/plugins/Fourchan.cpp
parent623cfeb9de7ff4bcc710b5a4e41cc354bb2e3f0c (diff)
Add support for viewing videos/gifs on image boards (4chan)
Diffstat (limited to 'src/plugins/Fourchan.cpp')
-rw-r--r--src/plugins/Fourchan.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp
index 17fefdc..f19d3aa 100644
--- a/src/plugins/Fourchan.cpp
+++ b/src/plugins/Fourchan.cpp
@@ -52,11 +52,6 @@ namespace QuickMedia {
return SuggestionResult::OK;
}
- static bool string_ends_with(const std::string &str, const std::string &ends_with_str) {
- size_t ends_len = ends_with_str.size();
- return ends_len == 0 || (str.size() >= ends_len && memcmp(&str[str.size() - ends_len], ends_with_str.data(), ends_len) == 0);
- }
-
struct CommentPiece {
enum class Type {
TEXT,
@@ -236,7 +231,7 @@ namespace QuickMedia {
const Json::Value &tim = thread["tim"];
if(tim.isNumeric() && ext.isString()) {
std::string ext_str = ext.asString();
- if(ext_str == ".png" || ext_str == ".jpg" || ext_str == ".jpeg") {
+ if(ext_str == ".png" || ext_str == ".jpg" || ext_str == ".jpeg" || ext_str == ".webm" || ext_str == ".mp4" || ext_str == ".gif") {
} else {
fprintf(stderr, "TODO: Support file extension: %s\n", ext_str.c_str());
}
@@ -347,7 +342,7 @@ namespace QuickMedia {
const Json::Value &tim = post["tim"];
if(tim.isNumeric() && ext.isString()) {
std::string ext_str = ext.asString();
- if(ext_str == ".png" || ext_str == ".jpg" || ext_str == ".jpeg") {
+ if(ext_str == ".png" || ext_str == ".jpg" || ext_str == ".jpeg" || ext_str == ".webm" || ext_str == ".mp4" || ext_str == ".gif") {
} else {
fprintf(stderr, "TODO: Support file extension: %s\n", ext_str.c_str());
}
@@ -355,7 +350,7 @@ namespace QuickMedia {
// thumbnails always has .jpg extension even if they are gifs or webm.
std::string tim_str = std::to_string(tim.asInt64());
body_item->thumbnail_url = fourchan_image_url + list_url + "/" + tim_str + "s.jpg";
- body_item->fullsize_image_url = fourchan_image_url + list_url + "/" + tim_str + ext_str;
+ body_item->attached_content_url = fourchan_image_url + list_url + "/" + tim_str + ext_str;
}
++body_item_index;