aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/utils
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-01-17 19:05:15 +0100
committerdec05eba <dec05eba@protonmail.com>2023-01-17 19:05:15 +0100
commitd203aba86d89c8dd6184146454396e48d39a8fb5 (patch)
tree584fa3856ca7ab534a111f43e0fc93564116a8d9 /src/plugins/utils
parent454f09ac14a76a46335eed60d4e242c446ae28be (diff)
NyaaSi: add ctrl+t to track anime with automedia
Diffstat (limited to 'src/plugins/utils')
-rw-r--r--src/plugins/utils/EpisodeNameParser.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/plugins/utils/EpisodeNameParser.cpp b/src/plugins/utils/EpisodeNameParser.cpp
index de2b8ac..a381cca 100644
--- a/src/plugins/utils/EpisodeNameParser.cpp
+++ b/src/plugins/utils/EpisodeNameParser.cpp
@@ -71,7 +71,7 @@ namespace QuickMedia {
return episode_name_extract_anime(episode_name);
}
- static bool is_num_real_char(char c) {
+ static bool is_real_num(char c) {
return (c >= '0' && c <= '9') || c == '.';
}
@@ -79,7 +79,7 @@ namespace QuickMedia {
episode_name = strip_left(episode_name);
size_t i = 0;
for(; i < episode_name.size(); ++i) {
- if(!is_num_real_char(episode_name[i]))
+ if(!is_real_num(episode_name[i]))
break;
}
@@ -107,6 +107,21 @@ namespace QuickMedia {
if(name_parts.episode.empty())
return std::nullopt;
+ if(episode_name.find("480p") != std::string_view::npos)
+ name_parts.resolution = "480p";
+ else if(episode_name.find("720p") != std::string_view::npos)
+ name_parts.resolution = "720p";
+ else if(episode_name.find("1080p") != std::string_view::npos)
+ name_parts.resolution = "1080p";
+ else if(episode_name.find("2160p") != std::string_view::npos)
+ name_parts.resolution = "2160p";
+ else if(episode_name.find("1280x720") != std::string_view::npos)
+ name_parts.resolution = "1280x720";
+ else if(episode_name.find("1920x1080") != std::string_view::npos)
+ name_parts.resolution = "1920x1080";
+ else if(episode_name.find("3840x2160") != std::string_view::npos)
+ name_parts.resolution = "3840x2160";
+
return name_parts;
}
} \ No newline at end of file