diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-02-20 22:52:28 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-02-20 22:52:28 +0100 |
commit | 2beeddb325ecbc03ddd6c741449fabd527a3c8cc (patch) | |
tree | 545866dddda5f31aff0fc17713f19963e1517757 /plugins | |
parent | 5d999a9c97b986ff513aa6df71719914a41cb3eb (diff) |
Local-anime: add option to group episodes into anime groups from the name of the anime by using the local_manga.auto_group_episodes config
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/EpisodeNameParser.hpp | 15 | ||||
-rw-r--r-- | plugins/LocalAnime.hpp | 25 |
2 files changed, 24 insertions, 16 deletions
diff --git a/plugins/EpisodeNameParser.hpp b/plugins/EpisodeNameParser.hpp new file mode 100644 index 0000000..1ec847a --- /dev/null +++ b/plugins/EpisodeNameParser.hpp @@ -0,0 +1,15 @@ +#pragma once + +#include <string_view> +#include <optional> + +namespace QuickMedia { + struct EpisodeNameParts { + std::string_view group; // optional + std::string_view anime; // required + std::string_view season; // optional + std::string_view episode; // required + }; + + std::optional<EpisodeNameParts> episode_name_extract_parts(std::string_view episode_name); +}
\ No newline at end of file diff --git a/plugins/LocalAnime.hpp b/plugins/LocalAnime.hpp index 7fe58d9..19b93e8 100644 --- a/plugins/LocalAnime.hpp +++ b/plugins/LocalAnime.hpp @@ -17,49 +17,42 @@ namespace QuickMedia { }; struct LocalAnimeSeason { - Path path; + std::string name; std::vector<LocalAnimeItem> episodes; time_t modified_time_seconds; }; struct LocalAnime { - Path path; + std::string name; std::vector<LocalAnimeItem> items; time_t modified_time_seconds; }; - enum class LocalAnimeSearchPageType { - DIRECTORY, - ANIME, - SEASON - }; + std::vector<LocalAnimeItem> get_anime_in_directory(const Path &directory); class LocalAnimeSearchPage : public LazyFetchPage { public: - LocalAnimeSearchPage(Program *program, Path directory, LocalAnimeSearchPageType type) - : LazyFetchPage(program), directory(std::move(directory)), type(type) {} + LocalAnimeSearchPage(Program *program, std::vector<LocalAnimeItem> anime_items) + : LazyFetchPage(program), 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<Tab> &result_tabs) override; PluginResult lazy_fetch(BodyItems &result_items) override; - bool reload_on_page_change() override { return true; } - bool reseek_to_body_item_by_url() override { return true; } void toggle_read(BodyItem *selected_item) override; private: - Path directory; - LocalAnimeSearchPageType type; + std::vector<LocalAnimeItem> anime_items; }; class LocalAnimeVideoPage : public VideoPage { public: - LocalAnimeVideoPage(Program *program, std::string filepath, WatchProgress watch_progress) - : VideoPage(program, std::move(filepath)), watch_progress(std::move(watch_progress)) {} + LocalAnimeVideoPage(Program *program, std::string filepath, WatchProgress *watch_progress) + : VideoPage(program, std::move(filepath)), 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) override; private: - WatchProgress watch_progress; + WatchProgress *watch_progress; }; }
\ No newline at end of file |