From 82d937254fb411475db54c829018ef5e4d220f7c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 21 May 2023 21:56:14 +0200 Subject: Grid view for anime seasons/episodes, only show episode name --- src/QuickMedia.cpp | 8 ++++---- src/plugins/LocalAnime.cpp | 37 ++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index b38275d..1df8e6e 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3494,7 +3494,7 @@ namespace QuickMedia { if(!youtube_url_extract_id(video_page->get_url(), video_id)) { std::string err_msg = "Failed to extract id of youtube url "; err_msg += video_page->get_url(); - err_msg + ", video wont be saved in history"; + err_msg += ", video wont be saved in history"; show_notification("QuickMedia", err_msg.c_str(), Urgency::LOW); return; } @@ -7975,13 +7975,13 @@ namespace QuickMedia { std::string filename; std::string video_id; //const bool url_is_youtube = youtube_url_extract_id(url, video_id); - const bool url_is_youtube = false; + //const bool url_is_youtube = false; std::unique_ptr youtube_video_page; std::string video_url; std::string audio_url; - int64_t video_content_length = 0; - int64_t audio_content_length = 0; + //int64_t video_content_length = 0; + //int64_t audio_content_length = 0; TaskResult task_result = TaskResult::TRUE; if(download_use_youtube_dl) { diff --git a/src/plugins/LocalAnime.cpp b/src/plugins/LocalAnime.cpp index a47ea74..cc82df1 100644 --- a/src/plugins/LocalAnime.cpp +++ b/src/plugins/LocalAnime.cpp @@ -330,11 +330,11 @@ namespace QuickMedia { LocalAnimeBodyItemData *item_data = static_cast(args.extra.get()); if(std::holds_alternative(*item_data->anime_item)) { const LocalAnime &anime = std::get(*item_data->anime_item); - result_tabs.push_back(Tab{ create_body(), std::make_unique(program, anime.items, this), create_search_bar("Search...", SEARCH_DELAY_FILTER) }); + result_tabs.push_back(Tab{ create_body(false, true), std::make_unique(program, anime.items, this), create_search_bar("Search...", SEARCH_DELAY_FILTER) }); return PluginResult::OK; } else if(std::holds_alternative(*item_data->anime_item)) { const LocalAnimeSeason &season = std::get(*item_data->anime_item); - result_tabs.push_back(Tab{ create_body(), std::make_unique(program, season.episodes, this), create_search_bar("Search...", SEARCH_DELAY_FILTER) }); + result_tabs.push_back(Tab{ create_body(false, true), std::make_unique(program, season.episodes, this), create_search_bar("Search...", SEARCH_DELAY_FILTER) }); return PluginResult::OK; } else if(std::holds_alternative(*item_data->anime_item)) { const LocalAnimeEpisode &episode = std::get(*item_data->anime_item); @@ -365,9 +365,9 @@ namespace QuickMedia { const LocalAnime &anime = std::get(anime_item); std::string title; - if(has_finished_watching) - title = "[Finished watching] "; title += anime.name; + if(has_finished_watching) + title += "\n[Finished watching]"; auto body_item = BodyItem::create(std::move(title)); if(has_finished_watching) @@ -390,9 +390,9 @@ namespace QuickMedia { const LocalAnimeSeason &season = std::get(anime_item); std::string title; - if(has_finished_watching) - title = "[Finished watching] "; title += season.name; + if(has_finished_watching) + title += "\n[Finished watching]"; auto body_item = BodyItem::create(std::move(title)); if(has_finished_watching) @@ -415,15 +415,30 @@ namespace QuickMedia { const LocalAnimeEpisode &episode = std::get(anime_item); std::string title; + + title += "Episode "; + std::optional name_parts = episode_name_extract_parts(episode.path.filename()); + if(name_parts) + title += name_parts->episode; + else + title += episode.path.filename_no_ext(); + if(has_finished_watching) - title = "[Finished watching] "; - title += episode.path.filename(); + title += "\n[Finished watching]"; auto body_item = BodyItem::create(std::move(title)); if(has_finished_watching) body_item->set_title_color(finished_watching_color); - body_item->set_description("Updated " + seconds_to_relative_time_str(time_now - episode.modified_time_seconds)); + std::string description; + if(name_parts) { + description += "Resolution: "; + description += name_parts->resolution; + description += '\n'; + } + + description += "Updated " + seconds_to_relative_time_str(time_now - episode.modified_time_seconds); + body_item->set_description(std::move(description)); body_item->set_description_color(get_theme().faded_text_color); body_item->url = episode.path.data; @@ -465,8 +480,9 @@ namespace QuickMedia { mgl::Color color = get_theme().text_color; std::string title; + title += Path(selected_item->url).filename(); if(watch_status == WatchedStatus::WATCHED) { - title = "[Finished watching] "; + title += "\n[Finished watching]"; color = finished_watching_color; item_data->watch_progress.time_pos_sec = *file_analyzer.get_duration_seconds(); @@ -475,7 +491,6 @@ namespace QuickMedia { item_data->watch_progress.time_pos_sec = 0; item_data->watch_progress.duration_sec = *file_analyzer.get_duration_seconds(); } - title += Path(selected_item->url).filename(); selected_item->set_title(std::move(title)); selected_item->set_title_color(color); -- cgit v1.2.3