aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-24 11:00:51 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-24 11:00:51 +0200
commit144b5103c9a60327f52d252df8dee35c417e2ba6 (patch)
treea3112186d7416490195b6a25d3794847f1ec8ee3 /src
parent7d3a13e15eeb4a1824256c8bb24ba2e35514e354 (diff)
Local anime: Remove trailing dot from episode name
Diffstat (limited to 'src')
-rw-r--r--src/plugins/utils/EpisodeNameParser.cpp7
1 files changed, 7 insertions, 0 deletions
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;
}