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 --- TODO | 3 ++- src/plugins/DramaCool.cpp | 1 - src/plugins/LocalAnime.cpp | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index fe1800b..fa6e760 100644 --- a/TODO +++ b/TODO @@ -257,4 +257,5 @@ Support NicoNicoDouga and BiliBili (user request). Support arabic/hebrew text. Use Text class for all text rendering. Add command to change avatar/username/etc globally/per room in matrix. Fix youtube information page missing info, show more youtube info in search results. -Implement m.room.canonical_alias. \ No newline at end of file +Implement m.room.canonical_alias. +Sometimes youtube videos get throttled and reloading the video fixes it most of the time. Find a way to do that automatically. Or maybe decrypt the nsig when using the new endpoint. \ No newline at end of file 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