From ce45ddef54f4722720c0b12083bcca1c37c02dad Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 9 Sep 2024 19:30:32 +0200 Subject: Local anime: sort episode names by name instead of filename --- src/plugins/LocalAnime.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/LocalAnime.cpp b/src/plugins/LocalAnime.cpp index 59e52ad..0febb23 100644 --- a/src/plugins/LocalAnime.cpp +++ b/src/plugins/LocalAnime.cpp @@ -55,7 +55,7 @@ namespace QuickMedia { return season.name; } else if(std::holds_alternative(item)) { const LocalAnimeEpisode &episode = std::get(item); - return episode.path.filename(); + return episode.name; } else { return {}; } @@ -139,13 +139,15 @@ namespace QuickMedia { std::vector grouped_items; for(LocalAnimeItem &item : items) { if(std::holds_alternative(item)) { - const LocalAnimeEpisode &episode = std::get(item); + LocalAnimeEpisode &episode = std::get(item); std::optional name_parts = episode_name_extract_parts(episode.path.filename()); if(!name_parts) { grouped_items.push_back(std::move(item)); continue; } + episode.name = name_parts->episode; + GroupedAnime &grouped_anime = anime_by_name[name_parts->anime]; if(grouped_anime.anime.name.empty()) grouped_anime.anime.name = name_parts->anime; @@ -198,7 +200,7 @@ namespace QuickMedia { if(!file_get_last_modified_time_seconds(filepath.data.c_str(), &modified_time_seconds)) return true; - episodes.push_back(LocalAnimeEpisode{ filepath, modified_time_seconds }); + episodes.push_back(LocalAnimeEpisode{ filepath.data, filepath, modified_time_seconds }); return true; }, FileSortDirection::DESC); return episodes; @@ -214,7 +216,7 @@ namespace QuickMedia { return true; } - anime_items.push_back(LocalAnimeEpisode{ filepath, last_modified_seconds }); + anime_items.push_back(LocalAnimeEpisode{ filepath.data, filepath, last_modified_seconds }); } return true; } @@ -253,7 +255,7 @@ namespace QuickMedia { return true; } - anime_items.push_back(LocalAnimeEpisode{ filepath, last_modified_seconds }); + anime_items.push_back(LocalAnimeEpisode{ filepath.data, filepath, last_modified_seconds }); } return true; } -- cgit v1.2.3