From f30b6fdf5c40a703b5a8d6fb2a21002377ec9067 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 6 Aug 2024 20:41:53 +0200 Subject: Reduce local-anime/local-manga disk access for speed up on mechanical harddrives, add local_anime.recursive option to make local-anime much faster when local-anime directory is a downloads directory --- include/Config.hpp | 1 + include/Storage.hpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/Config.hpp b/include/Config.hpp index 68e4462..e737fee 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -48,6 +48,7 @@ namespace QuickMedia { bool sort_by_name = false; // Series bool sort_episodes_by_name = true; bool auto_group_episodes = true; + bool recursive = true; }; struct YoutubeSponsorblock { diff --git a/include/Storage.hpp b/include/Storage.hpp index 19dd345..60c15f6 100644 --- a/include/Storage.hpp +++ b/include/Storage.hpp @@ -20,8 +20,8 @@ namespace QuickMedia { DESC }; - // Return false to stop the iterator - using FileIteratorCallback = std::function; + // Return false to stop the iterator. + using FileIteratorCallback = std::function; Path get_home_dir(); Path get_storage_dir(); @@ -34,8 +34,10 @@ namespace QuickMedia { bool file_get_last_modified_time_seconds(const char *path, time_t *result); int file_overwrite(const Path &path, const std::string &data); int file_overwrite_atomic(const Path &path, const std::string &data); + // The callback is called with 0 as the argument (last_modified_seconds) void for_files_in_dir(const Path &path, FileIteratorCallback callback); void for_files_in_dir_sort_last_modified(const Path &path, FileIteratorCallback callback, FileSortDirection sort_dir = FileSortDirection::ASC); + // The callback is called with 0 as the argument (last_modified_seconds) void for_files_in_dir_sort_name(const Path &path, FileIteratorCallback callback, FileSortDirection sort_dir = FileSortDirection::ASC); bool read_file_as_json(const Path &filepath, Json::Value &result); -- cgit v1.2.3