#pragma once #include "Page.hpp" #include "WatchProgress.hpp" #include #include namespace QuickMedia { struct LocalAnime; struct LocalAnimeSeason; struct LocalAnimeEpisode; using LocalAnimeItem = std::variant; struct LocalAnimeEpisode { Path path; time_t modified_time_seconds; }; struct LocalAnimeSeason { std::string name; std::vector episodes; time_t modified_time_seconds; }; struct LocalAnime { std::string name; std::vector items; time_t modified_time_seconds; }; std::vector get_anime_in_directory(const Path &directory); class LocalAnimeSearchPage : public LazyFetchPage { public: LocalAnimeSearchPage(Program *program, std::vector 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"; } bool search_is_filter() override { return true; } PluginResult submit(const SubmitArgs &args, std::vector &result_tabs) override; PluginResult lazy_fetch(BodyItems &result_items) override; void toggle_read(BodyItem *selected_item) override; bool reseek_to_body_item_by_url() override { return true; } LocalAnimeSearchPage *parent_search_page; private: std::vector anime_items; }; class LocalAnimeVideoPage : public VideoPage { public: LocalAnimeVideoPage(Program *program, LocalAnimeSearchPage *search_page, std::string filepath, WatchProgress *watch_progress) : VideoPage(program, std::move(filepath)), search_page(search_page), watch_progress(watch_progress) {} const char* get_title() const override { return ""; } std::string get_video_url(int max_height, bool &has_embedded_audio, std::string &ext) override; std::string get_url_timestamp() override; bool is_local() const override { return true; } void set_watch_progress(int64_t time_pos_sec, int64_t duration_sec) override; private: LocalAnimeSearchPage *search_page; WatchProgress *watch_progress; }; }