aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/LocalAnime.hpp3
-rw-r--r--src/QuickMedia.cpp2
-rw-r--r--src/plugins/LocalAnime.cpp5
-rw-r--r--src/plugins/NyaaSi.cpp5
4 files changed, 13 insertions, 2 deletions
diff --git a/plugins/LocalAnime.hpp b/plugins/LocalAnime.hpp
index 4d51e24..6edf1c8 100644
--- a/plugins/LocalAnime.hpp
+++ b/plugins/LocalAnime.hpp
@@ -32,6 +32,8 @@ namespace QuickMedia {
class LocalAnimeSearchPage : public LazyFetchPage {
public:
+ LocalAnimeSearchPage(Program *program)
+ : LazyFetchPage(program), parent_search_page(nullptr), fetch_home_page(true) {}
LocalAnimeSearchPage(Program *program, std::vector<LocalAnimeItem> anime_items, LocalAnimeSearchPage *parent_search_page = nullptr)
: LazyFetchPage(program), parent_search_page(parent_search_page), anime_items(std::move(anime_items)) {}
const char* get_title() const override { return "Search"; }
@@ -44,6 +46,7 @@ namespace QuickMedia {
LocalAnimeSearchPage *parent_search_page;
private:
std::vector<LocalAnimeItem> anime_items;
+ bool fetch_home_page = false;
};
class LocalAnimeVideoPage : public VideoPage {
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 447b863..433cc77 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1279,7 +1279,7 @@ namespace QuickMedia {
exit(1);
}
- auto search_page = std::make_unique<LocalAnimeSearchPage>(this, get_anime_in_directory(get_config().local_anime.directory));
+ auto search_page = std::make_unique<LocalAnimeSearchPage>(this);
tabs.push_back(Tab{create_body(false, true), std::move(search_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
start_tab_index = 0;
diff --git a/src/plugins/LocalAnime.cpp b/src/plugins/LocalAnime.cpp
index 6337adf..14329cc 100644
--- a/src/plugins/LocalAnime.cpp
+++ b/src/plugins/LocalAnime.cpp
@@ -336,6 +336,11 @@ namespace QuickMedia {
}
PluginResult LocalAnimeSearchPage::lazy_fetch(BodyItems &result_items) {
+ if(fetch_home_page) {
+ fetch_home_page = false;
+ anime_items = get_anime_in_directory(get_config().local_anime.directory);
+ }
+
std::unordered_map<std::string, WatchProgress> watch_progress = get_watch_progress_for_plugin("local-anime");
const time_t time_now = time(nullptr);
diff --git a/src/plugins/NyaaSi.cpp b/src/plugins/NyaaSi.cpp
index 739032b..d0bc616 100644
--- a/src/plugins/NyaaSi.cpp
+++ b/src/plugins/NyaaSi.cpp
@@ -463,6 +463,7 @@ namespace QuickMedia {
result_items.push_back(std::move(body_item));
}
+ html_unescape_sequences(title);
result_items.front()->set_title(title);
result = quickmedia_html_find_nodes_xpath(&html_search, "//div[id='torrent-description']",
@@ -513,7 +514,9 @@ namespace QuickMedia {
QuickMediaStringView href = quickmedia_html_node_get_attribute_value(node->node, "href");
QuickMediaStringView text = quickmedia_html_node_get_text(node);
if(href.data && text.data && href.size >= 6 && memcmp(href.data, "/user/", 6) == 0) {
- auto body_item = BodyItem::create(std::string(text.data, text.size));
+ std::string title(text.data, text.size);
+ html_unescape_sequences(title);
+ auto body_item = BodyItem::create(std::move(title));
//body_item->url = "https://nyaa.si/" + std::string(href);
item_data->push_back(std::move(body_item));
}