From 144b5103c9a60327f52d252df8dee35c417e2ba6 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 24 Aug 2024 11:00:51 +0200 Subject: Local anime: Remove trailing dot from episode name --- src/plugins/utils/EpisodeNameParser.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/plugins/utils/EpisodeNameParser.cpp') diff --git a/src/plugins/utils/EpisodeNameParser.cpp b/src/plugins/utils/EpisodeNameParser.cpp index 8610ab0..8141421 100644 --- a/src/plugins/utils/EpisodeNameParser.cpp +++ b/src/plugins/utils/EpisodeNameParser.cpp @@ -108,6 +108,12 @@ namespace QuickMedia { return (c >= '0' && c <= '9') || c == '.'; } + static void remove_trailing_characters(std::string_view &str, char c) { + while(!str.empty() && str.back() == c) { + str.remove_suffix(1); + } + } + static std::string_view episode_name_extract_episode(std::string_view &episode_name) { episode_name = strip_left(episode_name); size_t i = 0; @@ -120,6 +126,7 @@ namespace QuickMedia { return {}; std::string_view episode = episode_name.substr(0, i); + remove_trailing_characters(episode, '.'); episode_name.remove_prefix(i + 1); return episode; } -- cgit v1.2.3