From 2b746f718d0ddecc4d7fe19ad4c5d842cc530628 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 16 Apr 2023 23:52:21 +0200 Subject: Sort anime seasons by timestamp --- src/plugins/DramaCool.cpp | 1 - src/plugins/LocalAnime.cpp | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/plugins') 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 mdcore_scripts = mixdrop_extract_mdcore_scripts(website_data); std::vector 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 get_episodes_or_seasons_in_directory(const Path &directory) { std::vector 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; } -- cgit v1.2.3