diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-06-27 00:06:08 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-06-27 00:06:08 +0200 |
commit | 33167be93badbd69f703b2c081b0bb6df3a65ce6 (patch) | |
tree | c7f92bc33d0e0f4f487d02caccb173ba076edecf | |
parent | e2adb33f6cb05fb424175633c56ff43cc24a7adf (diff) |
Add local_anime.sort_episodes_by_name config to allow sorting episodes differently than series. True by default
m--------- | depends/html-parser | 0 | ||||
-rw-r--r-- | example-config.json | 3 | ||||
-rw-r--r-- | include/Config.hpp | 3 | ||||
-rw-r--r-- | src/Config.cpp | 1 | ||||
-rw-r--r-- | src/plugins/LocalAnime.cpp | 4 |
5 files changed, 7 insertions, 4 deletions
diff --git a/depends/html-parser b/depends/html-parser -Subproject 5ea469de363ab319f1cf0707c56bf3165287795 +Subproject ec0e71c259d5aa8be7b8456509b5617d27742b6 diff --git a/example-config.json b/example-config.json index 695b60d..d5e6555 100644 --- a/example-config.json +++ b/example-config.json @@ -38,8 +38,9 @@ "local_anime": { // The directory that contains your anime. See README.md local-anime section for expected directory structure "directory": "", - // Sort anime by name. If false, then sort anime by most recently updated + // Sort anime (series) by name. If false, then sort anime by most recently updated "sort_by_name": false, + "sort_episodes_by_name": true, // If false, anime is displayed in the way they appear in the directory. // If true, QuickMedia tries to group anime episodes into a folder (visually) with the name of the anime "auto_group_episodes": true diff --git a/include/Config.hpp b/include/Config.hpp index 53d2d46..68e4462 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -45,7 +45,8 @@ namespace QuickMedia { struct LocalAnimeConfig { std::string directory; - bool sort_by_name = false; + bool sort_by_name = false; // Series + bool sort_episodes_by_name = true; bool auto_group_episodes = true; }; diff --git a/src/Config.cpp b/src/Config.cpp index 8a9752d..5d16083 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -273,6 +273,7 @@ namespace QuickMedia { if(local_anime_json.isObject()) { get_json_value_path(local_anime_json, "directory", config->local_anime.directory); get_json_value(local_anime_json, "sort_by_name", config->local_anime.sort_by_name); + get_json_value(local_anime_json, "sort_episodes_by_name", config->local_anime.sort_episodes_by_name); get_json_value(local_anime_json, "auto_group_episodes", config->local_anime.auto_group_episodes); } diff --git a/src/plugins/LocalAnime.cpp b/src/plugins/LocalAnime.cpp index bab662b..c906b9b 100644 --- a/src/plugins/LocalAnime.cpp +++ b/src/plugins/LocalAnime.cpp @@ -173,7 +173,7 @@ namespace QuickMedia { } update_modified_time_from_episodes(grouped_anime.anime); - if(get_config().local_anime.sort_by_name) + if(get_config().local_anime.sort_episodes_by_name) sort_anime_items_by_name_desc(grouped_anime.anime.items); else sort_anime_items_by_timestamp_asc(grouped_anime.anime.items); @@ -228,7 +228,7 @@ namespace QuickMedia { return true; }; - if(get_config().local_anime.sort_by_name) + if(get_config().local_anime.sort_episodes_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)); |