From dccfb471ff7017f9ce3a6ed264a684e4fbc383e4 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 15 Jun 2021 20:26:02 +0200 Subject: Add manga description to mangadex and mangakatana search, fix matrix notification invite not showing when opening quickmedia, clear fetch page and items on reload of lazy page --- depends/html-search | 2 +- src/QuickMedia.cpp | 6 +++++- src/VideoPlayer.cpp | 3 ++- src/plugins/Mangadex.cpp | 8 ++++++++ src/plugins/Matrix.cpp | 4 ++-- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/depends/html-search b/depends/html-search index fdcdf3e..50b96bb 160000 --- a/depends/html-search +++ b/depends/html-search @@ -1 +1 @@ -Subproject commit fdcdf3e62230b8bf14d9ee22bb067040d173ea70 +Subproject commit 50b96bb1ad375668519ed44075ec96f2f9ab9477 diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 0513862..ff792e4 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -814,6 +814,7 @@ namespace QuickMedia { {"//div[id='book_list']//div[class='media']//img", "src", nullptr}, {"//div[id='single_book']//div[class='cover']//img", "src", nullptr} }) + .description_handler({{"//div[id='book_list']//div[class='*summary*']", "text"}}) .authors_handler({{"//div[id='single_book']//a[class='author']", "text", "href", "/author/"}}) .list_chapters_handler("//div[class='chapters']//div[class='chapter']//a", "text", "href", "/manga/") .list_chapters_uploaded_time_handler("//div[class='chapters']//div[class='update_time']", "text", nullptr) @@ -1716,8 +1717,11 @@ namespace QuickMedia { for(size_t i = 0; i < tabs.size(); ++i) { tabs[i].body->clear_cache(); - if(tabs[i].page->is_lazy_fetch_page() && static_cast(tabs[i].page.get())->reload_on_page_change()) + if(tabs[i].page->is_lazy_fetch_page() && static_cast(tabs[i].page.get())->reload_on_page_change()) { tab_associated_data[i].lazy_fetch_finished = false; + tab_associated_data[i].fetched_page = 0; + tabs[i].body->clear_items(); + } } if(tabs[selected_tab].page->allow_submit_no_selection()) { diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index 379b5b4..8c17f35 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -98,13 +98,14 @@ namespace QuickMedia { input_ipc_client_fd_arg.c_str(), "--cursor-autohide=no", /* "--no-input-default-bindings", "--input-vo-keyboard=no", "--no-input-cursor", */ "--no-terminal", - "--save-position-on-quit=yes", + "--save-position-on-quit=no", "--profile=pseudo-gui", // For gui when playing audio, requires a version of mpv that isn't ancient ytdl_format.c_str(), "--no-resume-playback", // TODO: Disable hr seek on low power devices? "--hr-seek=yes", //"--cache=no", + "--force-seekable=yes", "--cache-pause=no", input_conf.c_str(), wid_arg.c_str() diff --git a/src/plugins/Mangadex.cpp b/src/plugins/Mangadex.cpp index 45e81cd..0178c1e 100644 --- a/src/plugins/Mangadex.cpp +++ b/src/plugins/Mangadex.cpp @@ -186,6 +186,14 @@ namespace QuickMedia { auto body_item = BodyItem::create(std::move(title)); body_item->url = id_json.asString(); + const Json::Value &description_json = attributes_json["description"]; + if(description_json.isObject()) { + const Json::Value &en_json = description_json["en"]; + if(en_json.isString()) { + body_item->set_description(en_json.asString()); + body_item->set_description_color(sf::Color(179, 179, 179)); + } + } result_items.push_back(std::move(body_item)); } diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 89c9984..1e20bf6 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -1567,7 +1567,7 @@ namespace QuickMedia { std::string room_id(room_id_json.GetString(), room_id_json.GetStringLength()); RoomData *room = get_room_by_id(room_id); if(!room) { - fprintf(stderr, "Warning: got notification in unknown room %s\n", room_id.c_str()); + //fprintf(stderr, "Warning: got notification in unknown room %s\n", room_id.c_str()); continue; } @@ -2656,7 +2656,7 @@ namespace QuickMedia { invite.room_avatar_url = room->get_avatar_url(); invite.invited_by = invited_by; invite.timestamp = timestamp_json.GetInt64(); - invite.new_invite = !next_batch.empty(); + invite.new_invite = !sync_is_cache; std::string room_id_str(room_id.GetString(), room_id.GetStringLength()); if(set_invite(room_id_str, invite)) -- cgit v1.2.3