From d203aba86d89c8dd6184146454396e48d39a8fb5 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 17 Jan 2023 19:05:15 +0100 Subject: NyaaSi: add ctrl+t to track anime with automedia --- plugins/NyaaSi.hpp | 14 ++++++++++---- plugins/utils/EpisodeNameParser.hpp | 9 +++++---- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/NyaaSi.hpp b/plugins/NyaaSi.hpp index 3236fc5..103fea7 100644 --- a/plugins/NyaaSi.hpp +++ b/plugins/NyaaSi.hpp @@ -29,7 +29,7 @@ namespace QuickMedia { DOWNLOADS_ASC }; - class NyaaSiSearchPage : public Page { + class NyaaSiSearchPage : public Page, public TrackablePage { public: NyaaSiSearchPage(Program *program, std::string category_name, std::string category_id, std::string domain); const char* get_title() const override { return title.c_str(); } @@ -38,6 +38,9 @@ namespace QuickMedia { PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override; PluginResult submit(const SubmitArgs &args, std::vector &result_tabs) override; + TrackResult track(const std::string &str) override; + bool is_trackable() const override { return true; } + void set_sort_type(NyaaSiSortType sort_type); const std::string category_name; @@ -59,11 +62,14 @@ namespace QuickMedia { NyaaSiSearchPage *search_page; }; - class NyaaSiTorrentPage : public Page { + class NyaaSiTorrentPage : public Page, public TrackablePage { public: - NyaaSiTorrentPage(Program *program) : Page(program) {} - const char* get_title() const override { return "Torrent"; } + NyaaSiTorrentPage(Program *program, std::string title) : Page(program), TrackablePage(std::move(title), "") {} + const char* get_title() const override { return content_title.c_str(); } PluginResult submit(const SubmitArgs &args, std::vector &result_tabs) override; bool submit_is_async() const override { return false; } + + TrackResult track(const std::string &str) override; + bool is_trackable() const override { return true; } }; } \ No newline at end of file diff --git a/plugins/utils/EpisodeNameParser.hpp b/plugins/utils/EpisodeNameParser.hpp index 1ec847a..7976cdc 100644 --- a/plugins/utils/EpisodeNameParser.hpp +++ b/plugins/utils/EpisodeNameParser.hpp @@ -5,10 +5,11 @@ namespace QuickMedia { struct EpisodeNameParts { - std::string_view group; // optional - std::string_view anime; // required - std::string_view season; // optional - std::string_view episode; // required + std::string_view group; // optional + std::string_view anime; // required + std::string_view season; // optional + std::string_view episode; // required + std::string_view resolution; // optional }; std::optional episode_name_extract_parts(std::string_view episode_name); -- cgit v1.2.3