aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-04-16 23:52:21 +0200
committerdec05eba <dec05eba@protonmail.com>2023-04-16 23:52:21 +0200
commit2b746f718d0ddecc4d7fe19ad4c5d842cc530628 (patch)
treed3e5d77010b591f2fd80bd08e31c5d919fa4751e /src/plugins
parent8a2bc2d0991e227a21bd1ba3dac94d5f32957988 (diff)
Sort anime seasons by timestamp
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/DramaCool.cpp1
-rw-r--r--src/plugins/LocalAnime.cpp15
2 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/DramaCool.cpp b/src/plugins/DramaCool.cpp
index 3042519..df0bb43 100644
--- a/src/plugins/DramaCool.cpp
+++ b/src/plugins/DramaCool.cpp
@@ -344,7 +344,6 @@ namespace QuickMedia {
}
static bool mixdrop_extract_video_url(const std::string &website_data, std::string &url) {
- std::vector<std::string> mdcore_scripts = mixdrop_extract_mdcore_scripts(website_data);
std::vector<std::string> mdcore_parts;
if(!mixdrop_extract_mdcore_parts(website_data, mdcore_parts))
return false;
diff --git a/src/plugins/LocalAnime.cpp b/src/plugins/LocalAnime.cpp
index 14329cc..a47ea74 100644
--- a/src/plugins/LocalAnime.cpp
+++ b/src/plugins/LocalAnime.cpp
@@ -172,7 +172,10 @@ namespace QuickMedia {
}
update_modified_time_from_episodes(grouped_anime.anime);
- sort_anime_items_by_name_desc(grouped_anime.anime.items);
+ if(get_config().local_anime.sort_by_name)
+ sort_anime_items_by_name_desc(grouped_anime.anime.items);
+ else
+ sort_anime_items_by_timestamp_asc(grouped_anime.anime.items);
grouped_items.push_back(std::move(grouped_anime.anime));
}
@@ -202,7 +205,7 @@ namespace QuickMedia {
static std::vector<LocalAnimeItem> get_episodes_or_seasons_in_directory(const Path &directory) {
std::vector<LocalAnimeItem> anime_items;
- for_files_in_dir_sort_name(directory, [&](const Path &filepath, FileType file_type) -> bool {
+ auto callback = [&](const Path &filepath, FileType file_type) -> bool {
time_t modified_time_seconds;
if(!file_get_last_modified_time_seconds(filepath.data.c_str(), &modified_time_seconds))
return true;
@@ -222,7 +225,13 @@ namespace QuickMedia {
anime_items.push_back(std::move(season));
return true;
- }, FileSortDirection::DESC);
+ };
+
+ if(get_config().local_anime.sort_by_name)
+ for_files_in_dir_sort_name(directory, std::move(callback), FileSortDirection::DESC);
+ else
+ for_files_in_dir_sort_last_modified(directory, std::move(callback));
+
return anime_items;
}