diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-05-21 21:56:14 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-05-21 22:03:04 +0200 |
commit | 82d937254fb411475db54c829018ef5e4d220f7c (patch) | |
tree | 35509b203bb8ec1dc126c68648201d245df84eb1 /src | |
parent | c51aa0a9a5379ef39551f755c1dce867e38de1c8 (diff) |
Grid view for anime seasons/episodes, only show episode name
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 8 | ||||
-rw-r--r-- | src/plugins/LocalAnime.cpp | 37 |
2 files changed, 30 insertions, 15 deletions
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<YoutubeVideoPage> 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<LocalAnimeBodyItemData*>(args.extra.get()); if(std::holds_alternative<LocalAnime>(*item_data->anime_item)) { const LocalAnime &anime = std::get<LocalAnime>(*item_data->anime_item); - result_tabs.push_back(Tab{ create_body(), std::make_unique<LocalAnimeSearchPage>(program, anime.items, this), create_search_bar("Search...", SEARCH_DELAY_FILTER) }); + result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<LocalAnimeSearchPage>(program, anime.items, this), create_search_bar("Search...", SEARCH_DELAY_FILTER) }); return PluginResult::OK; } else if(std::holds_alternative<LocalAnimeSeason>(*item_data->anime_item)) { const LocalAnimeSeason &season = std::get<LocalAnimeSeason>(*item_data->anime_item); - result_tabs.push_back(Tab{ create_body(), std::make_unique<LocalAnimeSearchPage>(program, season.episodes, this), create_search_bar("Search...", SEARCH_DELAY_FILTER) }); + result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<LocalAnimeSearchPage>(program, season.episodes, this), create_search_bar("Search...", SEARCH_DELAY_FILTER) }); return PluginResult::OK; } else if(std::holds_alternative<LocalAnimeEpisode>(*item_data->anime_item)) { const LocalAnimeEpisode &episode = std::get<LocalAnimeEpisode>(*item_data->anime_item); @@ -365,9 +365,9 @@ namespace QuickMedia { const LocalAnime &anime = std::get<LocalAnime>(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<LocalAnimeSeason>(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<LocalAnimeEpisode>(anime_item); std::string title; + + title += "Episode "; + std::optional<EpisodeNameParts> 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); |