aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index d91f2a1..38ff610 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -35,6 +35,8 @@
#include "../include/Theme.hpp"
#include "../include/Utils.hpp"
#include "../include/Downloader.hpp"
+#include "../include/Storage.hpp"
+#include "../include/AsyncImageLoader.hpp"
#include "../plugins/youtube/YoutubeMediaProxy.hpp"
#include "../include/gui/Button.hpp"
#include "../external/hash-library/sha256.h"
@@ -946,8 +948,8 @@ namespace QuickMedia {
show_notification("QuickMedia", "Upgrading mangadex ids", Urgency::LOW);
std::vector<int> legacy_manga_ids;
- for_files_in_dir_sort_last_modified(content_storage_dir, [&legacy_manga_ids](const std::filesystem::path &filepath) {
- if(filepath.extension() == ".tmp")
+ for_files_in_dir_sort_last_modified(content_storage_dir, [&legacy_manga_ids](const Path &filepath) {
+ if(strcmp(filepath.ext(), ".tmp") == 0)
return true;
std::string filename = filepath.filename();
@@ -1409,32 +1411,29 @@ namespace QuickMedia {
}
time_t now = time(NULL);
- for_files_in_dir_sort_last_modified(content_storage_dir, [&history_items, plugin_name, now](const std::filesystem::path &filepath) {
+ for_files_in_dir_sort_last_modified(content_storage_dir, [&history_items, plugin_name, now](const Path &filepath) {
// This can happen when QuickMedia crashes/is killed while writing to storage.
// In that case, the storage wont be corrupt but there will be .tmp files.
// TODO: Remove these .tmp files if they exist during startup
- if(filepath.extension() == ".tmp")
+ if(strcmp(filepath.ext(), ".tmp") == 0)
return true;
- Path fullpath(filepath.c_str());
Json::Value body;
- if(!read_file_as_json(fullpath, body) || !body.isObject()) {
- fprintf(stderr, "Failed to read json file: %s\n", fullpath.data.c_str());
+ if(!read_file_as_json(filepath, body) || !body.isObject()) {
+ fprintf(stderr, "Failed to read json file: %s\n", filepath.data.c_str());
return true;
}
// TODO: Manga combined
- auto filename = filepath.filename();
- if(filename.empty())
- return true;
+ const char *filename = filepath.filename();
const Json::Value &manga_name = body["name"];
if(!manga_name.isString())
return true;
time_t last_modified_time = 0;
- file_get_last_modified_time_seconds(filepath.c_str(), &last_modified_time);
+ file_get_last_modified_time_seconds(filepath.data.c_str(), &last_modified_time);
// TODO: Add thumbnail
auto body_item = BodyItem::create(manga_name.asString());
@@ -1442,19 +1441,19 @@ namespace QuickMedia {
body_item->set_description_color(get_theme().faded_text_color);
if(strcmp(plugin_name, "manganelo") == 0)
- body_item->url = "https://manganelo.com/manga/" + base64_url_decode(filename.string());
+ body_item->url = "https://manganelo.com/manga/" + base64_url_decode(filename);
else if(strcmp(plugin_name, "manganelos") == 0)
- body_item->url = "http://manganelos.com/manga/" + base64_url_decode(filename.string());
+ body_item->url = "http://manganelos.com/manga/" + base64_url_decode(filename);
else if(strcmp(plugin_name, "mangadex") == 0)
- body_item->url = base64_url_decode(filename.string());
+ body_item->url = base64_url_decode(filename);
else if(strcmp(plugin_name, "mangatown") == 0)
- body_item->url = "https://mangatown.com/manga/" + base64_url_decode(filename.string());
+ body_item->url = "https://mangatown.com/manga/" + base64_url_decode(filename);
else if(strcmp(plugin_name, "mangakatana") == 0)
- body_item->url = "https://mangakatana.com/manga/" + base64_url_decode(filename.string());
+ body_item->url = "https://mangakatana.com/manga/" + base64_url_decode(filename);
else if(strcmp(plugin_name, "onimanga") == 0)
- body_item->url = "https://onimanga.com/" + base64_url_decode(filename.string());
+ body_item->url = "https://onimanga.com/" + base64_url_decode(filename);
else if(strcmp(plugin_name, "readm") == 0)
- body_item->url = "https://readm.org/manga/" + base64_url_decode(filename.string());
+ body_item->url = "https://readm.org/manga/" + base64_url_decode(filename);
else
fprintf(stderr, "Error: Not implemented: filename to manga chapter list\n");